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: , member_id: , plan: , product: , email_address: , product_id: , charge_buyer_fee: nil, customer_name: nil, payment_method_id: nil, payment_token_id: nil, request_options: {}) ⇒ WhopSDK::Models::Invoice
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, collection_methods: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, product_ids: nil, statuses: 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.
160 161 162 |
# File 'lib/whop_sdk/resources/invoices.rb', line 160 def initialize(client:) @client = client end |
Instance Method Details
#create(collection_method: , company_id: , due_date: , member_id: , plan: , product: , email_address: , product_id: , charge_buyer_fee: nil, customer_name: nil, payment_method_id: nil, payment_token_id: nil, request_options: {}) ⇒ WhopSDK::Models::Invoice
Some parameter documentations has been truncated, see Models::InvoiceCreateParams for more details.
Creates an invoice
Required permissions:
-
‘invoice:create`
-
‘plan:basic:read`
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/whop_sdk/resources/invoices.rb', line 47 def create(params) parsed, = WhopSDK::InvoiceCreateParams.dump_request(params) @client.request( method: :post, path: "invoices", body: parsed, model: WhopSDK::Invoice, options: ) end |
#list(company_id: , after: nil, before: nil, collection_methods: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, order: nil, product_ids: nil, statuses: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::InvoiceListItem>
Lists invoices
Required permissions:
-
‘invoice:basic:read`
-
‘plan:basic:read`
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/whop_sdk/resources/invoices.rb', line 121 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`
74 75 76 77 78 79 80 81 |
# File 'lib/whop_sdk/resources/invoices.rb', line 74 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`
148 149 150 151 152 153 154 155 |
# File 'lib/whop_sdk/resources/invoices.rb', line 148 def void(id, params = {}) @client.request( method: :post, path: ["invoices/%1$s/void", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |