Class: Podio::Comment

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/comment.rb

Instance Attribute Summary collapse

Attributes inherited from ActivePodio::Base

#attributes, #error_code, #error_message, #error_parameters, #error_propagate

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ActivePodio::Base

#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, list, member, #new_record?, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Instance Attribute Details

#commentable_idObject

Returns the value of attribute commentable_id.



22
23
24
# File 'lib/podio/models/comment.rb', line 22

def commentable_id
  @commentable_id
end

#commentable_typeObject

Returns the value of attribute commentable_type.



22
23
24
# File 'lib/podio/models/comment.rb', line 22

def commentable_type
  @commentable_type
end

Class Method Details

.create(commentable_type, commentable_id, attributes) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/podio/models/comment.rb', line 29

def create(commentable_type, commentable_id, attributes)
  response = Podio.connection.post do |req|
    req.url "/comment/#{commentable_type}/#{commentable_id}"
    req.body = attributes
  end

  response.body['comment_id']
end

.delete(id) ⇒ Object



47
48
49
# File 'lib/podio/models/comment.rb', line 47

def delete(id)
  Podio.connection.delete("/comment/#{id}").status
end

.find(id) ⇒ Object



51
52
53
# File 'lib/podio/models/comment.rb', line 51

def find(id)
  member Podio.connection.get("/comment/#{id}").body
end

.find_all_for(commentable_type, commentable_id) ⇒ Object



55
56
57
# File 'lib/podio/models/comment.rb', line 55

def find_all_for(commentable_type, commentable_id)
  list Podio.connection.get("/comment/#{commentable_type}/#{commentable_id}").body
end

.find_recent_for_shareObject



59
60
61
62
# File 'lib/podio/models/comment.rb', line 59

def find_recent_for_share
  #Internal
  list Podio.connection.get("/comment/share/").body
end

.update(id, attributes) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/podio/models/comment.rb', line 38

def update(id, attributes)
  response = Podio.connection.put do |req|
    req.url "/comment/#{id}"
    req.body = attributes
  end

  response.status
end

Instance Method Details

#createObject



24
25
26
# File 'lib/podio/models/comment.rb', line 24

def create
  self.comment_id = Comment.create(commentable_type, commentable_id, attributes)
end