Class: Peperusha::Authenticate

Inherits:
Object
  • Object
show all
Includes:
Interactor
Defined in:
lib/peperusha/authenticate.rb

Instance Method Summary collapse

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/peperusha/authenticate.rb', line 18

def call
  response = Peperusha::Client.invoke_token_request(consumer_key, consumer_secret)

  if response.status == 200
    data = JSON.parse(response.body)
    context.body = data
  else
    client_errors = Peperusha::Client.build_errors_collection(response)
    context.fail!(errors: client_errors)
  end
end