Give your Rails app access to the best cities to live and work remotely for digital nomads. Includes: cost of living, internet speed, weather and other awesome metrics.
Follow @jessethanley for updates.
Add this line to your application's Gemfile:
gem 'nomadlist'
And then execute:
$ bundle
Or install it yourself as:
$ gem install nomadlist
To create a connection require 'nomadlist' in your code and add Nomadlist::City.find(city_id).result[0] where city_id is the name of the city followed by the country.
As an example, let's say I had a blog that I was building where I wanted to pull in some cool data about the cities I was visiting.
On my post model I could add a column called city_id...
city_id = "amsterdam-netherlands"
Now we can jump over to my posts controller and add...
require 'nomadlist'
After that's done I can add the following to my show method...
def show
@post = Post.friendly.find(params[:id])
@place = Nomadlist::City.find("amsterdam-netherlands").result[0]
end
Great! Now we've done that we can do the following commands
<%= @place.info.city.name %> = 'amsterdam'
<%= @place.info.country.city.name %> = 'netherlands'
<%= @place.info.weather.type %> = 'Partly Cloudy'
and much more!
For a full list have a look through the raw JSON here: https://nomadlist.com/api/v2/list/cities/amsterdam-netherlands
Bug reports and pull requests are welcome on GitHub at https://github.com/jessehanley/nomadlist. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.