Skip to content

Instantly share code, notes, and snippets.

@bradleypriest
Created March 26, 2012 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradleypriest/2204036 to your computer and use it in GitHub Desktop.
Save bradleypriest/2204036 to your computer and use it in GitHub Desktop.
Foursquare bot
require 'oauth2'
require 'foursquare2'
class FoursquareBot
BURGER_FUEL_PARNELL_ID = "4b3992a0f964a520d05d25e3"
attr_accessor :client
def initialize(token)
@client = Foursquare2::Client.new(:oauth_token => token)
end
def checkin(venue_id = BURGER_FUEL_PARNELL_ID)
loc = @client.venue(venue_id).location
@client.add_checkin(:venueId => venue_id, :broadcast => 'public', :ll => '#{loc.lat},#{loc.lng}')
end
def self.get_oauth(client_id, redirect_uri)
`open "https://foursquare.com/oauth2/authenticate?client_id=#{client_id}&response_type=token&redirect_uri=#{redirect_uri}"`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment