This gem is WIP!
Short description and motivation.
How to use my plugin.
Add this line to your application's Gemfile:
gem 'geo_master_jp'
And then execute:
$ bundle
Or install it yourself as:
$ gem install geo_master_jp
rails g geo_master_jp:install
rails g geo_master_jp:install_migration
rails g geo_master_jp:install_area_data
rails g geo_master_jp:install_railway_data
*Area data is required as a prerequisite.
prefectures = GeoMasterJp::Prefecture.all
tokyo = prefectures.find_by(code: '13')
cities = tokyo.cities
shinjuku = cities.find_by(code: '13104')
towns = shinjuku.towns
Add the following line to your config/routes.rb
:
GeoMasterJp.set_routes(self)
Then you can use the following API:
/geo_master_jp/api/prefectures
/geo_master_jp/api/cities?prefecture_code=13
/geo_master_jp/api/towns?city_code=13104
/geo_master_jp/api/railway_companies
/geo_master_jp/api/lines?prefecture_code=13
/geo_master_jp/api/lines?railway_company_code=002
/geo_master_jp/api/stations?line_code=11302
/geo_master_jp/api/stations?line_code=11302&prefecture_code=13
/geo_master_jp/api/same_stations?same_stations=1130225
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.