Class: Remit::API
- Inherits:
-
Relax::Service
- Object
- Relax::Service
- Remit::API
- Includes:
- CancelSubscriptionAndRefund, CancelToken, DiscardResults, FundPrepaid, GetAccountActivity, GetAccountBalance, GetAllCreditInstruments, GetAllPrepaidInstruments, GetDebtBalance, GetOutstandingDebtBalance, GetPaymentInstruction, GetPipeline, GetPrepaidBalance, GetResults, GetTokenByCaller, GetTokenUsage, GetTokens, GetTotalPrepaidLiability, GetTransaction, InstallPaymentInstruction, Pay, Refund, Reserve, RetryTransaction, Settle, SettleDebt, Signature, VerifySignature, WriteOffDebt
- Defined in:
- lib/remit2.rb
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
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#pipeline_url ⇒ Object
readonly
Returns the value of attribute pipeline_url.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
Instance Method Summary collapse
- #default_query ⇒ Object
-
#initialize(access_key, secret_key, sandbox = false) ⇒ API
constructor
A new instance of API.
- #query(request) ⇒ Object
Methods included from WriteOffDebt
Methods included from VerifySignature
Methods included from SettleDebt
Methods included from Settle
Methods included from RetryTransaction
Methods included from Reserve
Methods included from Refund
Methods included from Pay
Methods included from InstallPaymentInstruction
Methods included from GetTransaction
Methods included from GetTotalPrepaidLiability
Methods included from GetTokenByCaller
Methods included from GetTokens
Methods included from GetTokenUsage
Methods included from GetResults
Methods included from GetPrepaidBalance
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
Methods included from GetOutstandingDebtBalance
Methods included from GetDebtBalance
Methods included from GetAllPrepaidInstruments
Methods included from GetAllCreditInstruments
Methods included from GetAccountBalance
Methods included from GetAccountActivity
Methods included from FundPrepaid
Methods included from DiscardResults
Methods included from CancelToken
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_key ⇒ Object (readonly)
Returns the value of attribute access_key.
93 94 95 |
# File 'lib/remit2.rb', line 93 def access_key @access_key end |
#pipeline_url ⇒ Object (readonly)
Returns the value of attribute pipeline_url.
95 96 97 |
# File 'lib/remit2.rb', line 95 def pipeline_url @pipeline_url end |
#secret_key ⇒ Object (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_query ⇒ Object
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 |