Method: Ecpay::Client#initialize

Defined in:
lib/ecpay/client.rb

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ecpay/client.rb', line 21

def initialize(options = {})
  @options = { mode: :production }.merge!(options)
  case @options[:mode]
  when :production
    option_required! :merchant_id, :hash_key, :hash_iv
  when :test
    @options = TEST_OPTIONS.merge(options)
  else
    raise InvalidMode, %(option :mode is either :test or :production)
  end
  @options.freeze
end