Class: Zendesk2::HelpCenter::Subscription
- Inherits:
-
Object
- Object
- Zendesk2::HelpCenter::Subscription
- Extended by:
- Attributes
- Includes:
- Model
- Defined in:
- lib/zendesk2/help_center/subscription.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#content_id ⇒ Integer
The id of the subscribed item.
-
#content_type ⇒ String
The type of the subscribed item.
-
#created_at ⇒ Time
The time at which the subscription was created.
- #destroy! ⇒ Object
-
#id ⇒ Integer
Automatically assigned when the subscription is created.
-
#include_comments ⇒ Boolean
Subscribe also to article comments.
-
#locale ⇒ String
The locale of the subscribed item.
- #save! ⇒ Object
-
#updated_at ⇒ Time
The time at which the subscription was last updated.
-
#url ⇒ String
The API url of the subscription.
-
#user_id ⇒ Integer
The id of the user who has this subscription.
Methods included from Attributes
assoc_accessor, assoc_reader, assoc_writer
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#content_id ⇒ Integer
Returns The id of the subscribed item.
15 |
# File 'lib/zendesk2/help_center/subscription.rb', line 15 attribute :content_id, type: :integer |
#content_type ⇒ String
Returns The type of the subscribed item.
17 |
# File 'lib/zendesk2/help_center/subscription.rb', line 17 attribute :content_type |
#created_at ⇒ Time
Returns The time at which the subscription was created.
23 |
# File 'lib/zendesk2/help_center/subscription.rb', line 23 attribute :created_at, type: :time |
#destroy! ⇒ Object
27 28 29 30 31 |
# File 'lib/zendesk2/help_center/subscription.rb', line 27 def destroy! requires :identity cistern.destroy_help_center_subscription('subscription' => attributes) end |
#id ⇒ Integer
Returns Automatically assigned when the subscription is created.
8 |
# File 'lib/zendesk2/help_center/subscription.rb', line 8 identity :id, type: :integer |
#include_comments ⇒ Boolean
Returns Subscribe also to article comments. Only for section subscriptions.
21 |
# File 'lib/zendesk2/help_center/subscription.rb', line 21 attribute :include_comments, type: :boolean |
#locale ⇒ String
Returns The locale of the subscribed item.
19 |
# File 'lib/zendesk2/help_center/subscription.rb', line 19 attribute :locale |
#save! ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/zendesk2/help_center/subscription.rb', line 33 def save! response = if new_record? requires :content_id, :content_type cistern.create_help_center_subscription('subscription' => attributes) else requires :identity cistern.update_help_center_subscription('subscription' => attributes) end merge_attributes(response.body['subscription']) end |
#updated_at ⇒ Time
Returns The time at which the subscription was last updated.
25 |
# File 'lib/zendesk2/help_center/subscription.rb', line 25 attribute :updated_at, type: :time |
#url ⇒ String
Returns The API url of the subscription.
11 |
# File 'lib/zendesk2/help_center/subscription.rb', line 11 attribute :url |
#user_id ⇒ Integer
Returns The id of the user who has this subscription.
13 |
# File 'lib/zendesk2/help_center/subscription.rb', line 13 attribute :user_id, type: :integer |