Class: ChartMogul::Subscription
- Inherits:
-
APIResource
- Object
- Object
- APIResource
- ChartMogul::Subscription
- Includes:
- API::Actions::Custom
- Defined in:
- lib/chartmogul/subscription.rb
Constant Summary
Constants inherited from APIResource
APIResource::BACKOFF_FACTOR, APIResource::INTERVAL, APIResource::INTERVAL_RANDOMNESS, APIResource::MAX_INTERVAL, APIResource::RETRY_EXCEPTIONS, APIResource::RETRY_STATUSES, APIResource::THREAD_CONNECTION_KEY
Class Method Summary collapse
Instance Method Summary collapse
- #cancel(cancelled_at) ⇒ Object
- #connect(customer_uuid, subscriptions) ⇒ Object
- #update_cancellation_dates(cancellation_dates_array) ⇒ Object
Methods included from API::Actions::Custom
#custom!, #custom_without_assign!, included
Methods inherited from APIResource
connection, handle_other_error, handle_request_error, handling_errors, immutable_keys, set_immutable_keys, set_resource_name, set_resource_path, set_resource_root_key
Methods inherited from Object
#allowed_for_write?, #assign_all_attributes, #assign_writeable_attributes, attributes, define_private_writer, define_reader, define_writer, #initialize, #instance_attributes, new_from_json, readonly_attr, #serialize_for_write, #serialized_value_for_attr, writeable_attr, writeable_attributes
Constructor Details
This class inherits a constructor from ChartMogul::Object
Class Method Details
.all(customer_uuid, options = {}) ⇒ Object
33 34 35 |
# File 'lib/chartmogul/subscription.rb', line 33 def self.all(customer_uuid, = {}) Subscriptions.all(customer_uuid, ) end |
Instance Method Details
#cancel(cancelled_at) ⇒ Object
24 25 26 |
# File 'lib/chartmogul/subscription.rb', line 24 def cancel(cancelled_at) custom!(:patch, "/v1/import/subscriptions/#{uuid}", cancelled_at: cancelled_at) end |
#connect(customer_uuid, subscriptions) ⇒ Object
28 29 30 31 |
# File 'lib/chartmogul/subscription.rb', line 28 def connect(customer_uuid, subscriptions) subscriptions.unshift(self) custom!(:post, "/v1/customers/#{customer_uuid}/connect_subscriptions", subscriptions: subscriptions.map(&:serialize_for_write)) end |
#update_cancellation_dates(cancellation_dates_array) ⇒ Object
19 20 21 22 |
# File 'lib/chartmogul/subscription.rb', line 19 def update_cancellation_dates(cancellation_dates_array) cancellation_dates = parse_dates(cancellation_dates_array) custom!(:patch, "/v1/import/subscriptions/#{uuid}", cancellation_dates: cancellation_dates) end |