Class: ArmorPayments::API
- Inherits:
-
Object
- Object
- ArmorPayments::API
- Defined in:
- lib/armor_payments/api.rb
Instance Attribute Summary collapse
-
#authenticator ⇒ Object
Returns the value of attribute authenticator.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
Instance Method Summary collapse
- #accounts ⇒ Object
- #armor_host ⇒ Object
-
#initialize(api_key, api_secret, sandbox = false) ⇒ API
constructor
A new instance of API.
- #orders(account_id) ⇒ Object
- #partner ⇒ Object
- #shipmentcarriers ⇒ Object
- #users(account_id) ⇒ Object
Constructor Details
#initialize(api_key, api_secret, sandbox = false) ⇒ API
Returns a new instance of API.
27 28 29 30 |
# File 'lib/armor_payments/api.rb', line 27 def initialize api_key, api_secret, sandbox = false self.authenticator = ArmorPayments::Authenticator.new(api_key, api_secret) self.sandbox = sandbox end |
Instance Attribute Details
#authenticator ⇒ Object
Returns the value of attribute authenticator.
25 26 27 |
# File 'lib/armor_payments/api.rb', line 25 def authenticator @authenticator end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
25 26 27 |
# File 'lib/armor_payments/api.rb', line 25 def sandbox @sandbox end |
Instance Method Details
#accounts ⇒ Object
36 37 38 |
# File 'lib/armor_payments/api.rb', line 36 def accounts @accounts ||= ArmorPayments::Accounts.new(armor_host, authenticator, '') end |
#armor_host ⇒ Object
32 33 34 |
# File 'lib/armor_payments/api.rb', line 32 def armor_host "https://#{sandbox ? 'sandbox' : 'api'}.armorpayments.com" end |
#orders(account_id) ⇒ Object
40 41 42 |
# File 'lib/armor_payments/api.rb', line 40 def orders account_id ArmorPayments::Orders.new(armor_host, authenticator, accounts.uri(account_id)) end |
#partner ⇒ Object
44 45 46 |
# File 'lib/armor_payments/api.rb', line 44 def partner @partner ||= ArmorPayments::Partner.new(armor_host, authenticator, '') end |
#shipmentcarriers ⇒ Object
48 49 50 |
# File 'lib/armor_payments/api.rb', line 48 def shipmentcarriers @shipmentcarriers ||= ArmorPayments::ShipmentCarriers.new(armor_host, authenticator, '') end |
#users(account_id) ⇒ Object
52 53 54 |
# File 'lib/armor_payments/api.rb', line 52 def users account_id ArmorPayments::Users.new(armor_host, authenticator, accounts.uri(account_id)) end |