WIP
This gem is WIP!
GeoMasterJp
Short description and motivation.
Usage
How to use my plugin.
Installation
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
Initialize
Create Config File
rails g geo_master_jp:install
Create Migration Files
rails g geo_master_jp:install_migration
Import Area Data
rails g geo_master_jp:install_area_data
Import Railway Data
rails g geo_master_jp:install_railway_data
*Area data is required as a prerequisite.
Usage
Use Area Data Examples
prefectures = GeoMasterJp::Prefecture.all
tokyo = prefectures.find_by(code: '13')
cities = tokyo.cities
shinjuku = cities.find_by(code: '13104')
towns = shinjuku.towns
Use Area Data API
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
Contributing
Contribution directions go here.
License
The gem is available as open source under the terms of the MIT License.