Class: Podio::Rating
Overview
Instance Attribute Summary
#attributes
Class Method Summary
collapse
-
.create(ref_type, ref_id, rating_type, value) ⇒ Object
-
.delete(ref_type, ref_id, rating_type) ⇒ Object
-
.find(ref_type, ref_id, rating_type, user_id) ⇒ Object
-
.find_all(ref_type, ref_id) ⇒ Object
-
.find_all_by_type(ref_type, ref_id, rating_type) ⇒ Object
-
.find_own(ref_type, ref_id, rating_type) ⇒ Object
-
.like_count(ref_type, ref_id) ⇒ Object
-
.liked_by(ref_type, ref_id, options = {}) ⇒ Object
#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, has_many, has_one, #hash, #initialize, #initialize_attributes, klass_from_string, list, member, #new_record?, output_attribute_as_json, #parent_model, #persisted?, property, #to_param
Class Method Details
.create(ref_type, ref_id, rating_type, value) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/podio/models/rating.rb', line 12
def create(ref_type, ref_id, rating_type, value)
response = Podio.connection.post do |req|
req.url "/rating/#{ref_type}/#{ref_id}/#{rating_type}"
req.body = { :value => value }
end
response.body['rating_id']
end
|
.delete(ref_type, ref_id, rating_type) ⇒ Object
42
43
44
|
# File 'lib/podio/models/rating.rb', line 42
def delete(ref_type, ref_id, rating_type)
Podio.connection.delete("/rating/#{ref_type}/#{ref_id}/#{rating_type}").body
end
|
.find(ref_type, ref_id, rating_type, user_id) ⇒ Object
27
28
29
|
# File 'lib/podio/models/rating.rb', line 27
def find(ref_type, ref_id, rating_type, user_id)
Podio.connection.get("/rating/#{ref_type}/#{ref_id}/#{rating_type}/#{user_id}").body['value']
end
|
.find_all(ref_type, ref_id) ⇒ Object
22
23
24
|
# File 'lib/podio/models/rating.rb', line 22
def find_all(ref_type, ref_id)
collection Podio.connection.get("/rating/#{ref_type}/#{ref_id}").body
end
|
.find_all_by_type(ref_type, ref_id, rating_type) ⇒ Object
37
38
39
|
# File 'lib/podio/models/rating.rb', line 37
def find_all_by_type(ref_type, ref_id, rating_type)
collection Podio.connection.get("/rating/#{ref_type}/#{ref_id}/#{rating_type}").body
end
|
.find_own(ref_type, ref_id, rating_type) ⇒ Object
32
33
34
|
# File 'lib/podio/models/rating.rb', line 32
def find_own(ref_type, ref_id, rating_type)
Podio.connection.get("/rating/#{ref_type}/#{ref_id}/#{rating_type}/self").body['value']
end
|
.like_count(ref_type, ref_id) ⇒ Object
54
55
56
|
# File 'lib/podio/models/rating.rb', line 54
def like_count(ref_type, ref_id)
Podio.connection.get("/rating/#{ref_type}/#{ref_id}/like_count").body["like_count"]
end
|
.liked_by(ref_type, ref_id, options = {}) ⇒ Object
47
48
49
50
51
|
# File 'lib/podio/models/rating.rb', line 47
def liked_by(ref_type, ref_id, options={})
Podio.connection.get { |req|
req.url("/rating/#{ref_type}/#{ref_id}/liked_by/", options)
}.body.map{|values| Podio::Contact.new(values)}
end
|