Class: Zendesk2::HelpCenter::Category

Inherits:
Object
  • Object
show all
Extended by:
Attributes
Includes:
Model
Defined in:
lib/zendesk2/help_center/category.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

#articles ⇒ Object



33
34
35
36
37
# File 'lib/zendesk2/help_center/category.rb', line 33

def articles
  requires :identity

  cistern.help_center_articles(category_id: identity)
end

#created_at ⇒ Time

Returns The time at which the category was created.

Returns:

  • (Time) —

    The time at which the category was created



11
# File 'lib/zendesk2/help_center/category.rb', line 11

attribute :created_at, type: :time

#description ⇒ String

Returns The description of the category.

Returns:

  • (String) —

    The description of the category



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

attribute :description, type: :string

#destroy! ⇒ Object



39
40
41
42
43
# File 'lib/zendesk2/help_center/category.rb', line 39

def destroy!
  requires :identity

  cistern.destroy_help_center_category('category' => { 'id' => identity })
end

#html_url ⇒ String

Returns The url of this category in Help Center.

Returns:

  • (String) —

    The url of this category in Help Center



15
# File 'lib/zendesk2/help_center/category.rb', line 15

attribute :html_url, type: :string

#id ⇒ Integer

Returns Automatically assigned when creating categories.

Returns:

  • (Integer) —

    Automatically assigned when creating categories



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

identity :id, type: :integer

#locale ⇒ String

Returns The locale that the category is displayed in.

Returns:

  • (String) —

    The locale that the category is displayed in



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

attribute :locale, type: :string

#name ⇒ String

Returns The name of the category.

Returns:

  • (String) —

    The name of the category



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

attribute :name, type: :string

#outdated ⇒ Boolean

Returns Whether the category is out of date.

Returns:

  • (Boolean) —

    Whether the category is out of date



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

attribute :outdated, type: :boolean

#position ⇒ Integer

Returns The position of this category relative to other categories.

Returns:

  • (Integer) —

    The position of this category relative to other categories



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

attribute :position, type: :integer

#save! ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/zendesk2/help_center/category.rb', line 57

def save!
  response = if new_record?
               requires :name, :locale

               cistern.create_help_center_category('category' => attributes)
             else
               requires :identity

               cistern.update_help_center_category('category' => attributes)
             end

  merge_attributes(response.body['category'])
end

#sections ⇒ Object



45
46
47
48
49
# File 'lib/zendesk2/help_center/category.rb', line 45

def sections
  requires :identity

  cistern.help_center_sections(category_id: identity)
end

#source_locale ⇒ String

Returns The source (default) locale of the category.

Returns:

  • (String) —

    The source (default) locale of the category



25
# File 'lib/zendesk2/help_center/category.rb', line 25

attribute :source_locale, type: :string

#translation_ids ⇒ Array

Returns The ids of all translations of this category.

Returns:

  • (Array) —

    The ids of all translations of this category



27
# File 'lib/zendesk2/help_center/category.rb', line 27

attribute :translation_ids, type: :array

#translations ⇒ Object



51
52
53
54
55
# File 'lib/zendesk2/help_center/category.rb', line 51

def translations
  requires :identity

  cistern.help_center_translations(source_id: identity, source_type: 'Category')
end

#updated_at ⇒ Time

Returns The time at which the category was last updated.

Returns:

  • (Time) —

    The time at which the category was last updated



29
# File 'lib/zendesk2/help_center/category.rb', line 29

attribute :updated_at, type: :time

#url ⇒ String

Returns The API url of this category.

Returns:

  • (String) —

    The API url of this category



31
# File 'lib/zendesk2/help_center/category.rb', line 31

attribute :url, type: :string