Sha256: 695025c46c8087267096f7d94df4bbefe667ce0555924895dfeead53e8cb1407
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
require 'rubygems' require 'httparty' class Foursquare include HTTParty base_uri 'api.foursquare.com' format :xml # auth user def initialize(user,pass) self.class.basic_auth user, pass end # test for response from Foursquare def test self.class.get("/v1/test") end # does not require auth def cities self.class.get("/v1/cities") end def venues(lat,long,radius="",limit="",query="") self.class.get("/v1/venues?geolat=#{lat}&geolong=#{long}&r=#{radius}&l=#{limit}&q=#{query}") end def tips(lat,long,limit) self.class.get("/v1/tips?geolat=#{lat}&geolong=#{long}&l=#{limit}") end # require auth def check_city(lat, long) self.class.get("/v1/checkcity?geolat=#{lat}&geolong=#{long}") end def switch_city(city_id) self.class.post("/v1/switchcity", :body => {:cityid => city_id}) end def friend_checkins self.class.get("/v1/checkins") end def checkin(vid,venue,shout,private_checkin,tweetThis,geolat,geolong) self.class.get("/v1/checkin?vid=#{vid}&venue=#{venue}&shout=#{shout}&private=#{private_checkin}&twitter=#{tweetThis}&geolat=#{geolat}&geolong=#{geolong}") end def history(limit) self.class.get("/v1/history?l=#{limit}") end def user_details(user_id,badges,mayor) self.class.get("/v1/user?uid=#{user_id}&badges=#{badges}&mayor=#{mayor}") end def friends self.class.get("/v1/friends") end def venue_details(venue_id) self.class.get("/v1/venue?vid=#{venue_id}") end def add_venue(city_id,name,address,cross_street,city,state,zip='0',phone='0') self.class.post("/v1/addvenue", :body => {:name => name, :address => address, :crossstreet => cross_street, :city => city, :state => state, :zip => zip, :cityid => city_id, :phone => phone}) end def add_tip(venue_id,text,type) self.class.post("/v1/addtip", :body => {:vid => venue_id, :text => text, :type => type}) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foursquare-0.0.1 | lib/foursquare.rb |