Class: Wajub::Client
- Inherits:
-
Object
- Object
- Wajub::Client
- Defined in:
- lib/wajub/client.rb
Instance Attribute Summary collapse
-
#accounts ⇒ Object
readonly
Returns the value of attribute accounts.
-
#balance ⇒ Object
readonly
Returns the value of attribute balance.
-
#beneficiaries ⇒ Object
readonly
Returns the value of attribute beneficiaries.
-
#customers ⇒ Object
readonly
Returns the value of attribute customers.
-
#disputes ⇒ Object
readonly
Returns the value of attribute disputes.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#global ⇒ Object
readonly
Returns the value of attribute global.
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
-
#invoices ⇒ Object
readonly
Returns the value of attribute invoices.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#listen ⇒ Object
readonly
Returns the value of attribute listen.
-
#payments ⇒ Object
readonly
Returns the value of attribute payments.
-
#refunds ⇒ Object
readonly
Returns the value of attribute refunds.
-
#shield ⇒ Object
readonly
Returns the value of attribute shield.
-
#tax ⇒ Object
readonly
Returns the value of attribute tax.
-
#transfers ⇒ Object
readonly
Returns the value of attribute transfers.
-
#webhook_endpoints ⇒ Object
readonly
Returns the value of attribute webhook_endpoints.
-
#webhooks ⇒ Object
readonly
Returns the value of attribute webhooks.
Instance Method Summary collapse
-
#initialize(api_key: nil, webhook_secret: nil, idempotency_key_prefix: 'wajub', transport: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key: nil, webhook_secret: nil, idempotency_key_prefix: 'wajub', transport: nil) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/wajub/client.rb', line 14 def initialize(api_key: nil, webhook_secret: nil, idempotency_key_prefix: 'wajub', transport: nil) key = HttpUtils.normalize_api_key(api_key || ENV.fetch('WAJUB_API_KEY', '')) raise ArgumentError, 'Wajub: api_key is required' if key.empty? base_url = HttpUtils.api_url prefix = idempotency_key_prefix @transport = transport @global = GlobalResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @payments = PaymentsResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @customers = CustomersResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @refunds = CrudResource.new(key, base_url, 'refunds', 'refund', 'refunds', prefix, transport: shared_transport(base_url)) @transfers = CrudResource.new(key, base_url, 'transfers', 'transfer', 'transfers', prefix, transport: shared_transport(base_url)) @beneficiaries = CrudResource.new(key, base_url, 'beneficiaries', 'beneficiary', 'beneficiaries', prefix, transport: shared_transport(base_url)) @links = CrudResource.new(key, base_url, 'links', 'link', 'links', prefix, transport: shared_transport(base_url)) @balance = BalanceResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @events = EventsResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @accounts = AccountsResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @webhook_endpoints = WebhookEndpointsResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @invoices = InvoicesResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @disputes = DisputesResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @identity = IdentityResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @tax = TaxResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @shield = ShieldResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @listen = ListenResource.new(key, base_url, prefix, transport: shared_transport(base_url)) @webhooks = Webhooks.new(webhook_secret || ENV.fetch('WAJUB_WEBHOOK_SECRET', '')) end |
Instance Attribute Details
#accounts ⇒ Object (readonly)
Returns the value of attribute accounts.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def accounts @accounts end |
#balance ⇒ Object (readonly)
Returns the value of attribute balance.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def balance @balance end |
#beneficiaries ⇒ Object (readonly)
Returns the value of attribute beneficiaries.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def beneficiaries @beneficiaries end |
#customers ⇒ Object (readonly)
Returns the value of attribute customers.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def customers @customers end |
#disputes ⇒ Object (readonly)
Returns the value of attribute disputes.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def disputes @disputes end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def events @events end |
#global ⇒ Object (readonly)
Returns the value of attribute global.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def global @global end |
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def identity @identity end |
#invoices ⇒ Object (readonly)
Returns the value of attribute invoices.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def invoices @invoices end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def links @links end |
#listen ⇒ Object (readonly)
Returns the value of attribute listen.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def listen @listen end |
#payments ⇒ Object (readonly)
Returns the value of attribute payments.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def payments @payments end |
#refunds ⇒ Object (readonly)
Returns the value of attribute refunds.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def refunds @refunds end |
#shield ⇒ Object (readonly)
Returns the value of attribute shield.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def shield @shield end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def tax @tax end |
#transfers ⇒ Object (readonly)
Returns the value of attribute transfers.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def transfers @transfers end |
#webhook_endpoints ⇒ Object (readonly)
Returns the value of attribute webhook_endpoints.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def webhook_endpoints @webhook_endpoints end |
#webhooks ⇒ Object (readonly)
Returns the value of attribute webhooks.
10 11 12 |
# File 'lib/wajub/client.rb', line 10 def webhooks @webhooks end |