Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Readme for API versioning-related updates #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Install it as a gem (in your `Gemfile`) and its dependencies:

Get a foursquare:

foursquare = Foursquare::Base.new("ACCESS_TOKEN")
foursquare = Foursquare::Base.new(:access_token => "ACCESS_TOKEN")

You can also user `client_id` and `client_secret`
You can also use `client_id` and `client_secret`

foursquare = Foursquare::Base.new("CLIENT_ID", "CLIENT_SECRET")
foursquare = Foursquare::Base.new(:client_id => "CLIENT_ID", :client_secret => "CLIENT_SECRET")

### Authentication

Expand All @@ -32,8 +32,12 @@ First, you need to [register your application](https://foursquare.com/oauth).

Get a foursquare with your `client_id` and `client_secret`

foursquare = Foursquare::Base.new("CLIENT_ID", "CLIENT_SECRET")
foursquare = Foursquare::Base.new(:client_id => "CLIENT_ID", :client_secret => "CLIENT_SECRET")

By default, today's date in YYYYMMDD format will be passed as the API version to all requests to the Foursquare API. If you'd like to specify your own version, you may do so by passing your version to the initialization of `Foursquare::Base`.

foursquare = Foursquare::Base.new(:client_id => "CLIENT_ID", :client_secret => "CLIENT_SECRET", :api_version => '20120131')

Redirect users to the Foursquare authentication page. You need to pass your `callback_url`. Get the url to redirect to with:

foursquare.authorize_url("CALLBACK_SESSION_URL")
Expand All @@ -44,7 +48,8 @@ Then Foursquare will redirect the user to your callback url with a code paramete

Now you can get a foursquare using only an access token and make requests on user's behalf:

foursquare = Foursquare::Base.new("ACCESS_TOKEN")
foursquare = Foursquare::Base.new(:access_token => "ACCESS_TOKEN")
# You may also specify the API version here as described above

### Users

Expand Down