Sha256: 3bccd5e64a80cd4f12e48bc661e58847275ab3478ae264510eba6db30a615177

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require_relative "pesa/authorization"
require_relative "pesa/b2c_payment"
require_relative "pesa/register_urls"
require_relative "pesa/reversal"
require_relative "pesa/simulate_c2b_via_paybill_number"
require_relative "pesa/simulate_c2b_via_till_number"
require_relative "pesa/stk_push_status"
require_relative "pesa/stk_push_via_paybill_number"
require_relative "pesa/stk_push_via_till_number"
require_relative "pesa/version"
require 'ostruct'

module Mobile
  module Pesa
    class Error < StandardError; end

    def self.configuration
      @configuration ||= OpenStruct.new(
        consumer_key: nil,
        consumer_secret: nil,
        pass_key: nil,
        short_code: nil,
        response_type: nil,
        callback_url: nil,
        result_url: nil,
        queue_time_out_url: nil,
        default_description: nil,
        enviroment: nil
      )
    end

    def self.configure
      yield(configuration)
    end

    def to_recursive_ostruct(hash)
      result = hash.each_with_object({}) do |(key, val), memo|
          memo[key] = val.is_a?(Hash) ? to_recursive_ostruct(val) : val
      end

      OpenStruct.new(result)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mobile-pesa-0.1.1 lib/mobile/pesa.rb