Class: Ncba::Client
- Inherits:
-
Object
- Object
- Ncba::Client
- Defined in:
- lib/ncba/client.rb
Overview
Client
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_user ⇒ Object
readonly
Returns the value of attribute api_user.
Instance Method Summary collapse
- #account_opening(**args) ⇒ Object
- #connection ⇒ Object
- #credit_details(**args) ⇒ Object
- #credit_transfer(**args) ⇒ Object
-
#initialize(api_user:, api_key:, adapter: Faraday.default_adapter) ⇒ Client
constructor
A new instance of Client.
- #mpesa_phone_number_validation(**args) ⇒ Object
- #transaction_query(**args) ⇒ Object
Constructor Details
#initialize(api_user:, api_key:, adapter: Faraday.default_adapter) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 18 19 20 |
# 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 |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
10 11 12 |
# File 'lib/ncba/client.rb', line 10 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/ncba/client.rb', line 10 def api_key @api_key end |
#api_user ⇒ Object (readonly)
Returns the value of attribute api_user.
10 11 12 |
# File 'lib/ncba/client.rb', line 10 def api_user @api_user end |
Instance Method Details
#account_opening(**args) ⇒ Object
22 23 24 |
# File 'lib/ncba/client.rb', line 22 def account_opening(**args) AccountOpening.new(self, args).call end |
#connection ⇒ Object
42 43 44 45 46 47 48 49 |
# 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) ⇒ Object
26 27 28 |
# File 'lib/ncba/client.rb', line 26 def credit_details(**args) CreditDetails.new(self, args).call end |
#credit_transfer(**args) ⇒ Object
30 31 32 |
# File 'lib/ncba/client.rb', line 30 def credit_transfer(**args) CreditTransfer.new(self, args).call end |
#mpesa_phone_number_validation(**args) ⇒ Object
34 35 36 |
# File 'lib/ncba/client.rb', line 34 def mpesa_phone_number_validation(**args) MpesaPhoneNumberValidation.new(self, args).call end |
#transaction_query(**args) ⇒ Object
38 39 40 |
# File 'lib/ncba/client.rb', line 38 def transaction_query(**args) TransactionQuery.new(self, args).call end |