geo_master_jp 0.1.27 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/controllers/geo_master_jp/area_api_controller.rb +10 -0
- data/app/models/geo_master_jp/prefecture.rb +2 -2
- data/lib/generators/geo_master_jp/data/company20240328.csv.zip +0 -0
- data/lib/generators/geo_master_jp/data/join20240426.csv.zip +0 -0
- data/lib/generators/geo_master_jp/data/line20240426free.csv.zip +0 -0
- data/lib/generators/geo_master_jp/data/station20240426free.csv.zip +0 -0
- data/lib/generators/geo_master_jp/install_railway_data_generator.rb +6 -6
- data/lib/generators/geo_master_jp/templates/geo_master_jp.rb +10 -0
- data/lib/geo_master_jp/config.rb +6 -1
- data/lib/geo_master_jp/version.rb +1 -1
- metadata +7 -7
- data/lib/generators/geo_master_jp/data/company20180424.csv.zip +0 -0
- data/lib/generators/geo_master_jp/data/join20190405.csv.zip +0 -0
- data/lib/generators/geo_master_jp/data/line20190405free.csv.zip +0 -0
- data/lib/generators/geo_master_jp/data/station20190405free.csv.zip +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 792aee56124d3e9f0267333ba66bf7e5429ad6c281013efe1c2a3b23557cbd36
|
4
|
+
data.tar.gz: 4bcefa376a8fe95065214fb025ee4cd40bf33e81baedff8de8347cee88f16680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f5af00e3bd7ed49ed3acb9669b03a7b19f5df9a2c16918b460e9d7296e15a32ad996a98be753400c01d83b17c6ac3db160fc25f590cb6ce8d94d24b1b2bfd8d
|
7
|
+
data.tar.gz: 7d6c998a40c969fba255c4ad086afca0799e959f91ee1f722ae53239ea71e69e2bb5f5aac66d01fef3c048916883ab5d72a4869921977a6f06d73c79d9763c2d
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@ module GeoMasterJp
|
|
3
3
|
def prefectures
|
4
4
|
prefectures = GeoMasterJp::Prefecture.all
|
5
5
|
|
6
|
+
prefectures = GeoMasterJp.config.api.prefectures_filter.call(prefectures) if GeoMasterJp.config.api.prefectures_filter
|
7
|
+
|
6
8
|
render json: {
|
7
9
|
prefectures: prefectures.map{|prefecture|
|
8
10
|
prefecture.as_json(only: [:code, :name, :name_kana, :name_alphabet, :short_name])
|
@@ -20,6 +22,8 @@ module GeoMasterJp
|
|
20
22
|
|
21
23
|
cities = GeoMasterJp::Prefecture.find_by(code: params[:prefecture_code]).cities
|
22
24
|
|
25
|
+
cities = GeoMasterJp.config.api.cities_filter.call(cities) if GeoMasterJp.config.api.cities_filter
|
26
|
+
|
23
27
|
render json: {
|
24
28
|
cities: cities.map{|city|
|
25
29
|
city.as_json(only: [:code, :name, :name_kana, :name_alphabet, :short_name])
|
@@ -37,6 +41,8 @@ module GeoMasterJp
|
|
37
41
|
|
38
42
|
towns = GeoMasterJp::City.find_by(code: params[:city_code]).towns
|
39
43
|
|
44
|
+
towns = GeoMasterJp.config.api.towns_filter.call(towns) if GeoMasterJp.config.api.towns_filter
|
45
|
+
|
40
46
|
render json: {
|
41
47
|
towns: towns.map{|town|
|
42
48
|
town.as_json(only: [:zip_code, :code, :name, :name_kana, :name_alphabet, :short_name])
|
@@ -44,5 +50,9 @@ module GeoMasterJp
|
|
44
50
|
initials: towns.sort_by(&:name_kana).group_by(&:head_kana).sort_by(&:first).to_h
|
45
51
|
}
|
46
52
|
end
|
53
|
+
|
54
|
+
def self.aaa(text)
|
55
|
+
puts text
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|
@@ -22,8 +22,8 @@ module GeoMasterJp
|
|
22
22
|
self.cities.map{|city| [city.name, city.code] }
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.select_options
|
26
|
-
|
25
|
+
def self.select_options(transactions=nil)
|
26
|
+
(transactions || all).map{|prefecture| [prefecture.name, prefecture.code] }
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -5,10 +5,10 @@ require 'yaml'
|
|
5
5
|
module GeoMasterJp
|
6
6
|
module Generators
|
7
7
|
class InstallRailwayDataGenerator < Rails::Generators::Base
|
8
|
-
RAILWAY_COMPANY_VERSION = '
|
9
|
-
LINE_VERSION = '
|
10
|
-
STATION_VERSION = '
|
11
|
-
STATION_CONNECTION_VERSION = '
|
8
|
+
RAILWAY_COMPANY_VERSION = '20240328'
|
9
|
+
LINE_VERSION = '20240426'
|
10
|
+
STATION_VERSION = '20240426'
|
11
|
+
STATION_CONNECTION_VERSION = '20240426'
|
12
12
|
|
13
13
|
source_root File.expand_path('templates', __dir__)
|
14
14
|
|
@@ -165,8 +165,8 @@ module GeoMasterJp
|
|
165
165
|
station.address = row[8].gsub('-', '')
|
166
166
|
station.longitude = row[9]
|
167
167
|
station.latitude = row[10]
|
168
|
-
station.open_date = Date.parse(row[11]) if row[11].present?
|
169
|
-
station.close_date = Date.parse(row[12]) if row[12].present?
|
168
|
+
station.open_date = Date.parse(row[11]) if row[11].present? && row[11] != '0000-00-00'
|
169
|
+
station.close_date = Date.parse(row[12]) if row[12].present? && row[12] != '0000-00-00'
|
170
170
|
station.sort_order = row[14].to_i
|
171
171
|
|
172
172
|
station
|
@@ -12,4 +12,14 @@ GeoMasterJp.configure do |config|
|
|
12
12
|
|
13
13
|
# Use Models
|
14
14
|
# config.use_models = [:area, :railway]
|
15
|
+
|
16
|
+
# API Filters
|
17
|
+
# config.api.prefectures_filter = ->(prefectures) {
|
18
|
+
# prefecture_codes = ['11', '12', '13', '14']
|
19
|
+
# prefectures.select { |prefecture| prefecture.code.in?(prefecture_codes) }
|
20
|
+
# }
|
21
|
+
# config.api.cities_filter = ->(cities) {
|
22
|
+
# }
|
23
|
+
# config.api.towns_filter = ->(towns) {
|
24
|
+
# }
|
15
25
|
end
|
data/lib/geo_master_jp/config.rb
CHANGED
@@ -9,15 +9,20 @@ module GeoMasterJp
|
|
9
9
|
|
10
10
|
class Config
|
11
11
|
# Variables detail is writen in lib/generators/templates/geo_master_jp.rb.
|
12
|
-
attr_accessor :alternative_class_names, :use_models
|
12
|
+
attr_accessor :alternative_class_names, :use_models, :api
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
@alternative_class_names = {}
|
16
16
|
@use_models = [:area, :railway]
|
17
|
+
@api = API.new
|
17
18
|
end
|
18
19
|
|
19
20
|
def alternative_class_name(key)
|
20
21
|
@alternative_class_names[key] || "GeoMasterJp::#{key.to_s.camelize}"
|
21
22
|
end
|
23
|
+
|
24
|
+
class API
|
25
|
+
attr_accessor :prefectures_filter, :cities_filter, :towns_filter
|
26
|
+
end
|
22
27
|
end
|
23
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo_master_jp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ykogure
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -101,11 +101,11 @@ files:
|
|
101
101
|
- app/models/geo_master_jp/town.rb
|
102
102
|
- app/models/geo_master_jp/version.rb
|
103
103
|
- config/routes.rb
|
104
|
-
- lib/generators/geo_master_jp/data/
|
105
|
-
- lib/generators/geo_master_jp/data/
|
106
|
-
- lib/generators/geo_master_jp/data/
|
104
|
+
- lib/generators/geo_master_jp/data/company20240328.csv.zip
|
105
|
+
- lib/generators/geo_master_jp/data/join20240426.csv.zip
|
106
|
+
- lib/generators/geo_master_jp/data/line20240426free.csv.zip
|
107
107
|
- lib/generators/geo_master_jp/data/prefectures.yml
|
108
|
-
- lib/generators/geo_master_jp/data/
|
108
|
+
- lib/generators/geo_master_jp/data/station20240426free.csv.zip
|
109
109
|
- lib/generators/geo_master_jp/install_area_data_generator.rb
|
110
110
|
- lib/generators/geo_master_jp/install_generator.rb
|
111
111
|
- lib/generators/geo_master_jp/install_migration_generator.rb
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
148
|
+
rubygems_version: 3.5.11
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Summary of GeoMasterJp.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|