Class: WhopSDK::Resources::Refunds

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

Overview

Refunds

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Refunds

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 Refunds.

Parameters:



84
85
86
# File 'lib/whop_sdk/resources/refunds.rb', line 84

def initialize(client:)
  @client = client
end

Instance Method Details

#list(after: nil, before: nil, company_id: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, payment_id: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::RefundListResponse>

Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date.

Required permissions:

  • ‘payment:basic: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.

  • company_id (String, nil)

    Filter refunds to only those belonging to this company.

  • created_after (Time, nil)

    Only return refunds created after this timestamp.

  • created_before (Time, nil)

    Only return refunds created before this timestamp.

  • 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.

  • payment_id (String, nil)

    Filter refunds to only those associated with this specific payment.

  • user_id (String, nil)

    Filter refunds to only those associated with this specific user.

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

Returns:

See Also:



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/whop_sdk/resources/refunds.rb', line 68

def list(params = {})
  parsed, options = WhopSDK::RefundListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "refunds",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::RefundListResponse,
    options: options
  )
end

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

Retrieves the details of an existing refund.

Required permissions:

  • ‘payment:basic:read`

  • ‘member:email:read`

  • ‘member:basic:read`

  • ‘member:phone:read`

Parameters:

  • id (String)

    The unique identifier of the refund.

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

Returns:

See Also:



25
26
27
28
29
30
31
32
# File 'lib/whop_sdk/resources/refunds.rb', line 25

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