Module: Foursquared::Checkins
- Included in:
- Client
- Defined in:
- lib/foursquared/checkins.rb
Overview
Checkins module
Instance Method Summary collapse
-
#add_checkin(options = {}) ⇒ Hash
Create a check-in.
-
#add_checkin_comment(checkin_id, options = {}) ⇒ Hash
Add a comment to a check-in.
-
#checkin(checkin_id, options = {}) ⇒ Foursquared::Response::Checkin
Get details of a checkin.
-
#checkin_likes(checkin_id) ⇒ Hash
Users who have liked a checkin.
-
#delete_checkin_comment(checkin_id, options = {}) ⇒ Foursquared::Response::Checkin
Remove commment from check-in.
-
#like_checkin(checkin_id, options = {}) ⇒ Object
Like or unlike a checkin.
-
#recent_checkins(options = {}) ⇒ Array
Recent checkins by friends.
Instance Method Details
#add_checkin(options = {}) ⇒ Hash
Create a check-in
28 29 30 31 |
# File 'lib/foursquared/checkins.rb', line 28 def add_checkin ={} response = post("/checkins/add", )["response"] {:checkin => Foursquared::Response::Checkin.new(self, response["checkin"]), :notifications => response["notifications"]} end |
#add_checkin_comment(checkin_id, options = {}) ⇒ Hash
Add a comment to a check-in
61 62 63 64 65 66 |
# File 'lib/foursquared/checkins.rb', line 61 def add_checkin_comment checkin_id, ={} response = post("/checkins/#{checkin_id}/addcomment", )["response"] @comment = response["comment"] @comment["user"] = Foursquared::Response::User.new(self, @comment["user"]) @comment end |
#checkin(checkin_id, options = {}) ⇒ Foursquared::Response::Checkin
Get details of a checkin.
11 12 13 14 |
# File 'lib/foursquared/checkins.rb', line 11 def checkin checkin_id, ={} response = get("/checkins/#{checkin_id}",)["response"] @checkin = Foursquared::Response::Checkin.new(self, response["checkin"]) end |
#checkin_likes(checkin_id) ⇒ Hash
Users who have liked a checkin
47 48 49 50 51 52 53 |
# File 'lib/foursquared/checkins.rb', line 47 def checkin_likes checkin_id @likes = get("/checkins/#{checkin_id}/likes")["response"]["likes"] @likes["groups"].each do |group| group["items"].map!{|item|Foursquared::Response::User.new(self, item)} end @likes end |
#delete_checkin_comment(checkin_id, options = {}) ⇒ Foursquared::Response::Checkin
Remove commment from check-in
73 74 75 76 |
# File 'lib/foursquared/checkins.rb', line 73 def delete_checkin_comment checkin_id, ={} response = post("/checkins/#{checkin_id}/deletecomment", )["response"] @checkin = Foursquared::Response::Checkin.new(self, response["checkin"]) end |
#like_checkin(checkin_id, options = {}) ⇒ Object
Like or unlike a checkin
82 83 84 85 86 87 88 |
# File 'lib/foursquared/checkins.rb', line 82 def like_checkin checkin_id, ={} response = post("/checkins/#{checkin_id}/like", )["response"]["likes"] response["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::User.new(self, item)} end response end |
#recent_checkins(options = {}) ⇒ Array
Recent checkins by friends
39 40 41 42 |
# File 'lib/foursquared/checkins.rb', line 39 def recent_checkins ={} response = get("/checkins/recent", )["response"] @checkins = response["recent"].collect{|checkin| Foursquared::Response::Checkin.new(self, checkin)} end |