Class: Rma::Payment::Gateway::Configuration
- Inherits:
-
Object
- Object
- Rma::Payment::Gateway::Configuration
- Defined in:
- lib/rma/payment/gateway/configuration.rb
Overview
Configuration class for RMA Payment Gateway. Handles all configuration options required for the RMA Payment Gateway client.
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#beneficiary_id ⇒ Object
Returns the value of attribute beneficiary_id.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#payment_description ⇒ Object
Returns the value of attribute payment_description.
-
#rsa_key ⇒ Object
Returns the value of attribute rsa_key.
-
#rsa_key_path ⇒ Object
Returns the value of attribute rsa_key_path.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #missing_fields ⇒ Object
- #required_fields ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 27 |
# File 'lib/rma/payment/gateway/configuration.rb', line 19 def initialize @base_url = ENV["RMA_BASE_URL"] @rsa_key_path = ENV["RMA_RSA_KEY_PATH"] @rsa_key = ENV["RMA_RSA_KEY"] @beneficiary_id = ENV["RMA_BENEFICIARY_ID"] @payment_description = ENV["RMA_PAYMENT_DESCRIPTION"] @timeout = 30 @open_timeout = 10 end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
17 18 19 |
# File 'lib/rma/payment/gateway/configuration.rb', line 17 def base_url @base_url end |
#beneficiary_id ⇒ Object
Returns the value of attribute beneficiary_id.
17 18 19 |
# File 'lib/rma/payment/gateway/configuration.rb', line 17 def beneficiary_id @beneficiary_id end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
17 18 19 |
# File 'lib/rma/payment/gateway/configuration.rb', line 17 def open_timeout @open_timeout end |
#payment_description ⇒ Object
Returns the value of attribute payment_description.
17 18 19 |
# File 'lib/rma/payment/gateway/configuration.rb', line 17 def payment_description @payment_description end |
#rsa_key ⇒ Object
Returns the value of attribute rsa_key.
17 18 19 |
# File 'lib/rma/payment/gateway/configuration.rb', line 17 def rsa_key @rsa_key end |
#rsa_key_path ⇒ Object
Returns the value of attribute rsa_key_path.
17 18 19 |
# File 'lib/rma/payment/gateway/configuration.rb', line 17 def rsa_key_path @rsa_key_path end |
#timeout ⇒ Object
Returns the value of attribute timeout.
17 18 19 |
# File 'lib/rma/payment/gateway/configuration.rb', line 17 def timeout @timeout end |
Instance Method Details
#missing_fields ⇒ Object
38 39 40 41 42 |
# File 'lib/rma/payment/gateway/configuration.rb', line 38 def missing_fields missing = base_fields.reject { |f| !send(f).nil? && !send(f).to_s.empty? } missing << :rsa_key unless rsa_key_present? missing end |
#required_fields ⇒ Object
34 35 36 |
# File 'lib/rma/payment/gateway/configuration.rb', line 34 def required_fields base_fields + [:rsa_key] end |
#valid? ⇒ Boolean
29 30 31 32 |
# File 'lib/rma/payment/gateway/configuration.rb', line 29 def valid? base_fields.all? { |field| !send(field).nil? && !send(field).to_s.empty? } && rsa_key_present? end |