Class: Rma::Payment::Gateway::Configuration

Inherits:
Object
  • Object
show all
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.

Examples:

config = Rma::Payment::Gateway::Configuration.new
config.base_url = 'https://api.example.com'
config.rsa_key_path = '/path/to/rsa_key.pem'
config.beneficiary_id = 'YOUR_BENEFICIARY_ID'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_urlObject

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_idObject

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_timeoutObject

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_descriptionObject

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_pathObject

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

#timeoutObject

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_fieldsObject



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_fieldsObject



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

Returns:

  • (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