module Quaderno::Behavior::Retrieve::ClassMethods

Public Instance Methods

retrieve(gateway_id, gateway = 'stripe', options = {}) click to toggle source
# File lib/quaderno-ruby/behavior/retrieve.rb, line 12
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

Private Instance Methods

retrieve_path(path) click to toggle source
# File lib/quaderno-ruby/behavior/retrieve.rb, line 32
def retrieve_path(path)
  @_retrieve_path = path
end