class ApontadorOauth2::Client
Attributes
options[RW]
token[RW]
Public Class Methods
new(options)
click to toggle source
# File lib/apontador_oauth2/client.rb, line 8 def initialize(options) @options = {:grant_type => "client_credentials", :username => "", :password => "", }.merge!(options) request end
Private Instance Methods
request()
click to toggle source
# File lib/apontador_oauth2/client.rb, line 17 def request connection = Faraday.new(:url => URI.parse(@options[:url])) response = connection.post '/v2/oauth/token', @options @token = JSON.parse(response.body)['access_token'] end