Class: Zendesk2::HelpCenter::Section

Inherits:
Object
  • Object
show all
Extended by:
Attributes
Includes:
Model
Defined in:
lib/zendesk2/help_center/section.rb

Instance Attribute Summary

Attributes included from Model

#errors

Instance Method Summary collapse

Methods included from Attributes

assoc_accessor, assoc_reader, assoc_writer

Methods included from Model

#destroy, #destroyed?, #missing_attributes, #save, #update!

Instance Method Details

#access_policyObject



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

#articlesObject



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

#categoryZendesk2::HelpCenter::Category

Returns category containing this section.

Returns:



39
# File 'lib/zendesk2/help_center/section.rb', line 39

assoc_accessor :category, collection: :help_center_categories

#category_idInteger

Returns The id of the category to which this section belongs.

Returns:

  • (Integer)

    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_atTime

Returns The time at which the section was created.

Returns:

  • (Time)

    The time at which the section was created



13
# File 'lib/zendesk2/help_center/section.rb', line 13

attribute :created_at, type: :time

#descriptionString

Returns The description of the section.

Returns:

  • (String)

    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_urlString

Returns The url of this section in HC.

Returns:

  • (String)

    The url of this section in HC



17
# File 'lib/zendesk2/help_center/section.rb', line 17

attribute :html_url, type: :string

#idInteger

Returns Automatically assigned when creating subscriptions.

Returns:

  • (Integer)

    Automatically assigned when creating subscriptions



8
# File 'lib/zendesk2/help_center/section.rb', line 8

identity :id, type: :integer

#localeString

Returns The locale in which the section is displayed.

Returns:

  • (String)

    The locale in which the section is displayed



19
# File 'lib/zendesk2/help_center/section.rb', line 19

attribute :locale, type: :string

#nameString

Returns The name of the section.

Returns:

  • (String)

    The name of the section



21
# File 'lib/zendesk2/help_center/section.rb', line 21

attribute :name, type: :string

#outdatedBoolean

Returns Whether the section is out of date.

Returns:

  • (Boolean)

    Whether the section is out of date



23
# File 'lib/zendesk2/help_center/section.rb', line 23

attribute :outdated, type: :boolean

#positionInteger

Returns The position of this section in the section list. By default the section is added to the end of the list.

Returns:

  • (Integer)

    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

#sortingString

Returns The sorting of articles within this section. By default it’s set to manual. See sorting below.

Returns:

  • (String)

    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_localeString

Returns The source (default) locale of the section.

Returns:

  • (String)

    The source (default) locale of the section



30
# File 'lib/zendesk2/help_center/section.rb', line 30

attribute :source_locale, type: :string

#subscriptionsObject



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_idsArray

Returns The ids of all translations of this section.

Returns:

  • (Array)

    The ids of all translations of this section



32
# File 'lib/zendesk2/help_center/section.rb', line 32

attribute :translation_ids, type: :array

#translationsObject



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_atTime

Returns The time at which the section was last updated.

Returns:

  • (Time)

    The time at which the section was last updated



34
# File 'lib/zendesk2/help_center/section.rb', line 34

attribute :updated_at, type: :time

#urlstring

Returns The API url of this section.

Returns:

  • (string)

    The API url of this section



36
# File 'lib/zendesk2/help_center/section.rb', line 36

attribute :url, type: :string