Class: PayPro::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/pay_pro/config.rb

Overview

Config saves the configuration options

Constant Summary collapse

DEFAULT_CA_BUNDLE_PATH =
File.join(__dir__, 'data/cacert.pem')
DEFAULT_TIMEOUT =
30
DEFAULT_VERIFY_SSL =
true
ATTRIBUTES =
%i[api_key api_url ca_bundle_path timeout verify_ssl].freeze

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



14
15
16
17
18
19
20
# File 'lib/pay_pro/config.rb', line 14

def initialize
  @api_key = nil
  @api_url = API_URL
  @ca_bundle_path = DEFAULT_CA_BUNDLE_PATH
  @timeout = DEFAULT_TIMEOUT
  @verify_ssl = DEFAULT_VERIFY_SSL
end

Instance Method Details

#merge(hash) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/pay_pro/config.rb', line 22

def merge(hash)
  dup.tap do |instance|
    hash.slice(*ATTRIBUTES).each do |key, value|
      instance.public_send("#{key}=", value)
    end
  end
end