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_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 |
# 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"] @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_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
36 37 38 |
# File 'lib/rma/payment/gateway/configuration.rb', line 36 def missing_fields required_fields.reject { |field| !send(field).nil? && !send(field).to_s.empty? } end |
#required_fields ⇒ Object
32 33 34 |
# File 'lib/rma/payment/gateway/configuration.rb', line 32 def required_fields %i[base_url rsa_key_path beneficiary_id payment_description] end |
#valid? ⇒ Boolean
28 29 30 |
# File 'lib/rma/payment/gateway/configuration.rb', line 28 def valid? required_fields.all? { |field| !send(field).nil? && !send(field).to_s.empty? } end |