Module: Quaderno::Behavior::Retrieve::ClassMethods

Includes:
Helpers::Authentication
Defined in:
lib/quaderno-ruby/behavior/retrieve.rb

Instance Method Summary collapse

Methods included from Helpers::Authentication

#get_authentication

Instance Method Details

#retrieve(gateway_id, gateway = 'stripe', options = {}) ⇒ Object Also known as: retrieve_customer



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/quaderno-ruby/behavior/retrieve.rb', line 11

def retrieve(gateway_id, gateway = 'stripe', options = {})
  authentication = get_authentication(options.merge(api_model: api_model))

  response = get("#{authentication[:url]}#{gateway}/#{@_retrieve_path}/#{gateway_id}.json",
    basic_auth: authentication[:basic_auth],
    headers: default_headers.merge(authentication[:headers])
  )

  check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
  hash = response.parsed_response
  hash[:authentication_data] = authentication

  object = new hash
  object.rate_limit_info = response

  object
end