Module: Afterpay

Defined in:
lib/afterpay.rb,
lib/afterpay/item.rb,
lib/afterpay/error.rb,
lib/afterpay/order.rb,
lib/afterpay/client.rb,
lib/afterpay/config.rb,
lib/afterpay/address.rb,
lib/afterpay/payment.rb,
lib/afterpay/version.rb,
lib/afterpay/consumer.rb,
lib/afterpay/discount.rb,
lib/afterpay/utils/money.rb

Defined Under Namespace

Modules: Utils Classes: Address, Client, Config, Consumer, Discount, Error, ErrorMiddleware, Item, Order, Payment

Constant Summary collapse

VERSION =
"0.1.9".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



19
20
21
# File 'lib/afterpay.rb', line 19

def config
  @config
end

Class Method Details

.clientObject

Helper function for Afterpay::Client Use Afterpay.client to send receive request



24
25
26
# File 'lib/afterpay.rb', line 24

def self.client
  Client.new
end

.configure {|config| ... } ⇒ Object

Configure block to setup configuration

Afterpay.configure do |conf|
  conf.app_id = <app_id>
  conf.secret = <secret>
end

Yields:



35
36
37
38
39
40
# File 'lib/afterpay.rb', line 35

def self.configure
  self.config ||= Config.new
  yield(config) if block_given?
  config.fetch_remote_config unless config.skip_remote_config
  config
end

.envObject



42
43
44
# File 'lib/afterpay.rb', line 42

def self.env
  config.env
end