Class: Zendesk2::HelpCenter::Article
- Inherits:
-
Object
- Object
- Zendesk2::HelpCenter::Article
- Extended by:
- Attributes
- Includes:
- Model
- Defined in:
- lib/zendesk2/help_center/article.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#author_id ⇒ Integer
The id of the user who wrote the article (set to the user who made the request on create by default).
-
#body ⇒ String
The body of the article.
-
#comments_disabled ⇒ Boolean
True if comments are disabled; false otherwise.
-
#created_at ⇒ Time
The time at which the article was created.
- #destroy! ⇒ Object
-
#draft ⇒ Boolean
True if the translation for the current locale is a draft; false otherwise.
-
#html_url ⇒ String
The url of the article in Help Center.
-
#id ⇒ Integer
Automatically assigned when the article is created.
-
#label_names ⇒ String
An array of label names associated with this article.
-
#locale ⇒ String
The locale that the article is being displayed in.
-
#outdated ⇒ Boolean
Whether the article is out of date.
-
#permission_group_id ⇒ Integer
The id of the permission group which defines who can edit and publish this article.
-
#position ⇒ Integer
The position of this article in the article list.
-
#promoted ⇒ Boolean
True if this article is promoted; false otherwise.
- #save! ⇒ Object
-
#section_id ⇒ Integer
The id of the section to which this article belongs.
-
#source_locale ⇒ String
The source (default) locale of the article.
- #subscriptions ⇒ Object
-
#title ⇒ String
The title of the article.
- #translations ⇒ Object
-
#updated_at ⇒ Time
The time at which the article was last updated.
-
#url ⇒ String
The API url of the article.
-
#user_segment_id ⇒ Integer
The id of the user segment which defines who can see this article.
-
#vote_count ⇒ Integer
The number of votes cast on this article.
-
#vote_sum ⇒ Integer
The total sum of votes on this article.
Methods included from Attributes
assoc_accessor, assoc_reader, assoc_writer
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#author_id ⇒ Integer
Returns The id of the user who wrote the article (set to the user who made the request on create by default).
12 |
# File 'lib/zendesk2/help_center/article.rb', line 12 attribute :author_id, type: :integer |
#body ⇒ String
Returns The body of the article.
14 |
# File 'lib/zendesk2/help_center/article.rb', line 14 attribute :body, type: :string |
#comments_disabled ⇒ Boolean
Returns True if comments are disabled; false otherwise.
16 |
# File 'lib/zendesk2/help_center/article.rb', line 16 attribute :comments_disabled, type: :boolean |
#created_at ⇒ Time
Returns The time at which the article was created.
18 |
# File 'lib/zendesk2/help_center/article.rb', line 18 attribute :created_at, type: :time |
#destroy! ⇒ Object
81 82 83 84 85 |
# File 'lib/zendesk2/help_center/article.rb', line 81 def destroy! requires :identity cistern.destroy_help_center_article('article' => { 'id' => identity }) end |
#draft ⇒ Boolean
Returns True if the translation for the current locale is a draft; false otherwise. false by default.
20 |
# File 'lib/zendesk2/help_center/article.rb', line 20 attribute :draft, type: :boolean |
#html_url ⇒ String
Returns The url of the article in Help Center.
22 |
# File 'lib/zendesk2/help_center/article.rb', line 22 attribute :html_url, type: :string |
#id ⇒ Integer
Returns Automatically assigned when the article is created.
8 |
# File 'lib/zendesk2/help_center/article.rb', line 8 identity :id, type: :integer |
#label_names ⇒ String
Returns An array of label names associated with this article. By default no label names are used (only available on certain plans).
25 |
# File 'lib/zendesk2/help_center/article.rb', line 25 attribute :label_names, type: :string |
#locale ⇒ String
Returns The locale that the article is being displayed in.
27 |
# File 'lib/zendesk2/help_center/article.rb', line 27 attribute :locale, type: :string |
#outdated ⇒ Boolean
Returns Whether the article is out of date.
29 |
# File 'lib/zendesk2/help_center/article.rb', line 29 attribute :outdated, type: :boolean |
#permission_group_id ⇒ Integer
Returns The id of the permission group which defines who can edit and publish this article.
51 |
# File 'lib/zendesk2/help_center/article.rb', line 51 attribute :permission_group_id, type: :integer |
#position ⇒ Integer
Returns The position of this article in the article list. ‘0’ by default.
31 |
# File 'lib/zendesk2/help_center/article.rb', line 31 attribute :position, type: :integer |
#promoted ⇒ Boolean
Returns True if this article is promoted; false otherwise. false by default.
33 |
# File 'lib/zendesk2/help_center/article.rb', line 33 attribute :promoted, type: :boolean |
#save! ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/zendesk2/help_center/article.rb', line 67 def save! response = if new_record? requires :title, :locale, :section_id, :permission_group_id cistern.create_help_center_article('article' => attributes) else requires :identity cistern.update_help_center_article('article' => attributes) end merge_attributes(response.body['article']) end |
#section_id ⇒ Integer
Returns The id of the section to which this article belongs.
35 |
# File 'lib/zendesk2/help_center/article.rb', line 35 attribute :section_id, type: :integer |
#source_locale ⇒ String
Returns The source (default) locale of the article.
37 |
# File 'lib/zendesk2/help_center/article.rb', line 37 attribute :source_locale, type: :string |
#subscriptions ⇒ Object
61 62 63 64 65 |
# File 'lib/zendesk2/help_center/article.rb', line 61 def subscriptions requires :identity cistern.help_center_subscriptions(content_id: identity, content_type: 'article') end |
#title ⇒ String
Returns The title of the article.
39 |
# File 'lib/zendesk2/help_center/article.rb', line 39 attribute :title, type: :string |
#translations ⇒ Object
55 56 57 58 59 |
# File 'lib/zendesk2/help_center/article.rb', line 55 def translations requires :identity cistern.help_center_translations(source_id: identity, source_type: 'Article') end |
#updated_at ⇒ Time
Returns The time at which the article was last updated.
41 |
# File 'lib/zendesk2/help_center/article.rb', line 41 attribute :updated_at, type: :time |
#url ⇒ String
Returns The API url of the article.
43 |
# File 'lib/zendesk2/help_center/article.rb', line 43 attribute :url, type: :string |
#user_segment_id ⇒ Integer
Returns The id of the user segment which defines who can see this article.
49 |
# File 'lib/zendesk2/help_center/article.rb', line 49 attribute :user_segment_id, type: :integer, default: nil |
#vote_count ⇒ Integer
Returns The number of votes cast on this article.
45 |
# File 'lib/zendesk2/help_center/article.rb', line 45 attribute :vote_count, type: :integer |
#vote_sum ⇒ Integer
Returns The total sum of votes on this article.
47 |
# File 'lib/zendesk2/help_center/article.rb', line 47 attribute :vote_sum, type: :integer |