Foursquare now is the most important location-based social network and used by many of my contacts. And Ruby, like for every social network offer libraries that can help developer to be more productive. Foursquare is now available as an API using basic authentication or Oauth, for more information documentation.
For Library, GEM’s are available, one of them “foursquare-ruby-api” can do for you what you want.
To install :
$ sudo gem install foursquare-ruby-api
Next, you can write your code to do what you want.
To begin this sample, we must know some useful methods :
- Checkins : Returns a list of recent checkins from friends.
- Check-in : Allows you to check-in to a place.
- History : Returns a history of checkins for the authenticated user.
For more information, Very rich documentation are available with ideas about parameters and results structures.
And our Example will be a list of recent checkins from our friends:
fq = Foursquare.new(’email’,‘password’)
# fq.test is optional to test our connexion
fq.checkins()[‘checkins’][‘checkin’].each do |f|
puts f[‘display’]+" "+f[‘created’]
For more information :
PS: This api can be used as a hack to be mayor for many places from your house or office 😀3 comments
3 Comments so far
Leave a comment