Class: Zendesk2::HelpCenter::Post
- Inherits:
-
Object
- Object
- Zendesk2::HelpCenter::Post
show all
- Extended by:
- Attributes
- Includes:
- Model
- Defined in:
- lib/zendesk2/help_center/post.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 ⇒ Object
63
64
65
|
# File 'lib/zendesk2/help_center/post.rb', line 63
def author
cistern.users.get!(author_id) if author_id
end
|
#destroy! ⇒ Object
43
44
45
46
47
|
# File 'lib/zendesk2/help_center/post.rb', line 43
def destroy!
requires :identity
cistern.destroy_help_center_post('post' => { 'id' => identity })
end
|
#save! ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/zendesk2/help_center/post.rb', line 49
def save!
response = if new_record?
requires :title, :details, :topic_id
cistern.create_help_center_post('post' => attributes)
else
requires :identity
cistern.update_help_center_post('post' => attributes)
end
merge_attributes(response.body['post'])
end
|
#subscriptions ⇒ Object
73
74
75
76
77
|
# File 'lib/zendesk2/help_center/post.rb', line 73
def subscriptions
requires :identity
cistern.help_center_subscriptions(content_id: identity, content_type: 'post')
end
|
#topic ⇒ Object
67
68
69
70
71
|
# File 'lib/zendesk2/help_center/post.rb', line 67
def topic
requires :topic_id
cistern.help_center_topics.get!(topic_id)
end
|