Class: Afterpay::Config
- Inherits:
-
Object
- Object
- Afterpay::Config
- Defined in:
- lib/afterpay/config.rb
Instance Attribute Summary collapse
-
#afterpay_plugin ⇒ Object
Returns the value of attribute afterpay_plugin.
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#description ⇒ Object
Returns the value of attribute description.
-
#env ⇒ Object
Returns the value of attribute env.
-
#maximum_amount ⇒ Object
Returns the value of attribute maximum_amount.
-
#merchant_website_url ⇒ Object
Returns the value of attribute merchant_website_url.
-
#minimum_amount ⇒ Object
Returns the value of attribute minimum_amount.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#raise_errors ⇒ Object
Returns the value of attribute raise_errors.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#skip_remote_config ⇒ Object
Returns the value of attribute skip_remote_config.
-
#system_information ⇒ Object
Returns the value of attribute system_information.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#fetch_remote_config ⇒ Object
Called only after app_id and secred is set.
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 |
# File 'lib/afterpay/config.rb', line 11 def initialize @env = "sandbox" @raise_errors = true @skip_remote_config = false end |
Instance Attribute Details
#afterpay_plugin ⇒ Object
Returns the value of attribute afterpay_plugin.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def afterpay_plugin @afterpay_plugin end |
#app_id ⇒ Object
Returns the value of attribute app_id.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def app_id @app_id end |
#currency ⇒ Object
Returns the value of attribute currency.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def currency @currency end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def description @description end |
#env ⇒ Object
Returns the value of attribute env.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def env @env end |
#maximum_amount ⇒ Object
Returns the value of attribute maximum_amount.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def maximum_amount @maximum_amount end |
#merchant_website_url ⇒ Object
Returns the value of attribute merchant_website_url.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def merchant_website_url @merchant_website_url end |
#minimum_amount ⇒ Object
Returns the value of attribute minimum_amount.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def minimum_amount @minimum_amount end |
#platform ⇒ Object
Returns the value of attribute platform.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def platform @platform end |
#raise_errors ⇒ Object
Returns the value of attribute raise_errors.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def raise_errors @raise_errors end |
#secret ⇒ Object
Returns the value of attribute secret.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def secret @secret end |
#skip_remote_config ⇒ Object
Returns the value of attribute skip_remote_config.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def skip_remote_config @skip_remote_config end |
#system_information ⇒ Object
Returns the value of attribute system_information.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def system_information @system_information end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/afterpay/config.rb', line 5 def type @type end |
Instance Method Details
#fetch_remote_config ⇒ Object
Called only after app_id and secred is set
18 19 20 21 22 |
# File 'lib/afterpay/config.rb', line 18 def fetch_remote_config response_body = Afterpay.client.get("/v2/configuration").body @minimum_amount = response_body.dig(:minimumAmount, :amount).to_f @maximum_amount = response_body.dig(:maximumAmount, :amount).to_f end |