Class: Remit::API

Constant Summary collapse

API_ENDPOINT =
'https://fps.amazonaws.com/'
API_SANDBOX_ENDPOINT =
'https://fps.sandbox.amazonaws.com/'
PIPELINE_URL =
'https://authorize.payments.amazon.com/cobranded-ui/actions/start'
PIPELINE_SANDBOX_URL =
'https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start'
API_VERSION =
"2008-09-17"
SIGNATURE_VERSION =
2
SIGNATURE_METHOD =
"HmacSHA256"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from WriteOffDebt

#write_off_debt

Methods included from VerifySignature

#verify_signature

Methods included from SettleDebt

#settle_debt

Methods included from Settle

#settle

Methods included from RetryTransaction

#retry_transaction

Methods included from Reserve

#reserve

Methods included from Refund

#refund

Methods included from Pay

#pay

Methods included from InstallPaymentInstruction

#install_payment_instruction

Methods included from GetTransaction

#get_transaction

Methods included from GetTotalPrepaidLiability

#get_total_prepaid_liability

Methods included from GetTokenByCaller

#get_token_by_caller

Methods included from GetTokens

#get_tokens

Methods included from GetTokenUsage

#get_token_usage

Methods included from GetResults

#get_results

Methods included from GetPrepaidBalance

#get_prepaid_balance

Methods included from GetPipeline

#get_multi_use_pipeline, #get_pipeline, #get_postpaid_pipeline, #get_recipient_pipeline, #get_recurring_use_pipeline, #get_single_use_pipeline

Methods included from GetPaymentInstruction

#get_payment_instruction

Methods included from GetOutstandingDebtBalance

#get_outstanding_debt_balance

Methods included from GetDebtBalance

#get_debt_balance

Methods included from GetAllPrepaidInstruments

#get_all_prepaid_instruments

Methods included from GetAllCreditInstruments

#get_all_credit_instruments

Methods included from GetAccountBalance

#get_account_balance

Methods included from GetAccountActivity

#get_account_activity

Methods included from FundPrepaid

#fund_prepaid

Methods included from DiscardResults

#discard_results

Methods included from CancelToken

#cancel_token

Methods included from CancelSubscriptionAndRefund

#cancel_subscription_and_refund

Methods included from Signature

#sign, #string_to_sign, #urlencode

Constructor Details

#initialize(access_key, secret_key, sandbox = false) ⇒ API

Returns a new instance of API.



97
98
99
100
101
102
103
# File 'lib/remit2.rb', line 97

def initialize(access_key, secret_key, sandbox=false)
  @access_key = access_key
  @secret_key = secret_key
  @pipeline_url = sandbox ? PIPELINE_SANDBOX_URL : PIPELINE_URL

  super(sandbox ? API_SANDBOX_ENDPOINT : API_ENDPOINT)
end

Instance Attribute Details

#access_keyObject (readonly)

Returns the value of attribute access_key.



93
94
95
# File 'lib/remit2.rb', line 93

def access_key
  @access_key
end

#pipeline_urlObject (readonly)

Returns the value of attribute pipeline_url.



95
96
97
# File 'lib/remit2.rb', line 95

def pipeline_url
  @pipeline_url
end

#secret_keyObject (readonly)

Returns the value of attribute secret_key.



94
95
96
# File 'lib/remit2.rb', line 94

def secret_key
  @secret_key
end

Instance Method Details

#default_queryObject



105
106
107
108
109
110
111
112
113
# File 'lib/remit2.rb', line 105

def default_query
  Relax::Query.new({
    :AWSAccessKeyId => @access_key,
    :SignatureVersion => SIGNATURE_VERSION,
    :SignatureMethod => SIGNATURE_METHOD,
    :Version => API_VERSION,
    :Timestamp => Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
  })
end

#query(request) ⇒ Object



115
116
117
118
119
# File 'lib/remit2.rb', line 115

def query(request)
  query = super
  query[:Signature] = sign(@secret_key, @endpoint, "GET", query)
  query
end