Class: WhopSDK::Resources::Transfers

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/transfers.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Transfers

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Transfers.

Parameters:



118
119
120
# File 'lib/whop_sdk/resources/transfers.rb', line 118

def initialize(client:)
  @client = client
end

Instance Method Details

#create(amount: , currency: , destination_id: , origin_id: , idempotence_key: nil, metadata: nil, notes: nil, request_options: {}) ⇒ WhopSDK::Models::Transfer

Some parameter documentations has been truncated, see Models::TransferCreateParams for more details.

Creates a new transfer between ledger accounts

Required permissions:

  • ‘payout:transfer_funds`

Parameters:

  • amount (Float)

    The amount to withdraw

  • currency (Symbol, WhopSDK::Models::Currency)

    The currency that is being withdrawn.

  • destination_id (String)

    The ID of the destination account which will receive the funds (either a User ID

  • origin_id (String)

    The ID of the origin account which will send the funds (either a User ID, Compan

  • idempotence_key (String, nil)

    A unique key to ensure idempotence. Use a UUID or similar.

  • metadata (Hash{Symbol=>Object}, nil)

    A hash of metadata to attach to the transfer.

  • notes (String, nil)

    Notes for the transfer. Maximum of 50 characters.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
# File 'lib/whop_sdk/resources/transfers.rb', line 36

def create(params)
  parsed, options = WhopSDK::TransferCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "transfers",
    body: parsed,
    model: WhopSDK::Transfer,
    options: options
  )
end

#list(after: nil, before: nil, destination_id: nil, direction: nil, first: nil, last: nil, order: nil, origin_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::TransferListResponse>

Some parameter documentations has been truncated, see Models::TransferListParams for more details.

Lists transfers

Required permissions:

  • ‘payout:transfer:read`

Parameters:

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • destination_id (String, nil)

    Filter transfers to only those that were sent to this destination account. (user

  • direction (Symbol, WhopSDK::Models::Direction, nil)

    The direction of the sort.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • order (Symbol, WhopSDK::Models::TransferListParams::Order, nil)

    Which columns can be used to sort.

  • origin_id (String, nil)

    Filter transfers to only those that were sent from this origin account. (user_xx

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/whop_sdk/resources/transfers.rb', line 103

def list(params = {})
  parsed, options = WhopSDK::TransferListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "transfers",
    query: parsed,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::TransferListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Transfer

Retrieves a transfer by ID

Required permissions:

  • ‘payout:transfer:read`

Parameters:

Returns:

See Also:



62
63
64
65
66
67
68
69
# File 'lib/whop_sdk/resources/transfers.rb', line 62

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["transfers/%1$s", id],
    model: WhopSDK::Transfer,
    options: params[:request_options]
  )
end