Module: EzpayInvoice::Configurable

Included in:
EzpayInvoice, Client
Defined in:
lib/ezpay-invoice/configurable.rb

Constant Summary collapse

MODES =
['dev', 'prod']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hash_ivObject

Returns the value of attribute hash_iv.



3
4
5
# File 'lib/ezpay-invoice/configurable.rb', line 3

def hash_iv
  @hash_iv
end

#hash_keyObject

Returns the value of attribute hash_key.



3
4
5
# File 'lib/ezpay-invoice/configurable.rb', line 3

def hash_key
  @hash_key
end

#merchant_idObject

Returns the value of attribute merchant_id.



3
4
5
# File 'lib/ezpay-invoice/configurable.rb', line 3

def merchant_id
  @merchant_id
end

Class Method Details

.attributesObject



25
26
27
28
29
30
31
32
# File 'lib/ezpay-invoice/configurable.rb', line 25

def attributes
  @attributes ||= [
    :merchant_id,
    :hash_key,
    :hash_iv,
    :mode
  ]
end

Instance Method Details

#configObject



20
21
22
# File 'lib/ezpay-invoice/configurable.rb', line 20

def config
  self
end

#modeObject



7
8
9
# File 'lib/ezpay-invoice/configurable.rb', line 7

def mode
  @mode ||= 'dev'
end

#mode=(_mode) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
# File 'lib/ezpay-invoice/configurable.rb', line 11

def mode=(_mode)
  raise ArgumentError, "mode must be one of [#{MODES.join(', ')}]." if !MODES.include?(_mode)
  @mode = _mode
end

#setupObject



16
17
18
# File 'lib/ezpay-invoice/configurable.rb', line 16

def setup
  block_given? ? yield(self) : self
end