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
21
22
23
24
25
26
27
28
|
# File 'lib/billimatic/resources/subscription.rb', line 21
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
12
13
14
15
16
17
18
19
|
# File 'lib/billimatic/resources/subscription.rb', line 12
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_url(token:) ⇒ Object
30
31
32
|
# File 'lib/billimatic/resources/subscription.rb', line 30
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
|