Class: Tappay::Configuration
- Inherits:
-
Object
- Object
- Tappay::Configuration
- Defined in:
- lib/tappay/configuration.rb
Instance Attribute Summary collapse
- #api_version ⇒ Object
-
#apple_pay_merchant_id ⇒ Object
Returns the value of attribute apple_pay_merchant_id.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#google_pay_merchant_id ⇒ Object
Returns the value of attribute google_pay_merchant_id.
-
#instalment_merchant_id ⇒ Object
Returns the value of attribute instalment_merchant_id.
-
#jko_pay_merchant_id ⇒ Object
Returns the value of attribute jko_pay_merchant_id.
-
#line_pay_merchant_id ⇒ Object
Returns the value of attribute line_pay_merchant_id.
-
#merchant_group_id ⇒ Object
Returns the value of attribute merchant_group_id.
-
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
-
#partner_key ⇒ Object
Returns the value of attribute partner_key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #mode ⇒ Object
- #mode=(value) ⇒ Object
- #production? ⇒ Boolean
- #sandbox? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 |
# File 'lib/tappay/configuration.rb', line 10 def initialize @mode = :sandbox @api_version = '3' end |
Instance Attribute Details
#api_version ⇒ Object
15 16 17 |
# File 'lib/tappay/configuration.rb', line 15 def api_version @api_version.to_s end |
#apple_pay_merchant_id ⇒ Object
Returns the value of attribute apple_pay_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def apple_pay_merchant_id @apple_pay_merchant_id end |
#currency ⇒ Object
Returns the value of attribute currency.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def currency @currency end |
#google_pay_merchant_id ⇒ Object
Returns the value of attribute google_pay_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def google_pay_merchant_id @google_pay_merchant_id end |
#instalment_merchant_id ⇒ Object
Returns the value of attribute instalment_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def instalment_merchant_id @instalment_merchant_id end |
#jko_pay_merchant_id ⇒ Object
Returns the value of attribute jko_pay_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def jko_pay_merchant_id @jko_pay_merchant_id end |
#line_pay_merchant_id ⇒ Object
Returns the value of attribute line_pay_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def line_pay_merchant_id @line_pay_merchant_id end |
#merchant_group_id ⇒ Object
Returns the value of attribute merchant_group_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def merchant_group_id @merchant_group_id end |
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def merchant_id @merchant_id end |
#partner_key ⇒ Object
Returns the value of attribute partner_key.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def partner_key @partner_key end |
Instance Method Details
#mode ⇒ Object
34 35 36 |
# File 'lib/tappay/configuration.rb', line 34 def mode @mode ||= :sandbox end |
#mode=(value) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/tappay/configuration.rb', line 27 def mode=(value) unless [:sandbox, :production].include?(value.to_sym) raise ArgumentError, "Invalid mode. Must be :sandbox or :production" end @mode = value.to_sym end |
#production? ⇒ Boolean
23 24 25 |
# File 'lib/tappay/configuration.rb', line 23 def production? @mode == :production end |
#sandbox? ⇒ Boolean
19 20 21 |
# File 'lib/tappay/configuration.rb', line 19 def sandbox? @mode == :sandbox end |
#validate! ⇒ Object
38 39 40 41 |
# File 'lib/tappay/configuration.rb', line 38 def validate! raise ValidationError, 'partner_key is required' if partner_key.nil? raise ValidationError, 'Either merchant_id or merchant_group_id is required' if merchant_id.nil? && merchant_group_id.nil? end |