Class: Pipedrive::Subscription
- Defined in:
- lib/pipedrive/resources/subscription.rb
Class Method Summary collapse
-
.create_recurring(params) ⇒ Object
POST /subscriptions/recurring Adds a recurring subscription.
-
.find_by_deal(id) ⇒ Object
GET /subscriptions/find/:id Returns details of a recurring subscription by the deal ID.
Instance Method Summary collapse
-
#cancel_recurring(params = {}) ⇒ Object
PUT /subscriptions/recurring/:id/cancel Cancels a recurring subscription.
-
#update_recurring(params = {}) ⇒ Object
PUT /subscriptions/recurring/:id Updates a recurring subscription.
Methods inherited from Resource
all, class_name, fields_dicc, has_many, #initialize, #initialize_from_data, inverted_fields_dicc, #no_content?, #refresh, #resource_url, resource_url, retrieve, search, #search_for_fields, search_for_fields, #update_attributes, update_method, #update_method
Methods included from APIOperations::Create
Methods included from APIOperations::Delete
Methods included from APIOperations::Update
Methods included from APIOperations::Request
Constructor Details
This class inherits a constructor from Pipedrive::Resource
Class Method Details
.create_recurring(params) ⇒ Object
POST /subscriptions/recurring Adds a recurring subscription
7 8 9 10 11 12 13 14 |
# File 'lib/pipedrive/resources/subscription.rb', line 7 def self.create_recurring(params) response = request( :post, "#{resource_url}/recurring", params ) Subscription.new(response.dig(:data)) end |
.find_by_deal(id) ⇒ Object
GET /subscriptions/find/:id Returns details of a recurring subscription by the deal ID
18 19 20 21 |
# File 'lib/pipedrive/resources/subscription.rb', line 18 def self.find_by_deal(id) response = request(:get,"#{resource_url}/find/#{id}") new(response.dig(:data)) end |
Instance Method Details
#cancel_recurring(params = {}) ⇒ Object
PUT /subscriptions/recurring/:id/cancel Cancels a recurring subscription
36 37 38 39 40 41 42 43 |
# File 'lib/pipedrive/resources/subscription.rb', line 36 def cancel_recurring(params = {}) response = request( :put, "#{self.class.resource_url}/recurring/#{id}/cancel", params ) Subscription.new(response.dig(:data)) end |
#update_recurring(params = {}) ⇒ Object
PUT /subscriptions/recurring/:id Updates a recurring subscription
25 26 27 28 29 30 31 32 |
# File 'lib/pipedrive/resources/subscription.rb', line 25 def update_recurring(params = {}) response = request( :put, "#{self.class.resource_url}/recurring/#{id}", params ) Subscription.new(response.dig(:data)) end |