Class: Clubhouse::Comment
Instance Attribute Summary
Attributes inherited from BaseResource
#client
Class Method Summary
collapse
Instance Method Summary
collapse
attributes, attributes_for_create, attributes_for_update, client, #initialize, resource, #update_object_from_payload
Class Method Details
.all ⇒ Object
39
40
41
42
|
# File 'lib/clubhouse/comment.rb', line 39
def all
raise NotSupportedByAPIError,
"You can get all comments associated directly from the story model"
end
|
.delete(story_id, comment_id) ⇒ Object
35
36
37
|
# File 'lib/clubhouse/comment.rb', line 35
def delete(story_id, )
client.delete("stories/#{story_id}/#{endpoint}/#{}")
end
|
.find(story_id, comment_id) ⇒ Object
30
31
32
33
|
# File 'lib/clubhouse/comment.rb', line 30
def find(story_id, )
payload = client.get("stories/#{story_id}/#{endpoint}/#{}")
new.update_object_from_payload(payload)
end
|
Instance Method Details
#reload ⇒ Object
24
25
26
27
|
# File 'lib/clubhouse/comment.rb', line 24
def reload
payload = client.get("stories/#{story_id}/#{self.class.endpoint}/#{id}")
update_object_from_payload(payload)
end
|
#save ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/clubhouse/comment.rb', line 11
def save
raise MissingStoryIDError, 'story_id is required to create/update comments' unless story_id
raise ClientNotSetup, "A default client or instance client is not setup" unless client
payload = if id
client.put("stories/#{story_id}/#{self.class.endpoint}/#{id}", update_attributes)
else
client.post("stories/#{story_id}/#{self.class.endpoint}", create_attributes)
end
update_object_from_payload(payload)
end
|