class Safie::Client
Public Class Methods
new(attributes)
click to toggle source
Calls superclass method
# File lib/safie/client.rb, line 5 def initialize(attributes) attributes_with_default = { authorization_endpoint: ENDPOINTS[:authorization], token_endpoint: ENDPOINTS[:token] }.merge(attributes) super attributes_with_default end
Public Instance Methods
access_token!(options = {})
click to toggle source
Calls superclass method
# File lib/safie/client.rb, line 18 def access_token!(options = {}) options[:scope] ||= DEFAULT_SCOPE super :body, options end
Private Instance Methods
handle_error_response(response)
click to toggle source
# File lib/safie/client.rb, line 30 def handle_error_response(response) error = JSON.parse(response.body).with_indifferent_access raise Error.new(response.status, error) end
handle_success_response(response)
click to toggle source
# File lib/safie/client.rb, line 25 def handle_success_response(response) token_hash = JSON.parse(response.body).with_indifferent_access AccessToken.new token_hash.delete(:access_token), token_hash end