Class: WhopSDK::Resources::Invoices
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Invoices
- Defined in:
- lib/whop_sdk/resources/invoices.rb
Instance Method Summary collapse
-
#create(collection_method: , company_id: , due_date: , plan: , charge_buyer_fee: nil, customer_name: nil, email_address: nil, member_id: nil, payment_token_id: nil, product: nil, product_id: nil, request_options: {}) ⇒ WhopSDK::Models::InvoiceCreateResponse
Some parameter documentations has been truncated, see Models::InvoiceCreateParams for more details.
-
#initialize(client:) ⇒ Invoices
constructor
private
A new instance of Invoices.
-
#list(company_id: , after: nil, before: nil, direction: nil, filters: nil, first: nil, last: nil, order: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::InvoiceListItem>
Lists invoices.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Invoice
Retrieves an invoice by ID or token.
-
#void(id, request_options: {}) ⇒ Boolean
Void an invoice.
Constructor Details
#initialize(client:) ⇒ Invoices
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 Invoices.
148 149 150 |
# File 'lib/whop_sdk/resources/invoices.rb', line 148 def initialize(client:) @client = client end |
Instance Method Details
#create(collection_method: , company_id: , due_date: , plan: , charge_buyer_fee: nil, customer_name: nil, email_address: nil, member_id: nil, payment_token_id: nil, product: nil, product_id: nil, request_options: {}) ⇒ WhopSDK::Models::InvoiceCreateResponse
Some parameter documentations has been truncated, see Models::InvoiceCreateParams for more details.
Creates an invoice
Required permissions:
-
‘invoice:create`
-
‘plan:basic:read`
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/whop_sdk/resources/invoices.rb', line 45 def create(params) parsed, = WhopSDK::InvoiceCreateParams.dump_request(params) @client.request( method: :post, path: "invoices", body: parsed, model: WhopSDK::Models::InvoiceCreateResponse, options: ) end |
#list(company_id: , after: nil, before: nil, direction: nil, filters: nil, first: nil, last: nil, order: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::InvoiceListItem>
Lists invoices
Required permissions:
-
‘invoice:basic:read`
-
‘plan:basic:read`
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/whop_sdk/resources/invoices.rb', line 110 def list(params) parsed, = WhopSDK::InvoiceListParams.dump_request(params) @client.request( method: :get, path: "invoices", query: parsed, page: WhopSDK::Internal::CursorPage, model: WhopSDK::InvoiceListItem, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Invoice
Retrieves an invoice by ID or token
Required permissions:
-
‘invoice:basic:read`
-
‘plan:basic:read`
71 72 73 74 75 76 77 78 |
# File 'lib/whop_sdk/resources/invoices.rb', line 71 def retrieve(id, params = {}) @client.request( method: :get, path: ["invoices/%1$s", id], model: WhopSDK::Invoice, options: params[:request_options] ) end |
#void(id, request_options: {}) ⇒ Boolean
Void an invoice
Required permissions:
-
‘invoice:update`
136 137 138 139 140 141 142 143 |
# File 'lib/whop_sdk/resources/invoices.rb', line 136 def void(id, params = {}) @client.request( method: :post, path: ["invoices/%1$s/void", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |