Class: Lago::Api::Resources::OrderForm
- Inherits:
-
Base
- Object
- Base
- Lago::Api::Resources::OrderForm
show all
- Defined in:
- lib/lago/api/resources/order_form.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#create, #destroy, #get, #get_all, #initialize, #update
Instance Method Details
#api_resource ⇒ Object
11
12
13
|
# File 'lib/lago/api/resources/order_form.rb', line 11
def api_resource
'order_forms'
end
|
#mark_as_signed(order_form_id, params = {}) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/lago/api/resources/order_form.rb', line 19
def mark_as_signed(order_form_id, params = {})
path = "/api/v1/order_forms/#{order_form_id}/mark_as_signed"
payload = whitelist_params(params)
response = connection.post(payload, path)[root_name]
JSON.parse(response.to_json, object_class: OpenStruct)
end
|
#root_name ⇒ Object
15
16
17
|
# File 'lib/lago/api/resources/order_form.rb', line 15
def root_name
'order_form'
end
|
#void(order_form_id) ⇒ Object
27
28
29
30
31
32
|
# File 'lib/lago/api/resources/order_form.rb', line 27
def void(order_form_id)
path = "/api/v1/order_forms/#{order_form_id}/void"
response = connection.post({}, path)[root_name]
JSON.parse(response.to_json, object_class: OpenStruct)
end
|
#whitelist_params(params) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/lago/api/resources/order_form.rb', line 34
def whitelist_params(params)
result = {
signed_document: params[:signed_document],
execution_mode: params[:execution_mode],
execute_at: params[:execute_at],
}.compact
return {} if result.empty?
{ root_name => result }
end
|