Class: AbacatePay::Clients::PayoutClient

Inherits:
Client
  • Object
show all
Defined in:
lib/abacate_pay/clients/payout_client.rb

Overview

Client for payouts (withdrawals) in the AbacatePay API.

Payouts move settled balance out of the store account.

Constant Summary collapse

URI =
"payouts"

Constants inherited from Client

Client::RETRIABLE_EXCEPTIONS, Client::RETRIABLE_METHODS, Client::RETRIABLE_STATUSES

Instance Method Summary collapse

Methods inherited from Client

#auto_paging_each, #each_page

Constructor Details

#initialize(client = nil) ⇒ PayoutClient

Returns a new instance of PayoutClient.



11
12
13
# File 'lib/abacate_pay/clients/payout_client.rb', line 11

def initialize(client = nil)
  super(URI, client)
end

Instance Method Details

#create(data) ⇒ Resources::Payouts

Parameters:

Returns:



31
32
33
34
35
36
37
38
# File 'lib/abacate_pay/clients/payout_client.rb', line 31

def create(data)
  response = request("POST", "create", json: {
                       amount: data.amount,
                       externalId: data.external_id,
                       description: data.description
                     })
  Resources::Payouts.new(response)
end

#get(id) ⇒ Resources::Payouts

Parameters:

  • id (String)

    Payout ID

Returns:



24
25
26
27
# File 'lib/abacate_pay/clients/payout_client.rb', line 24

def get(id)
  response = request("GET", "get", params: { id: id })
  Resources::Payouts.new(response)
end

#list(**params) ⇒ Array<Resources::Payouts>

Parameters:

  • params (Hash)

    Optional pagination params (after, before, limit)

Returns:



17
18
19
20
# File 'lib/abacate_pay/clients/payout_client.rb', line 17

def list(**params)
  response = request("GET", "list", params: params.empty? ? nil : params)
  build_list(response, Resources::Payouts)
end