Class: Remit::API
- Inherits:
-
Relax::Service
- Object
- Relax::Service
- Remit::API
- Includes:
- Cancel, CancelSubscriptionAndRefund, CancelToken, FundPrepaid, GetAccountActivity, GetAccountBalance, GetAllCreditInstruments, GetAllPrepaidInstruments, GetDebtBalance, GetOutstandingDebtBalance, GetPaymentInstruction, GetPipeline, GetPrepaidBalance, GetRecipientVerificationStatus, GetTokenByCaller, GetTokenUsage, GetTokens, GetTotalPrepaidLiability, GetTransaction, InstallPaymentInstruction, Pay, Refund, Reserve, Settle, SettleDebt, SubscribeForCallerNotification, UnsubscribeForCallerNotification, VerifySignature, WriteOffDebt
- Defined in:
- lib/remit.rb
Constant Summary collapse
- API_ENDPOINT =
'https://fps.amazonaws.com/'.freeze
- API_SANDBOX_ENDPOINT =
'https://fps.sandbox.amazonaws.com/'.freeze
- PIPELINE_URL =
'https://authorize.payments.amazon.com/cobranded-ui/actions/start'.freeze
- PIPELINE_SANDBOX_URL =
'https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start'.freeze
- API_VERSION =
Date.new(2008, 9, 17).to_s.freeze
- PIPELINE_VERSION =
Date.new(2009, 1, 9).to_s.freeze
- SIGNATURE_VERSION =
2.freeze
- SIGNATURE_METHOD =
"HmacSHA256".freeze
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#api_endpoint ⇒ Object
readonly
Returns the value of attribute api_endpoint.
-
#pipeline_url ⇒ Object
readonly
attr_reader :pipeline # kickstarter.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
Class Method Summary collapse
-
.signature_v1(path, params, secret_key) ⇒ Object
generates v1 signatures, for historical purposes.
Instance Method Summary collapse
-
#initialize(access_key, secret_key, sandbox = false) ⇒ API
constructor
A new instance of API.
Methods included from WriteOffDebt
Methods included from UnsubscribeForCallerNotification
#unsubscribe_for_caller_notification
Methods included from SubscribeForCallerNotification
#subscribe_for_caller_notification
Methods included from SettleDebt
Methods included from Settle
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 GetRecipientVerificationStatus
#get_recipient_verification_status
Methods included from GetPrepaidBalance
Methods included from GetPipeline
#get_edit_token_pipeline, #get_multi_use_pipeline, #get_pipeline, #get_postpaid_pipeline, #get_prepaid_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 Cancel
Methods included from CancelToken
Methods included from CancelSubscriptionAndRefund
#cancel_subscription_and_refund
Methods included from VerifySignature
Constructor Details
#initialize(access_key, secret_key, sandbox = false) ⇒ API
Returns a new instance of API.
104 105 106 107 108 109 110 |
# File 'lib/remit.rb', line 104 def initialize(access_key, secret_key, sandbox=false) @access_key = access_key @secret_key = secret_key @pipeline_url = sandbox ? PIPELINE_SANDBOX_URL : PIPELINE_URL @api_endpoint = sandbox ? API_SANDBOX_ENDPOINT : API_ENDPOINT super(@api_endpoint) end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
100 101 102 |
# File 'lib/remit.rb', line 100 def access_key @access_key end |
#api_endpoint ⇒ Object (readonly)
Returns the value of attribute api_endpoint.
102 103 104 |
# File 'lib/remit.rb', line 102 def api_endpoint @api_endpoint end |
#pipeline_url ⇒ Object (readonly)
attr_reader :pipeline # kickstarter
99 100 101 |
# File 'lib/remit.rb', line 99 def pipeline_url @pipeline_url end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
101 102 103 |
# File 'lib/remit.rb', line 101 def secret_key @secret_key end |
Class Method Details
.signature_v1(path, params, secret_key) ⇒ Object
generates v1 signatures, for historical purposes.
113 114 115 116 117 |
# File 'lib/remit.rb', line 113 def self.signature_v1(path, params, secret_key) params = params.reject {|key, val| ['awsSignature', 'action', 'controller', 'id'].include?(key) }.sort_by{ |k,v| k.to_s.downcase }.map{|k,v| "#{CGI::escape(k)}=#{Remit::SignedQuery.escape_value(v)}"}.join('&') signable = path + '?' + params Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, secret_key, signable)).strip end |