jp_address 1.0.2 → 2.0.0
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/CHANGELOG.md +57 -0
- data/MIT-LICENSE +0 -0
- data/README.md +81 -96
- data/Rakefile +14 -15
- data/app/controllers/jp_address/application_controller.rb +1 -0
- data/app/controllers/jp_address/zipcodes_controller.rb +9 -4
- data/app/models/jp_address/application_record.rb +5 -0
- data/app/models/jp_address/zipcode.rb +139 -75
- data/config/routes.rb +0 -0
- data/db/migrate/20160312045953_create_jp_address_zipcodes.rb +1 -1
- data/lib/jp_address/engine.rb +0 -0
- data/lib/jp_address/version.rb +1 -1
- data/lib/jp_address.rb +3 -1
- data/lib/tasks/jp_address_tasks.rake +0 -0
- metadata +48 -157
- data/app/assets/javascripts/jp_address/application.js +0 -13
- data/app/assets/stylesheets/jp_address/application.css +0 -15
- data/app/helpers/jp_address/application_helper.rb +0 -4
- data/app/views/layouts/jp_address/application.html.erb +0 -14
- data/spec/controllers/jp_address/zipcodes_controller_spec.rb +0 -25
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/config/manifest.js +0 -2
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/bin/setup +0 -29
- data/spec/dummy/config/application.rb +0 -31
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -3
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/schema.rb +0 -25
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +0 -35
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/jp_address_zipcodes.rb +0 -10
- data/spec/models/jp_address/zipcode_spec.rb +0 -64
- data/spec/rails_helper.rb +0 -15
- data/spec/spec_helper.rb +0 -92
- data/spec/support/files/sample_ken.csv +0 -5
- data/spec/vcr/download_master_file_from_japanpost.yml +0 -37476
|
@@ -1,68 +1,116 @@
|
|
|
1
1
|
module JpAddress
|
|
2
|
-
class Zipcode <
|
|
2
|
+
class Zipcode < ApplicationRecord
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
# 日本郵便からダウンロードした CSV の一時保存先。
|
|
5
|
+
MASTER_CSV_PATH = 'tmp/ken_all.csv'.freeze
|
|
6
|
+
|
|
7
|
+
# 郵便番号データ(住所の郵便番号/小書き)の配布 URL。
|
|
8
|
+
MASTER_FILE_URL = 'https://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip'.freeze
|
|
9
|
+
|
|
10
|
+
# insert_all で一度に流し込む件数。
|
|
11
|
+
INSERT_BATCH_SIZE = 1_000
|
|
12
|
+
|
|
13
|
+
# リダイレクトを追う上限。
|
|
14
|
+
MAX_REDIRECTS = 5
|
|
15
|
+
|
|
16
|
+
class DownloadError < StandardError; end
|
|
5
17
|
|
|
6
18
|
def self.download_master_file_from_japanpost
|
|
7
19
|
_setup_directory
|
|
8
|
-
|
|
9
|
-
|
|
20
|
+
tmp_zip = _save_zip(_request_to_japanpost)
|
|
21
|
+
begin
|
|
22
|
+
_save_csv(tmp_zip.path)
|
|
23
|
+
ensure
|
|
24
|
+
tmp_zip.close!
|
|
25
|
+
end
|
|
10
26
|
:success if File.exist?(MASTER_CSV_PATH)
|
|
11
27
|
end
|
|
12
28
|
|
|
13
29
|
def self._setup_directory
|
|
14
|
-
FileUtils.mkdir_p
|
|
30
|
+
FileUtils.mkdir_p File.dirname(MASTER_CSV_PATH)
|
|
15
31
|
_remove_csv
|
|
16
32
|
end
|
|
17
33
|
private_class_method :_setup_directory
|
|
18
34
|
|
|
19
|
-
def self._request_to_japanpost
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
def self._request_to_japanpost(url = MASTER_FILE_URL, redirect_limit = MAX_REDIRECTS)
|
|
36
|
+
raise DownloadError, "too many redirects while downloading #{MASTER_FILE_URL}" if redirect_limit <= 0
|
|
37
|
+
|
|
38
|
+
uri = URI.parse(url)
|
|
39
|
+
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |https|
|
|
40
|
+
https.get(uri.request_uri)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
case res
|
|
44
|
+
when Net::HTTPSuccess
|
|
45
|
+
res.body
|
|
46
|
+
when Net::HTTPRedirection
|
|
47
|
+
location = res['location']
|
|
48
|
+
raise DownloadError, "got a redirect without a location from #{url}" if location.nil?
|
|
49
|
+
|
|
50
|
+
_request_to_japanpost(URI.join(url, location).to_s, redirect_limit - 1)
|
|
51
|
+
else
|
|
52
|
+
raise DownloadError, "failed to download #{url} (#{res.code} #{res.message})"
|
|
53
|
+
end
|
|
27
54
|
end
|
|
28
55
|
private_class_method :_request_to_japanpost
|
|
29
56
|
|
|
30
57
|
def self._save_zip(binary)
|
|
31
|
-
tmp_zip = Tempfile.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
tmp_zip = Tempfile.new(['ken_all', '.zip'])
|
|
59
|
+
tmp_zip.binmode
|
|
60
|
+
tmp_zip.write binary
|
|
61
|
+
tmp_zip.flush
|
|
62
|
+
tmp_zip.close
|
|
36
63
|
tmp_zip
|
|
37
64
|
end
|
|
38
65
|
private_class_method :_save_zip
|
|
39
66
|
|
|
40
67
|
def self._save_csv(zip_path)
|
|
41
68
|
Zip::File.open(zip_path) do |zip_file|
|
|
42
|
-
zip_file.
|
|
43
|
-
|
|
44
|
-
|
|
69
|
+
entry = zip_file.find { |e| e.file? && File.extname(e.name).downcase == '.csv' }
|
|
70
|
+
raise DownloadError, "no CSV file found in the archive from #{MASTER_FILE_URL}" if entry.nil?
|
|
71
|
+
|
|
72
|
+
entry.extract(MASTER_CSV_PATH)
|
|
45
73
|
end
|
|
46
74
|
end
|
|
47
75
|
private_class_method :_save_csv
|
|
48
76
|
|
|
77
|
+
# CSV を読み込んでテーブルを作り直します。
|
|
78
|
+
#
|
|
79
|
+
# 同じ郵便番号を持つ行は1レコードに統合してから insert するので、
|
|
80
|
+
# 郵便番号はテーブル内で一意になります。
|
|
49
81
|
def self.load_master_data(csv_path = MASTER_CSV_PATH)
|
|
50
|
-
|
|
82
|
+
unless File.exist?(csv_path)
|
|
83
|
+
raise ArgumentError, "#{csv_path} does not exist" unless csv_path == MASTER_CSV_PATH
|
|
84
|
+
|
|
85
|
+
download_master_file_from_japanpost
|
|
86
|
+
end
|
|
87
|
+
|
|
51
88
|
_clear_table
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
sanitize_sql(
|
|
55
|
-
["insert into jp_address_zipcodes (zip, prefecture, city, town)
|
|
56
|
-
values ('%s', '%s', '%s', '%s')", row[2], row[6], row[7], _remove_needless_words(row[8])
|
|
57
|
-
]
|
|
58
|
-
)
|
|
59
|
-
)
|
|
89
|
+
transaction do
|
|
90
|
+
_each_record_batch_from(csv_path) { |batch| insert_all!(batch) }
|
|
60
91
|
end
|
|
61
|
-
_merge_same_zip_addresses
|
|
62
92
|
_remove_csv
|
|
93
|
+
nil
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# CSV を郵便番号ごとにまとめ、insert_all に渡せる Hash の配列を
|
|
97
|
+
# INSERT_BATCH_SIZE 件ずつ yield します。
|
|
98
|
+
def self._each_record_batch_from(csv_path)
|
|
99
|
+
_read_master_csv(csv_path).each_value.each_slice(INSERT_BATCH_SIZE) do |slice|
|
|
100
|
+
yield slice.map { |rec|
|
|
101
|
+
{
|
|
102
|
+
zip: rec[:zip],
|
|
103
|
+
prefecture: rec[:prefecture],
|
|
104
|
+
city: rec[:city],
|
|
105
|
+
town: _find_shared_name_from(rec[:towns])
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
end
|
|
63
109
|
end
|
|
110
|
+
private_class_method :_each_record_batch_from
|
|
64
111
|
|
|
65
|
-
#
|
|
112
|
+
# 郵便番号をキーにして CSV の行をまとめます。
|
|
113
|
+
# 都道府県名・市区町村名は同じ郵便番号の最初の行のものを採用します。
|
|
66
114
|
#
|
|
67
115
|
# 例:9896712
|
|
68
116
|
# "宮城県","大崎市","鳴子温泉水沼"
|
|
@@ -72,23 +120,45 @@ module JpAddress
|
|
|
72
120
|
# これらは
|
|
73
121
|
# "宮城県","大崎市","鳴子温泉" として1つのレコードにします。
|
|
74
122
|
# 共通する地名が抜き出せない場合は空の町名にします。
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
123
|
+
#
|
|
124
|
+
# ken_all.csv では町域名が長いと括弧の途中で改行され、次の行に続きます。
|
|
125
|
+
# "米出(124、125、127、"
|
|
126
|
+
# "148、149、154番地)"
|
|
127
|
+
# 続きの行は町域名ではないので、括弧が閉じるまでの行は読み飛ばします。
|
|
128
|
+
def self._read_master_csv(csv_path)
|
|
129
|
+
records = {}
|
|
130
|
+
# 郵便番号ごとの「閉じていない括弧の数」。0 より大きい間は継続行。
|
|
131
|
+
open_parens = Hash.new(0)
|
|
132
|
+
|
|
133
|
+
# ken_all.csv の文字コードは CP932(Ruby では SJIS が CP932 の別名)。
|
|
134
|
+
CSV.foreach(csv_path, encoding: 'CP932:UTF-8') do |row|
|
|
135
|
+
zip = row[2].to_s.strip
|
|
136
|
+
next if zip.empty?
|
|
137
|
+
|
|
138
|
+
raw_town = row[8].to_s
|
|
139
|
+
if open_parens[zip] > 0
|
|
140
|
+
open_parens[zip] += _paren_balance(raw_town)
|
|
141
|
+
next
|
|
85
142
|
end
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
143
|
+
open_parens[zip] = [_paren_balance(raw_town), 0].max
|
|
144
|
+
|
|
145
|
+
record = (records[zip] ||= {
|
|
146
|
+
zip: zip,
|
|
147
|
+
prefecture: row[6].to_s.strip,
|
|
148
|
+
city: row[7].to_s.strip,
|
|
149
|
+
towns: []
|
|
150
|
+
})
|
|
151
|
+
town = _remove_needless_words(raw_town)
|
|
152
|
+
record[:towns] << town if town.present?
|
|
89
153
|
end
|
|
90
|
-
|
|
154
|
+
records
|
|
155
|
+
end
|
|
156
|
+
private_class_method :_read_master_csv
|
|
157
|
+
|
|
158
|
+
def self._paren_balance(text)
|
|
159
|
+
text.count('(') - text.count(')')
|
|
91
160
|
end
|
|
161
|
+
private_class_method :_paren_balance
|
|
92
162
|
|
|
93
163
|
# 引数に渡された地名群から、先頭から見て共通となる地名を返します。
|
|
94
164
|
#
|
|
@@ -98,51 +168,45 @@ module JpAddress
|
|
|
98
168
|
# ]
|
|
99
169
|
#
|
|
100
170
|
# return => 鳴子温泉
|
|
171
|
+
#
|
|
172
|
+
# 共通部分が1文字しかない場合(例:大分/大阪)は、地名として意味を
|
|
173
|
+
# なさないので空文字を返します。ただし短い方の地名がまるごと共通部分に
|
|
174
|
+
# なる場合(例:東中島/東中島本町)は、その地名をそのまま返します。
|
|
101
175
|
def self._find_shared_name_from(names)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
name_length_min = names.map{ |n| n.length }.min
|
|
105
|
-
diff_pos = nil
|
|
106
|
-
chars = []
|
|
107
|
-
|
|
108
|
-
(0..(name_length_min - 1)).each do |pos|
|
|
109
|
-
break if diff_pos.present?
|
|
110
|
-
char = nil
|
|
111
|
-
names.each do |name|
|
|
112
|
-
if char.nil?
|
|
113
|
-
char = name.each_char.to_a[pos]
|
|
114
|
-
chars << char
|
|
115
|
-
elsif char != name.each_char.to_a[pos]
|
|
116
|
-
diff_pos = pos
|
|
117
|
-
break
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
176
|
+
names = Array(names).reject { |name| name.blank? }
|
|
177
|
+
return '' if names.empty?
|
|
121
178
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
179
|
+
shortest = names.min_by { |name| name.length }
|
|
180
|
+
shared_length = 0
|
|
181
|
+
shortest.each_char.with_index do |char, pos|
|
|
182
|
+
break unless names.all? { |name| name[pos] == char }
|
|
183
|
+
|
|
184
|
+
shared_length = pos + 1
|
|
125
185
|
end
|
|
126
186
|
|
|
127
|
-
|
|
187
|
+
return shortest if shared_length == shortest.length
|
|
188
|
+
|
|
189
|
+
shared_length > 1 ? shortest[0, shared_length] : ''
|
|
128
190
|
end
|
|
129
191
|
|
|
130
192
|
def self._clear_table
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
193
|
+
connection_pool.with_connection do |conn|
|
|
194
|
+
begin
|
|
195
|
+
conn.truncate table_name
|
|
196
|
+
rescue NotImplementedError
|
|
197
|
+
conn.delete "delete from #{conn.quote_table_name(table_name)}"
|
|
198
|
+
end
|
|
135
199
|
end
|
|
136
200
|
end
|
|
137
201
|
private_class_method :_clear_table
|
|
138
202
|
|
|
139
203
|
def self._remove_needless_words(base)
|
|
140
|
-
base.sub(/以下に掲載がない場合/, '').sub(/(.*/, '')
|
|
204
|
+
base.to_s.sub(/以下に掲載がない場合/, '').sub(/(.*/, '').strip
|
|
141
205
|
end
|
|
142
206
|
private_class_method :_remove_needless_words
|
|
143
207
|
|
|
144
208
|
def self._remove_csv
|
|
145
|
-
FileUtils.
|
|
209
|
+
FileUtils.rm_f MASTER_CSV_PATH
|
|
146
210
|
end
|
|
147
211
|
private_class_method :_remove_csv
|
|
148
212
|
|
data/config/routes.rb
CHANGED
|
File without changes
|
data/lib/jp_address/engine.rb
CHANGED
|
File without changes
|
data/lib/jp_address/version.rb
CHANGED
data/lib/jp_address.rb
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,113 +1,94 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jp_address
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tad Kam
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: railties
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '7.1'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '9.0'
|
|
20
22
|
type: :runtime
|
|
21
23
|
prerelease: false
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
25
|
requirements:
|
|
24
26
|
- - ">="
|
|
25
27
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
27
|
-
-
|
|
28
|
-
name: rails
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
28
|
+
version: '7.1'
|
|
29
|
+
- - "<"
|
|
32
30
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
31
|
+
version: '9.0'
|
|
41
32
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
33
|
+
name: activerecord
|
|
43
34
|
requirement: !ruby/object:Gem::Requirement
|
|
44
35
|
requirements:
|
|
45
36
|
- - ">="
|
|
46
37
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
48
|
-
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rspec-rails
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
38
|
+
version: '7.1'
|
|
39
|
+
- - "<"
|
|
60
40
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :
|
|
41
|
+
version: '9.0'
|
|
42
|
+
type: :runtime
|
|
63
43
|
prerelease: false
|
|
64
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
45
|
requirements:
|
|
66
46
|
- - ">="
|
|
67
47
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
69
|
-
-
|
|
70
|
-
name: factory_bot_rails
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
48
|
+
version: '7.1'
|
|
49
|
+
- - "<"
|
|
74
50
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
51
|
+
version: '9.0'
|
|
83
52
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
53
|
+
name: rubyzip
|
|
85
54
|
requirement: !ruby/object:Gem::Requirement
|
|
86
55
|
requirements:
|
|
87
56
|
- - ">="
|
|
88
57
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
90
|
-
|
|
58
|
+
version: '2.3'
|
|
59
|
+
- - "<"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '4.0'
|
|
62
|
+
type: :runtime
|
|
91
63
|
prerelease: false
|
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
65
|
requirements:
|
|
94
66
|
- - ">="
|
|
95
67
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
68
|
+
version: '2.3'
|
|
69
|
+
- - "<"
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '4.0'
|
|
97
72
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
73
|
+
name: csv
|
|
99
74
|
requirement: !ruby/object:Gem::Requirement
|
|
100
75
|
requirements:
|
|
101
76
|
- - ">="
|
|
102
77
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '0'
|
|
104
|
-
|
|
78
|
+
version: '3.0'
|
|
79
|
+
- - "<"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '4.0'
|
|
82
|
+
type: :runtime
|
|
105
83
|
prerelease: false
|
|
106
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
85
|
requirements:
|
|
108
86
|
- - ">="
|
|
109
87
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '0'
|
|
88
|
+
version: '3.0'
|
|
89
|
+
- - "<"
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '4.0'
|
|
111
92
|
description: JpAddress is simple japan-zipcode-address-search API. You can load master-data
|
|
112
93
|
from JapanPost and mount address-search-api to your rails application.
|
|
113
94
|
email:
|
|
@@ -116,72 +97,28 @@ executables: []
|
|
|
116
97
|
extensions: []
|
|
117
98
|
extra_rdoc_files: []
|
|
118
99
|
files:
|
|
100
|
+
- CHANGELOG.md
|
|
119
101
|
- MIT-LICENSE
|
|
120
102
|
- README.md
|
|
121
103
|
- Rakefile
|
|
122
|
-
- app/assets/javascripts/jp_address/application.js
|
|
123
|
-
- app/assets/stylesheets/jp_address/application.css
|
|
124
104
|
- app/controllers/jp_address/application_controller.rb
|
|
125
105
|
- app/controllers/jp_address/zipcodes_controller.rb
|
|
126
|
-
- app/
|
|
106
|
+
- app/models/jp_address/application_record.rb
|
|
127
107
|
- app/models/jp_address/zipcode.rb
|
|
128
|
-
- app/views/layouts/jp_address/application.html.erb
|
|
129
108
|
- config/routes.rb
|
|
130
109
|
- db/migrate/20160312045953_create_jp_address_zipcodes.rb
|
|
131
110
|
- lib/jp_address.rb
|
|
132
111
|
- lib/jp_address/engine.rb
|
|
133
112
|
- lib/jp_address/version.rb
|
|
134
113
|
- lib/tasks/jp_address_tasks.rake
|
|
135
|
-
- spec/controllers/jp_address/zipcodes_controller_spec.rb
|
|
136
|
-
- spec/dummy/README.rdoc
|
|
137
|
-
- spec/dummy/Rakefile
|
|
138
|
-
- spec/dummy/app/assets/config/manifest.js
|
|
139
|
-
- spec/dummy/app/assets/javascripts/application.js
|
|
140
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
|
141
|
-
- spec/dummy/app/controllers/application_controller.rb
|
|
142
|
-
- spec/dummy/app/helpers/application_helper.rb
|
|
143
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
|
144
|
-
- spec/dummy/bin/bundle
|
|
145
|
-
- spec/dummy/bin/rails
|
|
146
|
-
- spec/dummy/bin/rake
|
|
147
|
-
- spec/dummy/bin/setup
|
|
148
|
-
- spec/dummy/config.ru
|
|
149
|
-
- spec/dummy/config/application.rb
|
|
150
|
-
- spec/dummy/config/boot.rb
|
|
151
|
-
- spec/dummy/config/database.yml
|
|
152
|
-
- spec/dummy/config/environment.rb
|
|
153
|
-
- spec/dummy/config/environments/development.rb
|
|
154
|
-
- spec/dummy/config/environments/production.rb
|
|
155
|
-
- spec/dummy/config/environments/test.rb
|
|
156
|
-
- spec/dummy/config/initializers/assets.rb
|
|
157
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
158
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
|
159
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
160
|
-
- spec/dummy/config/initializers/inflections.rb
|
|
161
|
-
- spec/dummy/config/initializers/mime_types.rb
|
|
162
|
-
- spec/dummy/config/initializers/session_store.rb
|
|
163
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
|
164
|
-
- spec/dummy/config/locales/en.yml
|
|
165
|
-
- spec/dummy/config/routes.rb
|
|
166
|
-
- spec/dummy/config/secrets.yml
|
|
167
|
-
- spec/dummy/db/schema.rb
|
|
168
|
-
- spec/dummy/db/test.sqlite3
|
|
169
|
-
- spec/dummy/log/test.log
|
|
170
|
-
- spec/dummy/public/404.html
|
|
171
|
-
- spec/dummy/public/422.html
|
|
172
|
-
- spec/dummy/public/500.html
|
|
173
|
-
- spec/dummy/public/favicon.ico
|
|
174
|
-
- spec/factories/jp_address_zipcodes.rb
|
|
175
|
-
- spec/models/jp_address/zipcode_spec.rb
|
|
176
|
-
- spec/rails_helper.rb
|
|
177
|
-
- spec/spec_helper.rb
|
|
178
|
-
- spec/support/files/sample_ken.csv
|
|
179
|
-
- spec/vcr/download_master_file_from_japanpost.yml
|
|
180
114
|
homepage: https://github.com/densya203/jp_address
|
|
181
115
|
licenses:
|
|
182
116
|
- MIT
|
|
183
|
-
metadata:
|
|
184
|
-
|
|
117
|
+
metadata:
|
|
118
|
+
homepage_uri: https://github.com/densya203/jp_address
|
|
119
|
+
source_code_uri: https://github.com/densya203/jp_address/tree/v2.0.0
|
|
120
|
+
bug_tracker_uri: https://github.com/densya203/jp_address/issues
|
|
121
|
+
changelog_uri: https://github.com/densya203/jp_address/blob/master/CHANGELOG.md
|
|
185
122
|
rdoc_options: []
|
|
186
123
|
require_paths:
|
|
187
124
|
- lib
|
|
@@ -189,60 +126,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
189
126
|
requirements:
|
|
190
127
|
- - ">="
|
|
191
128
|
- !ruby/object:Gem::Version
|
|
192
|
-
version:
|
|
129
|
+
version: 3.1.0
|
|
193
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
131
|
requirements:
|
|
195
132
|
- - ">="
|
|
196
133
|
- !ruby/object:Gem::Version
|
|
197
134
|
version: '0'
|
|
198
135
|
requirements: []
|
|
199
|
-
rubygems_version: 3.
|
|
200
|
-
signing_key:
|
|
136
|
+
rubygems_version: 3.6.9
|
|
201
137
|
specification_version: 4
|
|
202
138
|
summary: Simple japan-zipcode-addresses API
|
|
203
|
-
test_files:
|
|
204
|
-
- spec/controllers/jp_address/zipcodes_controller_spec.rb
|
|
205
|
-
- spec/dummy/README.rdoc
|
|
206
|
-
- spec/dummy/Rakefile
|
|
207
|
-
- spec/dummy/app/assets/config/manifest.js
|
|
208
|
-
- spec/dummy/app/assets/javascripts/application.js
|
|
209
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
|
210
|
-
- spec/dummy/app/controllers/application_controller.rb
|
|
211
|
-
- spec/dummy/app/helpers/application_helper.rb
|
|
212
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
|
213
|
-
- spec/dummy/bin/bundle
|
|
214
|
-
- spec/dummy/bin/rails
|
|
215
|
-
- spec/dummy/bin/rake
|
|
216
|
-
- spec/dummy/bin/setup
|
|
217
|
-
- spec/dummy/config/application.rb
|
|
218
|
-
- spec/dummy/config/boot.rb
|
|
219
|
-
- spec/dummy/config/database.yml
|
|
220
|
-
- spec/dummy/config/environment.rb
|
|
221
|
-
- spec/dummy/config/environments/development.rb
|
|
222
|
-
- spec/dummy/config/environments/production.rb
|
|
223
|
-
- spec/dummy/config/environments/test.rb
|
|
224
|
-
- spec/dummy/config/initializers/assets.rb
|
|
225
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
226
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
|
227
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
228
|
-
- spec/dummy/config/initializers/inflections.rb
|
|
229
|
-
- spec/dummy/config/initializers/mime_types.rb
|
|
230
|
-
- spec/dummy/config/initializers/session_store.rb
|
|
231
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
|
232
|
-
- spec/dummy/config/locales/en.yml
|
|
233
|
-
- spec/dummy/config/routes.rb
|
|
234
|
-
- spec/dummy/config/secrets.yml
|
|
235
|
-
- spec/dummy/config.ru
|
|
236
|
-
- spec/dummy/db/schema.rb
|
|
237
|
-
- spec/dummy/db/test.sqlite3
|
|
238
|
-
- spec/dummy/log/test.log
|
|
239
|
-
- spec/dummy/public/404.html
|
|
240
|
-
- spec/dummy/public/422.html
|
|
241
|
-
- spec/dummy/public/500.html
|
|
242
|
-
- spec/dummy/public/favicon.ico
|
|
243
|
-
- spec/factories/jp_address_zipcodes.rb
|
|
244
|
-
- spec/models/jp_address/zipcode_spec.rb
|
|
245
|
-
- spec/rails_helper.rb
|
|
246
|
-
- spec/spec_helper.rb
|
|
247
|
-
- spec/support/files/sample_ken.csv
|
|
248
|
-
- spec/vcr/download_master_file_from_japanpost.yml
|
|
139
|
+
test_files: []
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
-
// listed below.
|
|
3
|
-
//
|
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
-
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
-
//
|
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
-
// compiled file.
|
|
9
|
-
//
|
|
10
|
-
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
-
// about supported directives.
|
|
12
|
-
//
|
|
13
|
-
//= require_tree .
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
-
* listed below.
|
|
4
|
-
*
|
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
-
*
|
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
11
|
-
* file per style scope.
|
|
12
|
-
*
|
|
13
|
-
*= require_tree .
|
|
14
|
-
*= require_self
|
|
15
|
-
*/
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>JpAddress</title>
|
|
5
|
-
<%= stylesheet_link_tag "jp_address/application", media: "all" %>
|
|
6
|
-
<%= javascript_include_tag "jp_address/application" %>
|
|
7
|
-
<%= csrf_meta_tags %>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
|
|
11
|
-
<%= yield %>
|
|
12
|
-
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|