class Podio::Comment

@see developers.podio.com/doc/comments

Attributes

commentable_id[RW]
commentable_type[RW]

Public Class Methods

create(commentable_type, commentable_id, attributes, options={}) click to toggle source

@see developers.podio.com/doc/comments/add-comment-to-object-22340

# File lib/podio/models/comment.rb, line 41
def create(commentable_type, commentable_id, attributes, options={})
  response = Podio.connection.post do |req|
    req.url("/comment/#{commentable_type}/#{commentable_id}", options)
    req.body = attributes
  end

  response.body
end
delete(id) click to toggle source

@see developers.podio.com/doc/comments/delete-a-comment-22347

# File lib/podio/models/comment.rb, line 61
def delete(id)
  Podio.connection.delete("/comment/#{id}").status
end
find(id) click to toggle source

@see developers.podio.com/doc/comments/get-a-comment-22345

# File lib/podio/models/comment.rb, line 66
def find(id)
  member Podio.connection.get("/comment/#{id}").body
end
find_all_for(commentable_type, commentable_id) click to toggle source

@see developers.podio.com/doc/comments/get-comments-on-object-22371

# File lib/podio/models/comment.rb, line 71
def find_all_for(commentable_type, commentable_id)
  list Podio.connection.get("/comment/#{commentable_type}/#{commentable_id}").body
end
find_recent_for_share() click to toggle source
# File lib/podio/models/comment.rb, line 75
def find_recent_for_share
  #Internal
  list Podio.connection.get("/comment/share/").body
end
liked_by(id) click to toggle source

@see developers.podio.com/doc/comments/get-who-liked-a-comment-29007011

# File lib/podio/models/comment.rb, line 81
def liked_by(id)
  Podio.connection.get("/comment/#{id}/liked_by/").body.map{|values| Podio::Contact.new(values)}
end
update(id, attributes) click to toggle source

@see developers.podio.com/doc/comments/update-a-comment-22346

# File lib/podio/models/comment.rb, line 51
def update(id, attributes)
  response = Podio.connection.put do |req|
    req.url "/comment/#{id}"
    req.body = attributes
  end

  response.status
end

Public Instance Methods

create(options={}) click to toggle source

@see developers.podio.com/doc/comments/add-comment-to-object-22340

# File lib/podio/models/comment.rb, line 33
def create(options={})
  updated_attributes = Comment.create(self.commentable_type, self.commentable_id, self.attributes, options)
  self.attributes = updated_attributes.symbolize_keys
  self.initialize_attributes(self.attributes)
end