Module: Airtel::Pesa

Defined in:
lib/airtel/pesa.rb,
lib/airtel/pesa/example.rb,
lib/airtel/pesa/version.rb,
lib/airtel/pesa/encryption.rb,
lib/airtel/pesa/user_enquiry.rb,
lib/airtel/pesa/authorization.rb,
lib/airtel/pesa/refund_payment.rb,
lib/airtel/pesa/balance_enquiry.rb,
lib/airtel/pesa/ussd_push_payment.rb,
lib/airtel/pesa/transaction_enquiry.rb,
lib/airtel/pesa/disbursement_payment.rb,
lib/airtel/pesa/disbursement_transaction_enquiry.rb

Defined Under Namespace

Classes: Authorization, BalanceEnquiry, DisbursementTransactionEnquiry, Encryption, Error, Example, RefundPayment, TransactionEnquiry, UssdPushPayment

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configurationObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/airtel/pesa.rb', line 12

def self.configuration
  @configuration ||= OpenStruct.new(
    client_id: nil,
    client_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

.configure {|configuration| ... } ⇒ Object

Yields:



27
28
29
# File 'lib/airtel/pesa.rb', line 27

def self.configure
  yield(configuration)
end

Instance Method Details

#to_recursive_ostruct(hash) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/airtel/pesa.rb', line 31

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