Class: WhopSDK::Resources::Shipments
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Shipments
- Defined in:
- lib/whop_sdk/resources/shipments.rb
Instance Method Summary collapse
-
#create(company_id: , payment_id: , tracking_code: , request_options: {}) ⇒ WhopSDK::Models::Shipment
Creates a new shipment.
-
#initialize(client:) ⇒ Shipments
constructor
private
A new instance of Shipments.
-
#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.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Shipment
Retrieves a shipment by ID.
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.
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`
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/whop_sdk/resources/shipments.rb', line 26 def create(params) parsed, = WhopSDK::ShipmentCreateParams.dump_request(params) @client.request( method: :post, path: "shipments", body: parsed, model: WhopSDK::Shipment, 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`
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/whop_sdk/resources/shipments.rb', line 89 def list(params = {}) parsed, = WhopSDK::ShipmentListParams.dump_request(params) @client.request( method: :get, path: "shipments", query: parsed, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::ShipmentListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Shipment
Retrieves a shipment by ID
Required permissions:
-
‘shipment:basic:read`
-
‘payment:basic:read`
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 |