Class: Zendesk2::HelpCenter::Section
- Inherits:
-
Object
- Object
- Zendesk2::HelpCenter::Section
- Extended by:
- Attributes
- Includes:
- Model
- Defined in:
- lib/zendesk2/help_center/section.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
- #access_policy ⇒ Object
- #articles ⇒ Object
-
#category ⇒ Zendesk2::HelpCenter::Category
Category containing this section.
-
#category_id ⇒ Integer
The id of the category to which this section belongs.
-
#created_at ⇒ Time
The time at which the section was created.
-
#description ⇒ String
The description of the section.
- #destroy! ⇒ Object
-
#html_url ⇒ String
The url of this section in HC.
-
#id ⇒ Integer
Automatically assigned when creating subscriptions.
-
#locale ⇒ String
The locale in which the section is displayed.
-
#name ⇒ String
The name of the section.
-
#outdated ⇒ Boolean
Whether the section is out of date.
-
#position ⇒ Integer
The position of this section in the section list.
- #save! ⇒ Object
-
#sorting ⇒ String
The sorting of articles within this section.
-
#source_locale ⇒ String
The source (default) locale of the section.
- #subscriptions ⇒ Object
-
#translation_ids ⇒ Array
The ids of all translations of this section.
- #translations ⇒ Object
-
#updated_at ⇒ Time
The time at which the section was last updated.
-
#url ⇒ string
The API url of this section.
Methods included from Attributes
assoc_accessor, assoc_reader, assoc_writer
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#access_policy ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/zendesk2/help_center/section.rb', line 67 def access_policy requires :identity response = cistern.get_help_center_access_policy(section_id: identity).body['access_policy'] response['section_id'] = identity cistern.help_center_access_policy(response) end |
#articles ⇒ Object
61 62 63 64 65 |
# File 'lib/zendesk2/help_center/section.rb', line 61 def articles requires :identity cistern.help_center_articles(section_id: identity) end |
#category ⇒ Zendesk2::HelpCenter::Category
Returns category containing this section.
39 |
# File 'lib/zendesk2/help_center/section.rb', line 39 assoc_accessor :category, collection: :help_center_categories |
#category_id ⇒ Integer
Returns The id of the category to which this section belongs.
11 |
# File 'lib/zendesk2/help_center/section.rb', line 11 attribute :category_id, type: :integer |
#created_at ⇒ Time
Returns The time at which the section was created.
13 |
# File 'lib/zendesk2/help_center/section.rb', line 13 attribute :created_at, type: :time |
#description ⇒ String
Returns The description of the section.
15 |
# File 'lib/zendesk2/help_center/section.rb', line 15 attribute :description, type: :string |
#destroy! ⇒ Object
41 42 43 44 45 |
# File 'lib/zendesk2/help_center/section.rb', line 41 def destroy! requires :identity cistern.destroy_help_center_section('section' => { 'id' => identity }) end |
#html_url ⇒ String
Returns The url of this section in HC.
17 |
# File 'lib/zendesk2/help_center/section.rb', line 17 attribute :html_url, type: :string |
#id ⇒ Integer
Returns Automatically assigned when creating subscriptions.
8 |
# File 'lib/zendesk2/help_center/section.rb', line 8 identity :id, type: :integer |
#locale ⇒ String
Returns The locale in which the section is displayed.
19 |
# File 'lib/zendesk2/help_center/section.rb', line 19 attribute :locale, type: :string |
#name ⇒ String
Returns The name of the section.
21 |
# File 'lib/zendesk2/help_center/section.rb', line 21 attribute :name, type: :string |
#outdated ⇒ Boolean
Returns Whether the section is out of date.
23 |
# File 'lib/zendesk2/help_center/section.rb', line 23 attribute :outdated, type: :boolean |
#position ⇒ Integer
Returns The position of this section in the section list. By default the section is added to the end of the list.
26 |
# File 'lib/zendesk2/help_center/section.rb', line 26 attribute :position, type: :integer |
#save! ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/zendesk2/help_center/section.rb', line 47 def save! response = if new_record? requires :name, :locale, :category_id cistern.create_help_center_section('section' => attributes) else requires :identity cistern.update_help_center_section('section' => attributes) end merge_attributes(response.body['section']) end |
#sorting ⇒ String
Returns The sorting of articles within this section. By default it’s set to manual. See sorting below.
28 |
# File 'lib/zendesk2/help_center/section.rb', line 28 attribute :sorting, type: :string |
#source_locale ⇒ String
Returns The source (default) locale of the section.
30 |
# File 'lib/zendesk2/help_center/section.rb', line 30 attribute :source_locale, type: :string |
#subscriptions ⇒ Object
76 77 78 79 80 |
# File 'lib/zendesk2/help_center/section.rb', line 76 def subscriptions requires :identity cistern.help_center_subscriptions(content_id: identity, content_type: 'section') end |
#translation_ids ⇒ Array
Returns The ids of all translations of this section.
32 |
# File 'lib/zendesk2/help_center/section.rb', line 32 attribute :translation_ids, type: :array |
#translations ⇒ Object
82 83 84 85 86 |
# File 'lib/zendesk2/help_center/section.rb', line 82 def translations requires :identity cistern.help_center_translations(source_id: identity, source_type: 'Section') end |
#updated_at ⇒ Time
Returns The time at which the section was last updated.
34 |
# File 'lib/zendesk2/help_center/section.rb', line 34 attribute :updated_at, type: :time |
#url ⇒ string
Returns The API url of this section.
36 |
# File 'lib/zendesk2/help_center/section.rb', line 36 attribute :url, type: :string |