Class: Billimatic::Resources::Subscription
- Inherits:
-
Base
- Object
- Base
- Billimatic::Resources::Subscription
show all
- Defined in:
- lib/billimatic/resources/subscription.rb
Instance Attribute Summary
Attributes inherited from Base
#http
Instance Method Summary
collapse
Methods inherited from Base
#collection_name, #create, crud, #destroy, #initialize, #list, #list_by_organization, #parsed_body, #show_by_organization, #update
Methods included from Hooks
#notify
Instance Method Details
#cancel(token:, cancel_date: nil, cancel_reason: nil) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/billimatic/resources/subscription.rb', line 38
def cancel(token:, cancel_date: nil, cancel_reason: nil)
http.patch(
"#{resource_base_path}/#{token}/cancel",
body: { subscription: { cancel_date: cancel_date, cancel_reason: cancel_reason } }
) do |response|
respond_with_entity response
end
end
|
#change_plan(token:, new_plan_id:) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/billimatic/resources/subscription.rb', line 20
def change_plan(token:, new_plan_id:)
http.patch(
"#{resource_base_path}/#{token}/change_plan",
body: { subscription: { new_plan_id: new_plan_id } }
) do |response|
respond_with_entity response
end
end
|
#checkout(params, token:) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/billimatic/resources/subscription.rb', line 12
def checkout(params, token:)
http.post(
"#{resource_base_path}/checkout/#{token}", body: { subscription: params }
) do |response|
respond_with_entity response
end
end
|
#checkout_url(token:) ⇒ Object
47
48
49
|
# File 'lib/billimatic/resources/subscription.rb', line 47
def checkout_url(token:)
"#{Billimatic.configuration.host}#{resource_base_path}/checkout/#{token}"
end
|
#show(token:) ⇒ Object
6
7
8
9
10
|
# File 'lib/billimatic/resources/subscription.rb', line 6
def show(token:)
http.get("#{resource_base_path}/token/#{token}") do |response|
respond_with_entity(response)
end
end
|
29
30
31
32
33
34
35
36
|
# File 'lib/billimatic/resources/subscription.rb', line 29
def update_payment_information(params, token:)
http.patch(
"#{resource_base_path}/#{token}/update_payment_information",
body: { subscription: params }
) do |response|
respond_with_entity response
end
end
|