class Clubhouse::Comment

Public Class Methods

all() click to toggle source
# 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) click to toggle source
# File lib/clubhouse/comment.rb, line 35
def delete(story_id, comment_id)
  client.delete("stories/#{story_id}/#{endpoint}/#{comment_id}")
end
find(story_id, comment_id) click to toggle source
# File lib/clubhouse/comment.rb, line 30
def find(story_id, comment_id)
  payload = client.get("stories/#{story_id}/#{endpoint}/#{comment_id}")
  new.update_object_from_payload(payload)
end

Public Instance Methods

reload() click to toggle source
# 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() click to toggle source
# 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