class Peperusha::Authenticate

Public Instance Methods

call() click to toggle source
# 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

Private Instance Methods

check_if_params_missing() click to toggle source
# File lib/peperusha/authenticate.rb, line 32
def check_if_params_missing
  errors = []
  errors << 'consumer_key.missing' if consumer_key.nil?
  errors << 'consumer_secret.missing' if consumer_secret.nil?
  errors
end