module ExperianMS::OAuth
Attributes
oauth_response[RW]
Public Instance Methods
authenticate()
click to toggle source
# File lib/experian_ms/oauth.rb, line 6 def authenticate @oauth_response = HTTParty.post(oauth2_endpoint, headers: header_params, body: body_params).parsed_response end
grant_header()
click to toggle source
# File lib/experian_ms/oauth.rb, line 12 def grant_header { "Authorization" => "Bearer #{access_token}" } end
Private Instance Methods
access_token()
click to toggle source
# File lib/experian_ms/oauth.rb, line 26 def access_token oauth_response["access_token"] end
body_params()
click to toggle source
# File lib/experian_ms/oauth.rb, line 22 def body_params "username=#{key}&password=#{secret}&grant_type=password&client_id=#{client_id}" end
expires_in()
click to toggle source
# File lib/experian_ms/oauth.rb, line 34 def expires_in oauth_response["expires_in"] end
header_params()
click to toggle source
# File lib/experian_ms/oauth.rb, line 18 def header_params { "Content-Type" => "application/x-www-form-urlencoded" } end
refresh_token()
click to toggle source
# File lib/experian_ms/oauth.rb, line 38 def refresh_token oauth_response["refresh_token"] end
token_type()
click to toggle source
# File lib/experian_ms/oauth.rb, line 30 def token_type oauth_response["token_type"] end