Class: DkPaymentGateway::Configuration
- Inherits:
-
Object
- Object
- DkPaymentGateway::Configuration
- Defined in:
- lib/dk_payment_gateway/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#password ⇒ Object
Returns the value of attribute password.
-
#source_app ⇒ Object
Returns the value of attribute source_app.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#username ⇒ Object
Returns the value of attribute username.
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.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dk_payment_gateway/configuration.rb', line 10 def initialize @base_url = ENV['DK_BASE_URL'] @api_key = ENV['DK_API_KEY'] @username = ENV['DK_USERNAME'] @password = ENV['DK_PASSWORD'] @client_id = ENV['DK_CLIENT_ID'] @client_secret = ENV['DK_CLIENT_SECRET'] @source_app = ENV['DK_SOURCE_APP'] @timeout = 30 @open_timeout = 10 end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def api_key @api_key end |
#base_url ⇒ Object
Returns the value of attribute base_url.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def base_url @base_url end |
#client_id ⇒ Object
Returns the value of attribute client_id.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def client_secret @client_secret end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def open_timeout @open_timeout end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def password @password end |
#source_app ⇒ Object
Returns the value of attribute source_app.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def source_app @source_app end |
#timeout ⇒ Object
Returns the value of attribute timeout.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def timeout @timeout end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/dk_payment_gateway/configuration.rb', line 7 def username @username end |
Instance Method Details
#missing_fields ⇒ Object
30 31 32 |
# File 'lib/dk_payment_gateway/configuration.rb', line 30 def missing_fields required_fields.reject { |field| !send(field).nil? && !send(field).to_s.empty? } end |
#required_fields ⇒ Object
26 27 28 |
# File 'lib/dk_payment_gateway/configuration.rb', line 26 def required_fields i[base_url api_key username password client_id client_secret source_app] end |
#valid? ⇒ Boolean
22 23 24 |
# File 'lib/dk_payment_gateway/configuration.rb', line 22 def valid? required_fields.all? { |field| !send(field).nil? && !send(field).to_s.empty? } end |