Class: Pennylane::CustomerInvoice
Class Method Summary
collapse
Instance Method Summary
collapse
#[], client, execute_resource_request, #method_missing, normalize_filters, object_name_plural, request_pennylane_object, #respond_to_missing?
Methods inherited from Object
build_from, descendants, #initialize_from_response, objects, protected_fields
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Pennylane::Resources::Base
Class Method Details
.create(params, opts = {}) ⇒ Object
19
20
21
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 19
def create params, opts = {}
request_pennylane_object(method: :post, path: "/customer_invoices", params: { body: params }, opts: opts, with: { invoice: 'customer_invoice' })
end
|
.import(params, opts = {}) ⇒ Object
23
24
25
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 23
def import params, opts={}
request_pennylane_object(method: :post, path: "/customer_invoices/import", params: { body: params }, opts: opts, with: { invoice: 'customer_invoice' })
end
|
.links(*quote_group_uuids, opts: {}) ⇒ Object
27
28
29
30
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 27
def links(*quote_group_uuids, opts: {})
request_pennylane_object(method: :post, path: "/customer_invoices/links", params: { body: { quote_group_uuids: quote_group_uuids } },
opts: {})
end
|
.list(filters = {}, opts = {}) ⇒ Object
10
11
12
13
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 10
def list filters = {}, opts = {}
normalize_filters(filters)
request_pennylane_object(method: :get, path: "/customer_invoices", params: { query: filters }, opts: opts, with: { invoice: 'customer_invoice' })
end
|
.object_name ⇒ Object
6
7
8
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 6
def object_name
'customer_invoice'
end
|
.retrieve(id, opts = {}) ⇒ Object
15
16
17
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 15
def retrieve id, opts = {}
request_pennylane_object(method: :get, path: "/customer_invoices/#{id}", params: {}, opts: opts, with: { invoice: 'customer_invoice' })
end
|
Instance Method Details
55
56
57
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 55
def finalize
request_and_retrieve(method: :put, path: "/customer_invoices/#{id}", action: 'finalize')
end
|
doesnt have a ‘source_id` so we override it
39
40
41
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 39
def id
object.id
end
|
#mark_as_paid ⇒ Object
59
60
61
62
63
64
65
66
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 59
def mark_as_paid
resp, opts = self.class.request_pennylane_object(method: :put,
path: "/customer_invoices/#{id}/mark_as_paid",
params: {},
opts: {}, with: { invoice: 'customer_invoice' })
@values = resp.instance_variable_get :@values
self
end
|
since object name is different from the class name, we need to override the object_name method
34
35
36
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 34
def object
@values[:invoice]
end
|
#send_by_email ⇒ Object
68
69
70
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 68
def send_by_email
request_and_retrieve(method: :post, path: "/customer_invoices/#{id}", action: 'send_by_email')
end
|
#update(attributes) ⇒ Object
since object name is different from the class name, we need to override the method
46
47
48
49
50
51
52
53
|
# File 'lib/pennylane/resources/customer_invoice.rb', line 46
def update(attributes)
resp, opts = self.class.request_pennylane_object(method: :put,
path: "/customer_invoices/#{id}",
params: { body: { 'invoice' => attributes } },
opts: {}, with: { invoice: 'customer_invoice' })
@values = resp.instance_variable_get :@values
self
end
|