Class: ZaiPayment::Config
- Inherits:
-
Object
- Object
- ZaiPayment::Config
- Defined in:
- lib/zai_payment/config.rb
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #endpoints ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 |
# File 'lib/zai_payment/config.rb', line 8 def initialize @environment = :prelive # or :production @client_id = nil @client_secret = nil @scope = nil @timeout = 30 # General timeout - increased from 10 to 30 seconds @open_timeout = 10 # Connection open timeout @read_timeout = 30 # Read timeout - new separate configuration end |
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
5 6 7 |
# File 'lib/zai_payment/config.rb', line 5 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
5 6 7 |
# File 'lib/zai_payment/config.rb', line 5 def client_secret @client_secret end |
#environment ⇒ Object
Returns the value of attribute environment.
5 6 7 |
# File 'lib/zai_payment/config.rb', line 5 def environment @environment end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
5 6 7 |
# File 'lib/zai_payment/config.rb', line 5 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
5 6 7 |
# File 'lib/zai_payment/config.rb', line 5 def read_timeout @read_timeout end |
#scope ⇒ Object
Returns the value of attribute scope.
5 6 7 |
# File 'lib/zai_payment/config.rb', line 5 def scope @scope end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/zai_payment/config.rb', line 5 def timeout @timeout end |
Instance Method Details
#endpoints ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/zai_payment/config.rb', line 24 def endpoints case environment.to_sym when :prelive { core_base: 'https://test.api.promisepay.com', va_base: 'https://sandbox.au-0000.api.assemblypay.com', auth_base: 'https://au-0000.sandbox.auth.assemblypay.com' } when :production { core_base: 'https://secure.api.promisepay.com', va_base: 'https://au-0000.api.assemblypay.com', auth_base: 'https://au-0000.auth.assemblypay.com' } else raise "Unknown environment: #{environment}" end end |
#validate! ⇒ Object
18 19 20 21 22 |
# File 'lib/zai_payment/config.rb', line 18 def validate! raise Errors::ConfigurationError, 'client_id is required' if client_id.nil? || client_id.empty? raise Errors::ConfigurationError, 'client_secret is required' if client_secret.nil? || client_secret.empty? raise Errors::ConfigurationError, 'scope is required' if scope.nil? || scope.empty? end |