Class: Zendesk2::HelpCenter::Article

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

#author_idInteger

Returns The id of the user who wrote the article (set to the user who made the request on create by default).

Returns:

  • (Integer)

    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

#bodyString

Returns The body of the article.

Returns:

  • (String)

    The body of the article



14
# File 'lib/zendesk2/help_center/article.rb', line 14

attribute :body, type: :string

#comments_disabledBoolean

Returns True if comments are disabled; false otherwise.

Returns:

  • (Boolean)

    True if comments are disabled; false otherwise



16
# File 'lib/zendesk2/help_center/article.rb', line 16

attribute :comments_disabled, type: :boolean

#created_atTime

Returns The time at which the article was created.

Returns:

  • (Time)

    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

#draftBoolean

Returns True if the translation for the current locale is a draft; false otherwise. false by default.

Returns:

  • (Boolean)

    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_urlString

Returns The url of the article in Help Center.

Returns:

  • (String)

    The url of the article in Help Center



22
# File 'lib/zendesk2/help_center/article.rb', line 22

attribute :html_url, type: :string

#idInteger

Returns Automatically assigned when the article is created.

Returns:

  • (Integer)

    Automatically assigned when the article is created



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

identity :id, type: :integer

#label_namesString

Returns An array of label names associated with this article. By default no label names are used (only available on certain plans).

Returns:

  • (String)

    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

#localeString

Returns The locale that the article is being displayed in.

Returns:

  • (String)

    The locale that the article is being displayed in



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

attribute :locale, type: :string

#outdatedBoolean

Returns Whether the article is out of date.

Returns:

  • (Boolean)

    Whether the article is out of date



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

attribute :outdated, type: :boolean

#permission_group_idInteger

Returns The id of the permission group which defines who can edit and publish this article.

Returns:

  • (Integer)

    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

#positionInteger

Returns The position of this article in the article list. ‘0’ by default.

Returns:

  • (Integer)

    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

Returns True if this article is promoted; false otherwise. false by default.

Returns:

  • (Boolean)

    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_idInteger

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

Returns:

  • (Integer)

    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_localeString

Returns The source (default) locale of the article.

Returns:

  • (String)

    The source (default) locale of the article



37
# File 'lib/zendesk2/help_center/article.rb', line 37

attribute :source_locale, type: :string

#subscriptionsObject



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

#titleString

Returns The title of the article.

Returns:

  • (String)

    The title of the article



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

attribute :title, type: :string

#translationsObject



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_atTime

Returns The time at which the article was last updated.

Returns:

  • (Time)

    The time at which the article was last updated



41
# File 'lib/zendesk2/help_center/article.rb', line 41

attribute :updated_at, type: :time

#urlString

Returns The API url of the article.

Returns:

  • (String)

    The API url of the article



43
# File 'lib/zendesk2/help_center/article.rb', line 43

attribute :url, type: :string

#user_segment_idInteger

Returns The id of the user segment which defines who can see this article.

Returns:

  • (Integer)

    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_countInteger

Returns The number of votes cast on this article.

Returns:

  • (Integer)

    The number of votes cast on this article



45
# File 'lib/zendesk2/help_center/article.rb', line 45

attribute :vote_count, type: :integer

#vote_sumInteger

Returns The total sum of votes on this article.

Returns:

  • (Integer)

    The total sum of votes on this article



47
# File 'lib/zendesk2/help_center/article.rb', line 47

attribute :vote_sum, type: :integer