Class: Whatser::Media
- Defined in:
- lib/whatser/resources/media.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#mid_pic ⇒ Object
Returns the value of attribute mid_pic.
-
#mime ⇒ Object
Returns the value of attribute mime.
-
#name ⇒ Object
Returns the value of attribute name.
-
#poi_id ⇒ Object
Returns the value of attribute poi_id.
-
#remote_resource ⇒ Object
writeonly
Sets the attribute remote_resource.
-
#resource ⇒ Object
writeonly
Sets the attribute resource.
-
#small_pic ⇒ Object
Returns the value of attribute small_pic.
-
#thumb_pic ⇒ Object
Returns the value of attribute thumb_pic.
-
#url ⇒ Object
Returns the value of attribute url.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Attributes inherited from Resource
Class Method Summary collapse
- .create(poi_id, params = {}) ⇒ Object
- .delete(poi_id, id) ⇒ Object
- .find(poi_id, id, opts = {}) ⇒ Object
- .list(poi_id, opts = {}) ⇒ Object
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
#created_at ⇒ Object
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/whatser/resources/media.rb', line 4 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/whatser/resources/media.rb', line 3 def id @id end |
#mid_pic ⇒ Object
Returns the value of attribute mid_pic.
4 5 6 |
# File 'lib/whatser/resources/media.rb', line 4 def mid_pic @mid_pic end |
#mime ⇒ Object
Returns the value of attribute mime.
4 5 6 |
# File 'lib/whatser/resources/media.rb', line 4 def mime @mime end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/whatser/resources/media.rb', line 4 def name @name end |
#poi_id ⇒ Object
Returns the value of attribute poi_id.
3 4 5 |
# File 'lib/whatser/resources/media.rb', line 3 def poi_id @poi_id end |
#remote_resource=(value) ⇒ Object (writeonly)
Sets the attribute remote_resource
5 6 7 |
# File 'lib/whatser/resources/media.rb', line 5 def remote_resource=(value) @remote_resource = value end |
#resource=(value) ⇒ Object (writeonly)
Sets the attribute resource
5 6 7 |
# File 'lib/whatser/resources/media.rb', line 5 def resource=(value) @resource = value end |
#small_pic ⇒ Object
Returns the value of attribute small_pic.
4 5 6 |
# File 'lib/whatser/resources/media.rb', line 4 def small_pic @small_pic end |
#thumb_pic ⇒ Object
Returns the value of attribute thumb_pic.
4 5 6 |
# File 'lib/whatser/resources/media.rb', line 4 def thumb_pic @thumb_pic end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/whatser/resources/media.rb', line 4 def url @url end |
#user_id ⇒ Object
Returns the value of attribute user_id.
3 4 5 |
# File 'lib/whatser/resources/media.rb', line 3 def user_id @user_id end |
Class Method Details
.create(poi_id, params = {}) ⇒ Object
16 17 18 |
# File 'lib/whatser/resources/media.rb', line 16 def create(poi_id, params={}) api_request :post, "/api/poi/#{poi_id}/media", {:body => {'media' => params} } end |
.delete(poi_id, id) ⇒ Object
20 21 22 |
# File 'lib/whatser/resources/media.rb', line 20 def delete(poi_id, id) api_request :delete, "/api/poi/#{poi_id}/media/#{id}" end |
.find(poi_id, id, opts = {}) ⇒ Object
12 13 14 |
# File 'lib/whatser/resources/media.rb', line 12 def find(poi_id, id, opts={}) api_request :get, "/api/poi/#{poi_id}/media/#{id}", {:query => opts} end |
.list(poi_id, opts = {}) ⇒ Object
8 9 10 |
# File 'lib/whatser/resources/media.rb', line 8 def list(poi_id, opts={}) api_request :get, "/api/poi/#{poi_id}/media", {:query => opts} end |
Instance Method Details
#delete ⇒ Object
33 34 35 |
# File 'lib/whatser/resources/media.rb', line 33 def delete Whatser::Media.delete(poi_id, id) end |
#save ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/whatser/resources/media.rb', line 25 def save if id.blank? Whatser::Media.create(poi_id, to_params) else api_request :put, "/api/poi/#{poi_id}/media/#{id}", {:body => {'media' => to_params} } end end |
#to_params ⇒ Object
37 38 39 |
# File 'lib/whatser/resources/media.rb', line 37 def to_params {:name=>name,:resource=>@resource,:remote_resource=>@remote_resource} end |