Module: Afterpay

Defined in:
lib/afterpay/payment.rb,
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/refund.rb,
lib/afterpay/address.rb,
lib/afterpay/version.rb,
lib/afterpay/consumer.rb,
lib/afterpay/discount.rb,
lib/afterpay/utils/money.rb,
lib/afterpay/payment_event.rb,
lib/afterpay/shipping_courier.rb

Overview

rubocop:disable Metrics/ClassLength

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"2.0.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



22
23
24
# File 'lib/afterpay.rb', line 22

def config
  @config
end

Class Method Details

.clientObject

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



27
28
29
# File 'lib/afterpay.rb', line 27

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:



38
39
40
41
42
43
# File 'lib/afterpay.rb', line 38

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

.envObject



45
46
47
# File 'lib/afterpay.rb', line 45

def self.env
  config.env
end