Class: Podio::Rating
Instance Attribute Summary
#attributes, #error_code, #error_message, #error_parameters, #error_propagate
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
#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, #initialize_attributes, list, member, #new_record?, output_attribute_as_json, #persisted?, property, #to_param
Class Method Details
.create(ref_type, ref_id, rating_type, value) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/podio/models/rating.rb', line 10
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
35
36
37
|
# File 'lib/podio/models/rating.rb', line 35
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
23
24
25
|
# File 'lib/podio/models/rating.rb', line 23
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
19
20
21
|
# File 'lib/podio/models/rating.rb', line 19
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
31
32
33
|
# File 'lib/podio/models/rating.rb', line 31
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
27
28
29
|
# File 'lib/podio/models/rating.rb', line 27
def find_own(ref_type, ref_id, rating_type)
Podio.connection.get("/rating/#{ref_type}/#{ref_id}/#{rating_type}/self").body['value']
end
|