Module: Epaybg

Defined in:
lib/epaybg.rb,
lib/epaybg/railtie.rb,
lib/epaybg/version.rb,
lib/epaybg/response.rb,
lib/epaybg/recurring.rb,
lib/epaybg/transaction.rb,
lib/epaybg/view_helpers.rb,
lib/epaybg/recurring/payment.rb,
lib/epaybg/recurring/debt/request.rb,
lib/epaybg/recurring/debt/response.rb

Defined Under Namespace

Modules: Recurring, ViewHelpers Classes: Railtie, Response, Transaction

Constant Summary collapse

VERSION =
'1.0.0'
@@mode =
:test

Class Method Summary collapse

Class Method Details

.configObject

A hash containing the configuration options found in the config/epaybg.yml file.



30
31
32
# File 'lib/epaybg.rb', line 30

def config
  @@config[mode.to_s]
end

.config=(config) ⇒ Object



34
35
36
# File 'lib/epaybg.rb', line 34

def config=(config)
  @@config = config
end

.hmac(data, secret) ⇒ Object



9
10
11
# File 'lib/epaybg.rb', line 9

def hmac(data, secret)
  OpenSSL::HMAC.hexdigest('sha1', secret, data)
end

.modeObject

Configuration is loaded based on this property. Values are [:production, :test]. Defaults to :production



15
16
17
# File 'lib/epaybg.rb', line 15

def mode
  @@mode
end

.mode=(mode) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
23
24
# File 'lib/epaybg.rb', line 19

def mode=(mode)
  valid = [:test, :production]
  raise ArgumentError, "#{mode} is not a valid mode for Epaybg.
    Valid modes are #{valid}." unless valid.include?(mode)
  @@mode = mode
end