Class: Zendesk2::Topic

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

#answeredboolean

Returns Set to true if the topic is a question and it has been marked as answered.

Returns:

  • (boolean)

    Set to true if the topic is a question and it has been marked as answered.



31
# File 'lib/zendesk2/topic.rb', line 31

attribute :answered, type: :boolean

#attachmentsarray

Returns The attachments on this comment as Attachment objects.

Returns:

  • (array)

    The attachments on this comment as Attachment objects



46
# File 'lib/zendesk2/topic.rb', line 46

attribute :attachments, type: :array

#bodystring

Returns The unescaped body of the topic.

Returns:

  • (string)

    The unescaped body of the topic



15
# File 'lib/zendesk2/topic.rb', line 15

attribute :body, type: :string

#commentsObject



74
75
76
# File 'lib/zendesk2/topic.rb', line 74

def comments
  topic_comments(topic_id: topic_id)
end

#comments_countinteger

Returns The number of comments on this topic.

Returns:

  • (integer)

    The number of comments on this topic



33
# File 'lib/zendesk2/topic.rb', line 33

attribute :comments_count, type: :integer

#created_atdate

Returns The time the topic was created.

Returns:

  • (date)

    The time the topic was created



42
# File 'lib/zendesk2/topic.rb', line 42

attribute :created_at, type: :date

#destroy!Object



54
55
56
57
58
# File 'lib/zendesk2/topic.rb', line 54

def destroy!
  requires :identity

  cistern.destroy_topic('topic' => { 'id' => identity })
end

#forum_idinteger

Returns Forum that the topic is associated to.

Returns:

  • (integer)

    Forum that the topic is associated to



23
# File 'lib/zendesk2/topic.rb', line 23

attribute :forum_id, type: :integer

#highlightedboolean

Returns Set to true to highlight a topic within its forum.

Returns:

  • (boolean)

    Set to true to highlight a topic within its forum



29
# File 'lib/zendesk2/topic.rb', line 29

attribute :highlighted, type: :boolean

#idinteger

Returns Automatically assigned upon creation.

Returns:

  • (integer)

    Automatically assigned upon creation



8
# File 'lib/zendesk2/topic.rb', line 8

identity :id, type: :integer

#lockedboolean

Returns Whether comments are allowed.

Returns:

  • (boolean)

    Whether comments are allowed



25
# File 'lib/zendesk2/topic.rb', line 25

attribute :locked, type: :boolean

#pinnedboolean

Returns If the topic is marked as pinned and hence eligible to show up on the front page.

Returns:

  • (boolean)

    If the topic is marked as pinned and hence eligible to show up on the front page



27
# File 'lib/zendesk2/topic.rb', line 27

attribute :pinned, type: :boolean

#positioninteger

Returns The position of this topic relative to other topics in the same forum when the topics are ordered manually.

Returns:

  • (integer)

    The position of this topic relative to other topics in the same forum when the topics are ordered manually



38
# File 'lib/zendesk2/topic.rb', line 38

attribute :position, type: :integer

#save!Object



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/zendesk2/topic.rb', line 60

def save!
  data = if new_record?
           requires :title, :body

           cistern.create_topic('topic' => attributes)
         else
           requires :identity

           cistern.update_topic('topic' => attributes)
         end

  merge_attributes(data.body['topic'])
end

#search_phrasesarray

Returns The search phrases set on the topic.

Returns:

  • (array)

    The search phrases set on the topic



35
# File 'lib/zendesk2/topic.rb', line 35

attribute :search_phrases, type: :array

#submitter_idinteger

Returns The id of the user who submitted the topic.

Returns:

  • (integer)

    The id of the user who submitted the topic



19
# File 'lib/zendesk2/topic.rb', line 19

attribute :submitter_id, type: :integer

#tagsarray

Returns The tags set on the topic.

Returns:

  • (array)

    The tags set on the topic



40
# File 'lib/zendesk2/topic.rb', line 40

attribute :tags, type: :array

#titlestring

Returns The title of the topic.

Returns:

  • (string)

    The title of the topic



13
# File 'lib/zendesk2/topic.rb', line 13

attribute :title, type: :string

#topic_typestring

Returns The type of topic. Either “articles”, “ideas” or “questions”.

Returns:

  • (string)

    The type of topic. Either “articles”, “ideas” or “questions”



17
# File 'lib/zendesk2/topic.rb', line 17

attribute :topic_type, type: :string

#updated_atdate

Returns The time of the last update of the topic.

Returns:

  • (date)

    The time of the last update of the topic



44
# File 'lib/zendesk2/topic.rb', line 44

attribute :updated_at, type: :date

#updater_idinteger

Returns The id of the person to last update the topic.

Returns:

  • (integer)

    The id of the person to last update the topic



21
# File 'lib/zendesk2/topic.rb', line 21

attribute :updater_id, type: :integer

#uploadsarray

Returns List of upload tokens for adding attachments.

Returns:

  • (array)

    List of upload tokens for adding attachments



48
# File 'lib/zendesk2/topic.rb', line 48

attribute :uploads, type: :array

#urlstring

Returns The API url of this topic.

Returns:

  • (string)

    The API url of this topic



11
# File 'lib/zendesk2/topic.rb', line 11

attribute :url, type: :string