Class: Zendesk2::HelpCenter::Topic

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

#destroy!Object



27
28
29
30
31
# File 'lib/zendesk2/help_center/topic.rb', line 27

def destroy!
  requires :identity

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

#postsObject



47
48
49
50
51
# File 'lib/zendesk2/help_center/topic.rb', line 47

def posts
  requires :identity

  cistern.help_center_posts(topic_id: identity)
end

#save!Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/zendesk2/help_center/topic.rb', line 33

def save!
  response = if new_record?
               requires :name

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

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

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

#subscriptionsObject



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

def subscriptions
  requires :identity

  cistern.help_center_subscriptions(content_id: identity, content_type: 'topic')
end