Class: Whatser::Comment

Inherits:
Resource show all
Defined in:
lib/whatser/resources/comment.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#json

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#api_request, api_request, client, convert_data_to_model, from_hash_to_model, #initialize, set

Constructor Details

This class inherits a constructor from Whatser::Resource

Instance Attribute Details

#activity_feed_idObject

Returns the value of attribute activity_feed_id.



3
4
5
# File 'lib/whatser/resources/comment.rb', line 3

def activity_feed_id
  @activity_feed_id
end

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/whatser/resources/comment.rb', line 4

def body
  @body
end

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/whatser/resources/comment.rb', line 3

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/whatser/resources/comment.rb', line 3

def id
  @id
end

#poi_idObject

Returns the value of attribute poi_id.



3
4
5
# File 'lib/whatser/resources/comment.rb', line 3

def poi_id
  @poi_id
end

#subject_idObject

Returns the value of attribute subject_id.



3
4
5
# File 'lib/whatser/resources/comment.rb', line 3

def subject_id
  @subject_id
end

#subject_nameObject

Returns the value of attribute subject_name.



4
5
6
# File 'lib/whatser/resources/comment.rb', line 4

def subject_name
  @subject_name
end

#subject_typeObject

Returns the value of attribute subject_type.



4
5
6
# File 'lib/whatser/resources/comment.rb', line 4

def subject_type
  @subject_type
end

#user_avatarObject

Returns the value of attribute user_avatar.



4
5
6
# File 'lib/whatser/resources/comment.rb', line 4

def user_avatar
  @user_avatar
end

#user_idObject

Returns the value of attribute user_id.



3
4
5
# File 'lib/whatser/resources/comment.rb', line 3

def user_id
  @user_id
end

#user_nameObject

Returns the value of attribute user_name.



4
5
6
# File 'lib/whatser/resources/comment.rb', line 4

def user_name
  @user_name
end

Class Method Details

.create(resource_name, resource_id, body) ⇒ Object



19
20
21
# File 'lib/whatser/resources/comment.rb', line 19

def create(resource_name, resource_id, body)
  api_request :post, "/api/#{resource_name}/#{resource_id}/tags", {:body => {'comment' => {'body' => body}} }
end

.delete(id) ⇒ Object



15
16
17
# File 'lib/whatser/resources/comment.rb', line 15

def delete(id)
  api_request :delete, "/api/comments/#{id}"
end

.media(media_id, opts = {}) ⇒ Object



11
12
13
# File 'lib/whatser/resources/comment.rb', line 11

def media(media_id, opts={})
  api_request :get, "/api/media/#{media_id}/comments", {:query => opts}
end

.poi(poi_id, opts = {}) ⇒ Object



7
8
9
# File 'lib/whatser/resources/comment.rb', line 7

def poi(poi_id, opts={})
  api_request :get, "/api/poi/#{poi_id}/comments", {:query => opts}
end

Instance Method Details

#deleteObject



32
33
34
# File 'lib/whatser/resources/comment.rb', line 32

def delete
  self.class.delete(id)
end

#poiObject



24
25
26
# File 'lib/whatser/resources/comment.rb', line 24

def poi
  Whatser::Poi.set(self.class.client).find(poi_id) if poi_id
end

#userObject



28
29
30
# File 'lib/whatser/resources/comment.rb', line 28

def user
  Whatser::User.set(self.class.client).find(user_id) if user_id
end