class Ncba::Client

Client

Attributes

adapter[R]
api_key[R]
api_user[R]

Public Class Methods

new(api_user:, api_key:, adapter: Faraday.default_adapter) click to toggle source
# File lib/ncba/client.rb, line 12
def initialize(api_user:, api_key:, adapter: Faraday.default_adapter)
  @api_key = api_key # ApiKey
  @api_user = api_user # APIUser
  @adapter = adapter
  @header = {
    'ApiKey': @api_key,
    'APIUser': @api_user
  }
end

Public Instance Methods

account_opening(**args) click to toggle source
# File lib/ncba/client.rb, line 22
def account_opening(**args)
  AccountOpening.new(self, args).call
end
connection() click to toggle source
# File lib/ncba/client.rb, line 42
def connection
  @connection ||= Faraday.new do |conn|
    conn.url_prefix = 'http://developers.cbagroup.com:4040'
    conn.request :json
    conn.response :json, content_type: 'application/json'
    conn.adapter adapter
  end
end
credit_details(**args) click to toggle source
# File lib/ncba/client.rb, line 26
def credit_details(**args)
  CreditDetails.new(self, args).call
end
credit_transfer(**args) click to toggle source
# File lib/ncba/client.rb, line 30
def credit_transfer(**args)
  CreditTransfer.new(self, args).call
end
mpesa_phone_number_validation(**args) click to toggle source
# File lib/ncba/client.rb, line 34
def mpesa_phone_number_validation(**args)
  MpesaPhoneNumberValidation.new(self, args).call
end
transaction_query(**args) click to toggle source
# File lib/ncba/client.rb, line 38
def transaction_query(**args)
  TransactionQuery.new(self, args).call
end