Toot toooooooot (Bluesky-Mastodon cross-poster)

use helper in the login method

Changed files
+1 -10
app
+1 -10
app/mastodon_api.rb
··· 31 end 32 33 def oauth_login_with_password(client_id, client_secret, email, password, scopes) 34 - url = URI("https://#{@host}/oauth/token") 35 - 36 params = { 37 client_id: client_id, 38 client_secret: client_secret, ··· 42 password: password 43 } 44 45 - response = Net::HTTP.post_form(url, params) 46 - status = response.code.to_i 47 - 48 - if status / 100 == 2 49 - JSON.parse(response.body) 50 - else 51 - raise APIError.new(response) 52 - end 53 end 54 55 def account_info
··· 31 end 32 33 def oauth_login_with_password(client_id, client_secret, email, password, scopes) 34 params = { 35 client_id: client_id, 36 client_secret: client_secret, ··· 40 password: password 41 } 42 43 + post_json("https://#{@host}/oauth/token", params) 44 end 45 46 def account_info