Class: DkPaymentGateway::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/dk_payment_gateway/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_keyObject

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_urlObject

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_idObject

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_secretObject

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_timeoutObject

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

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/dk_payment_gateway/configuration.rb', line 7

def password
  @password
end

#source_appObject

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

#timeoutObject

Returns the value of attribute timeout.



7
8
9
# File 'lib/dk_payment_gateway/configuration.rb', line 7

def timeout
  @timeout
end

#usernameObject

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_fieldsObject



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_fieldsObject



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

Returns:

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