class Crusade::GCM::AccessTokenFetcher
Attributes
configuration[RW]
Public Class Methods
new(configuration)
click to toggle source
# File lib/crusade/gcm/access_token_fetcher.rb, line 7 def initialize(configuration) self.configuration = configuration end
Public Instance Methods
request_token()
click to toggle source
# File lib/crusade/gcm/access_token_fetcher.rb, line 11 def request_token response = connection.post '/o/oauth2/token', params JSON.parse response.body end
Private Instance Methods
connection()
click to toggle source
# File lib/crusade/gcm/access_token_fetcher.rb, line 21 def connection Faraday.new(:url => 'https://accounts.google.com') do |faraday| faraday.request :multipart faraday.request :url_encoded faraday.use Faraday::Response::Logger, logger faraday.adapter Faraday.default_adapter end end
logger()
click to toggle source
# File lib/crusade/gcm/access_token_fetcher.rb, line 30 def logger Crusade::Logger.logger end
params()
click to toggle source
# File lib/crusade/gcm/access_token_fetcher.rb, line 34 def params { client_id: configuration.client_id, client_secret: configuration.client_secret, refresh_token: configuration.refresh_token, grant_type: 'refresh_token' } end