Rails

Foursquare + Rails + Heroku


A few days ago I was just doing research about gems to handle the Foursquare API, I was wondering how to have this interaction between Rails and Foursquare. I found this Gem, so this is my review and the steps you need to follow to start using it:

Foursquare rails generators
(Rails app + Foursquare running on Heroku.)


With the following lines of code you will create a new app with Foursquare and deploy it to Heroku:

$ rails new your-unique-app-name -d postgresql -m  https://gist.github.com/pierrevalade/4007411/raw/e0580f5e0db6bc91d3e329ecfb8b78580d858865/gistfile1.rb

Note: try to make sure {your-unique-app-name} is truly unique or Heroku won't let you create an app with a name that has already been taken.


After that code, you will see this:

your app's name:  my-foursquare-data
Download / welcome page url: http://my-foursquare-data.herokuapp.com
Callback url: http://my-foursquare-data.herokuapp.com/clients/foursquare/callback
Push url: https://my-foursquare-data.herokuapp.com/checkins

Then you will be asked to register your app on Foursquare like this:

please register your app my-foursquare-data on https://foursquare.com/developers/register

image alt


Once you register your application, you will need to introduce the following app keys in the terminal.

what is your client_id (https://foursquare.com/oauth) ? DQZS5VNJ3ANVEWAK1QR2VWKETVEN1EDTS30R424CBUCFSGOB

what is your client_secret? V20BYMMIZCIZTL3S11YR15WORLUJDLZQAT1MKXEJSSHRET0P

This will automatically create your http://my-foursquare-data.herokuapp.com/ address as well as the Heroku project, and it will be deployed to production.

Note: you need to be logged in to Heroku in your terminal.
Heroku devcenter.

The good and the not-so-good

In my opinion, the not-so-good side to using this gem is the following:
  • "For now, it's only available when you create a new Rails app from scratch."
  • Sometimes the bundle fails, so you need to be careful
The good things:
  • The setup is very fast, it takes about a minute
  • Easy to use and handle

I encourage you to experiment with this gem, and fork it: Foursquare rails generators

Follow me on Twitter, I'm @zazvick, and also read me at PolyglotCoder

Thanks for reading!

Javascript
AngularJS Providers under the hood
Best Practices
8 Tips For Bootstrap
Beginner
ReactJS: Loops in JSX