Class: TerminalShop::Resources::Subscription
- Inherits:
-
Object
- Object
- TerminalShop::Resources::Subscription
- Defined in:
- lib/terminal_shop/resources/subscription.rb
Instance Method Summary collapse
-
#create(id: , address_id: , card_id: , created: , price: , product_variant_id: , quantity: , next_: nil, schedule: nil, request_options: {}) ⇒ TerminalShop::Models::SubscriptionCreateResponse
Some parameter documentations has been truncated, see Models::SubscriptionCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ TerminalShop::Models::SubscriptionDeleteResponse
Cancel a subscription for the current user.
-
#get(id, request_options: {}) ⇒ TerminalShop::Models::SubscriptionGetResponse
Get the subscription with the given ID.
-
#initialize(client:) ⇒ Subscription
constructor
private
A new instance of Subscription.
-
#list(request_options: {}) ⇒ TerminalShop::Models::SubscriptionListResponse
List the subscriptions associated with the current user.
-
#update(id, address_id: nil, card_id: nil, schedule: nil, request_options: {}) ⇒ TerminalShop::Models::SubscriptionUpdateResponse
Update card, address, or interval for an existing subscription.
Constructor Details
#initialize(client:) ⇒ Subscription
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 Subscription.
136 137 138 |
# File 'lib/terminal_shop/resources/subscription.rb', line 136 def initialize(client:) @client = client end |
Instance Method Details
#create(id: , address_id: , card_id: , created: , price: , product_variant_id: , quantity: , next_: nil, schedule: nil, request_options: {}) ⇒ TerminalShop::Models::SubscriptionCreateResponse
Some parameter documentations has been truncated, see Models::SubscriptionCreateParams for more details.
Create a subscription for the current user.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/terminal_shop/resources/subscription.rb', line 36 def create(params) parsed, = TerminalShop::SubscriptionCreateParams.dump_request(params) @client.request( method: :post, path: "subscription", body: parsed, model: TerminalShop::Models::SubscriptionCreateResponse, options: ) end |
#delete(id, request_options: {}) ⇒ TerminalShop::Models::SubscriptionDeleteResponse
Cancel a subscription for the current user.
104 105 106 107 108 109 110 111 |
# File 'lib/terminal_shop/resources/subscription.rb', line 104 def delete(id, params = {}) @client.request( method: :delete, path: ["subscription/%1$s", id], model: TerminalShop::Models::SubscriptionDeleteResponse, options: params[:request_options] ) end |
#get(id, request_options: {}) ⇒ TerminalShop::Models::SubscriptionGetResponse
Get the subscription with the given ID.
124 125 126 127 128 129 130 131 |
# File 'lib/terminal_shop/resources/subscription.rb', line 124 def get(id, params = {}) @client.request( method: :get, path: ["subscription/%1$s", id], model: TerminalShop::Models::SubscriptionGetResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ TerminalShop::Models::SubscriptionListResponse
List the subscriptions associated with the current user.
84 85 86 87 88 89 90 91 |
# File 'lib/terminal_shop/resources/subscription.rb', line 84 def list(params = {}) @client.request( method: :get, path: "subscription", model: TerminalShop::Models::SubscriptionListResponse, options: params[:request_options] ) end |
#update(id, address_id: nil, card_id: nil, schedule: nil, request_options: {}) ⇒ TerminalShop::Models::SubscriptionUpdateResponse
Update card, address, or interval for an existing subscription.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/terminal_shop/resources/subscription.rb', line 64 def update(id, params = {}) parsed, = TerminalShop::SubscriptionUpdateParams.dump_request(params) @client.request( method: :put, path: ["subscription/%1$s", id], body: parsed, model: TerminalShop::Models::SubscriptionUpdateResponse, options: ) end |