class Afterpay::Config

Attributes

app_id[RW]
currency[RW]
description[RW]
env[RW]
maximum_amount[RW]
minimum_amount[RW]
raise_errors[RW]
secret[RW]
skip_remote_config[RW]
type[RW]
user_agent_header[RW]

Public Class Methods

new() click to toggle source
# File lib/afterpay/config.rb, line 10
def initialize
  @env = "sandbox"
  @raise_errors = true
  @skip_remote_config = false
end

Public Instance Methods

fetch_remote_config() click to toggle source

Called only after app_id and secred is set

# File lib/afterpay/config.rb, line 17
def fetch_remote_config
  response = Afterpay.client.get("/v1/configuration").body[0]

  @type = response[:type]
  @minimum_amount = response.dig(:minimumAmount, :amount).to_f
  @maximum_amount = response.dig(:maximumAmount, :amount).to_f
  @description = response[:description]
end