Method: Datatrans::Config#initialize

Defined in:
lib/datatrans/config.rb

#initialize(options = {}) ⇒ Config

Configure with following options

  • :merchant_id (required)

  • :sign_key (defaults to false)

  • :environment (defaults to :development, available environments are defined in ENVIRONMENTS)

  • :proxy (a hash containing :http_proxyaddr, :http_proxyport, :http_proxyuser, :http_proxypass)

Raises:

  • (ArgumentError)
[View source]

33
34
35
36
37
38
39
# File 'lib/datatrans/config.rb', line 33

def initialize(options = {})
  @merchant_id = options[:merchant_id]
  raise ArgumentError.new(":merchant_id is required") unless self.merchant_id
  self.environment = options[:environment] || DEFAULT_ENVIRONMENT
  @sign_key = options[:sign_key] || DEFAULT_SIGN_KEY
  @proxy = options[:proxy] || {}
end