Sha256: 56419c9dd4c6134f2616ddb03658fd1d3537d222b72f1df6a295439d5a1217a1

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

require 'epaybg/railtie' if defined?(Rails)
require 'epaybg/transaction'
require 'epaybg/response'
require 'epaybg/version'

module Epaybg
  class << self
    def hmac(data, secret)
      OpenSSL::HMAC.hexdigest('sha1', 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}." unless valid.include?(mode)
      @@mode = mode
    end

    @@mode = :test

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
epaybg-0.3.1 lib/epaybg.rb
epaybg-0.3.0 lib/epaybg.rb