Class: WhopSDK::Resources::Shipments

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Shipments

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

Parameters:



104
105
106
# File 'lib/whop_sdk/resources/shipments.rb', line 104

def initialize(client:)
  @client = client
end

Instance Method Details

#create(company_id: , payment_id: , tracking_code: , request_options: {}) ⇒ WhopSDK::Models::Shipment

Creates a new shipment

Required permissions:

  • ‘shipment:create`

  • ‘payment:basic:read`

Parameters:

  • company_id (String)

    The ID of the company to create the shipment for

  • payment_id (String)

    The ID of the payment to create the shipment for

  • tracking_code (String)

    The tracking code for the shipment

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

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
# File 'lib/whop_sdk/resources/shipments.rb', line 26

def create(params)
  parsed, options = WhopSDK::ShipmentCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "shipments",
    body: parsed,
    model: WhopSDK::Shipment,
    options: options
  )
end

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

Lists shipments for a payment

Required permissions:

  • ‘shipment:basic:read`

  • ‘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)

    The ID of the company

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

    The ID of the payment

  • user_id (String, nil)

    The ID of the user

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

Returns:

See Also:



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/whop_sdk/resources/shipments.rb', line 89

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

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

Retrieves a shipment by ID

Required permissions:

  • ‘shipment:basic:read`

  • ‘payment:basic:read`

Parameters:

Returns:

See Also:



52
53
54
55
56
57
58
59
# File 'lib/whop_sdk/resources/shipments.rb', line 52

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