Sha256: c181aaaf436dedf7b0a71426037db3e8c0311dd6967a18691e5882ca59ca38e2

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

require 'epaybg/railtie'
require 'epaybg/transaction'
require 'epaybg/response'
require "epaybg/version"

module Epaybg

  class << self

    def hmac(data)
      OpenSSL::HMAC.hexdigest('sha1', config["secret"], data)
    end

    # Configuration is loaded based on this property.
    # Values are [:production, :test]. Defaults to :production
    def mode
      @@mode
    end

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

    @@mode = :production

    # A hash containing the configuration options found in the
    # config/epaybg.yml file.
    def config
      @@config[self.mode.to_s]
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epaybg-0.1.2 lib/epaybg.rb