japan_etc 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22db8dd9544a0198cc5f4211ae88aa8d9140d83778b1baaf62553ca928ce8fd6
4
- data.tar.gz: af895269203cb61d4136ab83490539e5b49cdce6ca762ad2ad0b2619e5fdd0bf
3
+ metadata.gz: '08dcdc5e178336420d591d0880cc317385db8ae3cc83d58d40ae3ecdea9faf87'
4
+ data.tar.gz: f877c7e627a6693a4b6139701c2e8c604d9c2bbf17cfe116f55544af93ce5961
5
5
  SHA512:
6
- metadata.gz: 8f9cbb5fb6e487437e8dc0826286e4c4219b85ee265f070894e08fdccc90624e1320733526515b283405e68524fe3fdfd6ab3b945e4114f68732a1416c8ca2e2
7
- data.tar.gz: 8ba088db287d39b9d7320232008a71a1dc85818e6cfcf663b51cae217298082fe9e64255da114245ca65b3d62d5dcd3e740c8e43a5a4d4a291630d0274b2874b
6
+ metadata.gz: ff28ca5b24a1e6d3a5b6c1dd0ce1a2d6aa7418721f0da005cedebe40ae83471d04111af704bfc3085fdeb1eb64d85ce2c4ea42b31b5b297c065d0dbad61ee0db
7
+ data.tar.gz: 124b66e12f5a5b4f15944de452b61b708747841b7b8b0504f0e744892815e9a0b60f7a88a894986038de97fb506e1f06c08baf3d395eb53d64e676c7da9c792f
@@ -858,6 +858,131 @@ tollbooth_id,road_name,route_name,tollbooth_name,direction,entrance_or_exit,note
858
858
  13-668,阪神高速道路,8号京都線,山科,,入口,
859
859
  13-681,阪神高速道路,8号京都線,巨椋池・阪高割引,,,割引案内用FF
860
860
  13-687,阪神高速道路,8号京都線,鴨川東,,出口,
861
+ 41-101,名古屋高速道路,都心環状線,東新町,,,
862
+ 41-141,名古屋高速道路,都心環状線,東新町,,出口,
863
+ 41-103,名古屋高速道路,都心環状線,東別院,,,
864
+ 41-143,名古屋高速道路,都心環状線,東別院,,出口,
865
+ 41-104,名古屋高速道路,都心環状線,名駅,,,
866
+ 41-144,名古屋高速道路,都心環状線,錦橋,,出口,
867
+ 41-105,名古屋高速道路,都心環状線,丸の内,,,
868
+ 41-145,名古屋高速道路,都心環状線,丸の内,,出口,
869
+ 41-611,名古屋高速道路,1号楠線,楠,,,
870
+ 41-612,名古屋高速道路,1号楠線,楠,,,
871
+ 41-613,名古屋高速道路,1号楠線,楠,,入口,
872
+ 41-642,名古屋高速道路,1号楠線,楠,,出口,
873
+ 41-643,名古屋高速道路,1号楠線,楠JCT,,,
874
+ 41-644,名古屋高速道路,1号楠線,楠JCT,,,
875
+ 41-671,名古屋高速道路,1号楠線,楠JCT,,,
876
+ 41-660,名古屋高速道路,1号楠線,楠JCT,,,
877
+ 41-670,名古屋高速道路,1号楠線,楠JCT,,,
878
+ 41-602,名古屋高速道路,1号楠線,黒川,,,
879
+ 41-641,名古屋高速道路,1号楠線,黒川,,出口,
880
+ 41-649,名古屋高速道路,1号楠線,黒川北,,入口,
881
+ 41-659,名古屋高速道路,1号楠線,黒川南,,出口,
882
+ 41-601,名古屋高速道路,1号楠線,東片端,,,
883
+ 41-811,名古屋高速道路,2号東山線,白川,,,
884
+ 41-841,名古屋高速道路,2号東山線,白川,,出口,
885
+ 41-711,名古屋高速道路,2号東山線,吹上東,,,
886
+ 41-741,名古屋高速道路,2号東山線,吹上東,,出口,
887
+ 41-701,名古屋高速道路,2号東山線,吹上西,,,
888
+ 41-751,名古屋高速道路,2号東山線,吹上西,,出口,
889
+ 41-712,名古屋高速道路,2号東山線,四谷,,,
890
+ 41-742,名古屋高速道路,2号東山線,四谷,,出口,
891
+ 41-702,名古屋高速道路,2号東山線,春岡,,,
892
+ 41-752,名古屋高速道路,2号東山線,春岡,,出口,
893
+ 41-753,名古屋高速道路,2号東山線,高針,,入口,
894
+ 41-713,名古屋高速道路,2号東山線,高針,,,
895
+ 41-743,名古屋高速道路,2号東山線,高針,,出口,
896
+ 41-744,名古屋高速道路,2号東山線,高針JCT,,,
897
+ 41-201,名古屋高速道路,3号大高線,高辻,,,
898
+ 41-251,名古屋高速道路,3号大高線,高辻,,出口,
899
+ 41-211,名古屋高速道路,3号大高線,堀田,,,
900
+ 41-241,名古屋高速道路,3号大高線,堀田,,出口,
901
+ 41-202,名古屋高速道路,3号大高線,呼続,,,
902
+ 41-252,名古屋高速道路,3号大高線,呼続,,出口,
903
+ 41-212,名古屋高速道路,3号大高線,笠寺,,,
904
+ 41-242,名古屋高速道路,3号大高線,笠寺,,出口,
905
+ 41-213,名古屋高速道路,3号大高線,星崎,,,
906
+ 41-214,名古屋高速道路,3号大高線,星崎,,,
907
+ 41-253,名古屋高速道路,3号大高線,星崎,,入口,
908
+ 41-254,名古屋高速道路,3号大高線,大高,,入口,
909
+ 41-256,名古屋高速道路,3号大高線,名四連絡路,,入口,
910
+ 41-244,名古屋高速道路,3号大高線,大高,,出口,
911
+ 41-246,名古屋高速道路,3号大高線,名四連絡路,,出口,
912
+ 41-247,名古屋高速道路,3号大高線,名古屋南JCT,,,
913
+ 41-248,名古屋高速道路,3号大高線,名古屋南JCT,,,
914
+ 41-301,名古屋高速道路,4号東海線,山王,,,
915
+ 41-351,名古屋高速道路,4号東海線,尾頭橋,,出口,
916
+ 41-311,名古屋高速道路,4号東海線,六番北,,,
917
+ 41-341,名古屋高速道路,4号東海線,六番北,,出口,
918
+ 41-302,名古屋高速道路,4号東海線,六番南,,,
919
+ 41-352,名古屋高速道路,4号東海線,六番南,,出口,
920
+ 41-312,名古屋高速道路,4号東海線,港明,,,
921
+ 41-342,名古屋高速道路,4号東海線,港明,,出口,
922
+ 41-303,名古屋高速道路,4号東海線,木場,,,
923
+ 41-353,名古屋高速道路,4号東海線,木場,,出口,
924
+ 41-313,名古屋高速道路,4号東海線,船見,,,
925
+ 41-343,名古屋高速道路,4号東海線,船見,,出口,
926
+ 41-314,名古屋高速道路,4号東海線,東海新宝,,,
927
+ 41-344,名古屋高速道路,4号東海線,東海新宝,,出口,
928
+ 41-315,名古屋高速道路,4号東海線,東海,,,
929
+ 06-198,名古屋高速道路,4号東海線,東海合併,,,
930
+ 41-345,名古屋高速道路,4号東海線,東海,,出口,
931
+ 41-356,名古屋高速道路,4号東海線,東海湾岸,,入口,
932
+ 41-346,名古屋高速道路,4号東海線,東海JCT,,,
933
+ 41-347,名古屋高速道路,4号東海線,東海JCT,,,
934
+ 41-413,名古屋高速道路,5号万場線,千音寺,,,
935
+ 41-414,名古屋高速道路,5号万場線,千音寺,,,
936
+ 41-453,名古屋高速道路,5号万場線,千音寺,,入口,
937
+ 41-443,名古屋高速道路,5号万場線,千音寺,,出口,
938
+ 41-444,名古屋高速道路,5号万場線,名古屋西JCT,,,
939
+ 41-445,名古屋高速道路,5号万場線,名古屋西JCT,,,
940
+ 41-402,名古屋高速道路,5号万場線,烏森,,,
941
+ 41-451,名古屋高速道路,5号万場線,烏森,,出口,
942
+ 41-411,名古屋高速道路,5号万場線,黄金,,,
943
+ 41-441,名古屋高速道路,5号万場線,黄金,,出口,
944
+ 41-501,名古屋高速道路,6号清須線,明道町,,,
945
+ 41-551,名古屋高速道路,6号清須線,明道町,,出口,
946
+ 41-502,名古屋高速道路,6号清須線,鳥見町,,,
947
+ 41-552,名古屋高速道路,6号清須線,鳥見町,,出口,
948
+ 41-511,名古屋高速道路,6号清須線,庄内通,,,
949
+ 41-541,名古屋高速道路,6号清須線,庄内通,,出口,
950
+ 41-553,名古屋高速道路,6号清須線,清須,,入口,
951
+ 41-512,名古屋高速道路,6号清須線,清須,,,
952
+ 41-542,名古屋高速道路,6号清須線,清須,,出口,
953
+ 41-544,名古屋高速道路,6号清須線,清洲JCT,,,
954
+ 41-571,名古屋高速道路,6号清須線,清洲JCT,,,
955
+ 41-560,名古屋高速道路,6号清須線,清洲JCT,,,
956
+ 41-570,名古屋高速道路,6号清須線,清洲JCT,,,
957
+ 41-621,名古屋高速道路,11号小牧線,豊山南,,出口,
958
+ 41-631,名古屋高速道路,11号小牧線,豊山南,,,
959
+ 41-623,名古屋高速道路,11号小牧線,大山川,,,
960
+ 41-624,名古屋高速道路,11号小牧線,豊山北,,,
961
+ 41-673,名古屋高速道路,11号小牧線,豊山北,,出口,
962
+ 41-625,名古屋高速道路,11号小牧線,堀の内,,,
963
+ 41-674,名古屋高速道路,11号小牧線,堀の内,,出口,
964
+ 41-632,名古屋高速道路,11号小牧線,小牧南,,,
965
+ 41-662,名古屋高速道路,11号小牧線,小牧南,,出口,
966
+ 41-633,名古屋高速道路,11号小牧線,小牧,,,
967
+ 41-664,名古屋高速道路,11号小牧線,小牧IC,,出口,
968
+ 41-634,名古屋高速道路,11号小牧線,小牧北,,,
969
+ 41-663,名古屋高速道路,11号小牧線,小牧北,,出口,
970
+ 41-562,名古屋高速道路,16号一宮線,春日,,入口,
971
+ 41-572,名古屋高速道路,16号一宮線,春日,,出口,
972
+ 41-521,名古屋高速道路,16号一宮線,西春,,出口,
973
+ 41-522,名古屋高速道路,16号一宮線,一宮南,,出口,
974
+ 41-523,名古屋高速道路,16号一宮線,一宮合併,,,
975
+ 41-564,名古屋高速道路,16号一宮線,一宮IC,,出口,
976
+ 41-524,名古屋高速道路,16号一宮線,一宮東,,出口,
977
+ 41-563,名古屋高速道路,16号一宮線,一宮西春,,入口,
978
+ 41-573,名古屋高速道路,16号一宮線,一宮西春,,出口,
979
+ 41-531,名古屋高速道路,16号一宮線,西春,,,
980
+ 01-223,名古屋高速道路,16号一宮線,一宮合併,,,
981
+ 41-574,名古屋高速道路,16号一宮線,一宮IC,,入口,
982
+ 41-533,名古屋高速道路,16号一宮線,一宮東,,,
983
+ 41-534,名古屋高速道路,16号一宮線,一宮中,,,
984
+ 41-997,名古屋高速道路,その他,フリーフロー,,入口,
985
+ 41-998,名古屋高速道路,その他,フリーフロー,,出口,
861
986
  05-020,道央自動車道,,大沼公園本線,,,
862
987
  05-019,道央自動車道,,森,,,
863
988
  05-018,道央自動車道,,落部,,,
@@ -1393,7 +1518,6 @@ tollbooth_id,road_name,route_name,tollbooth_name,direction,entrance_or_exit,note
1393
1518
  04-464,中部横断自動車道,,富沢本線,,,
1394
1519
  01-201,名神高速道路,,小牧,,,
1395
1520
  01-202,名神高速道路,,一宮,,,
1396
- 01-223,名神高速道路,,一宮合併,,,
1397
1521
  01-203,名神高速道路,,岐阜羽島,,,
1398
1522
  04-847,名神高速道路,,安八スマート,,,
1399
1523
  01-204,名神高速道路,,大垣,,,
@@ -1533,7 +1657,6 @@ tollbooth_id,road_name,route_name,tollbooth_name,direction,entrance_or_exit,note
1533
1657
  01-174,伊勢湾岸自動車道,,大府,,,第一
1534
1658
  01-175,伊勢湾岸自動車道,,大府,,,第二
1535
1659
  01-176,伊勢湾岸自動車道,,東海,,,第一
1536
- 06-198,伊勢湾岸自動車道,,東海合併,,,
1537
1660
  01-249,伊勢湾岸自動車道,,東海,,,第二
1538
1661
  06-951,伊勢湾岸自動車道,,東海,,,第二
1539
1662
  01-250,伊勢湾岸自動車道,,名港潮見,,,
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ['lib']
26
26
 
27
27
  spec.add_runtime_dependency 'faraday', '~> 0.15'
28
+ spec.add_runtime_dependency 'nokogiri'
28
29
  spec.add_runtime_dependency 'pdf-reader', '~> 2.2'
29
30
  spec.add_runtime_dependency 'spreadsheet', '~> 1.2'
30
31
 
@@ -2,4 +2,5 @@
2
2
 
3
3
  require 'japan_etc/database_provider/metropolitan_expressway'
4
4
  require 'japan_etc/database_provider/hanshin_expressway'
5
+ require 'japan_etc/database_provider/nagoya_expressway'
5
6
  require 'japan_etc/database_provider/central_nexco'
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'japan_etc/database_provider/base'
4
+ require 'japan_etc/tollbooth'
5
+ require 'faraday'
6
+ require 'nokogiri'
7
+
8
+ module JapanETC
9
+ module DatabaseProvider
10
+ # http://www.nagoya-expressway.or.jp/etc/etc-lane.html
11
+ class NagoyaExpressway < Base
12
+ URL = 'http://www.nagoya-expressway.or.jp/etc/etc-lane.html'
13
+
14
+ def fetch_tollbooths
15
+ rows.map do |row|
16
+ begin
17
+ road_number = Integer(row[4])
18
+ tollbooth_number = Integer(row[5])
19
+ rescue ArgumentError, TypeError
20
+ next
21
+ end
22
+
23
+ Tollbooth.create(
24
+ road_number: road_number,
25
+ tollbooth_number: tollbooth_number,
26
+ road_name: '名古屋高速道路',
27
+ route_name: row[0],
28
+ name: row[2]
29
+ )
30
+ end.compact
31
+ end
32
+
33
+ def rows
34
+ raw_rows.each_with_object([]).map do |tr, pending_subsequent_rows|
35
+ current_row = pending_subsequent_rows.shift || Row.new
36
+
37
+ tr.css('td,th').each_with_index do |td, column_index|
38
+ text = td.text.tr(' ', '')
39
+ current_row[column_index] = text
40
+
41
+ next unless td.attr('rowspan')
42
+
43
+ subsequent_row_count = Integer(td.attr('rowspan')) - 1
44
+
45
+ (0...subsequent_row_count).each do |row_index|
46
+ subsequent_row = (pending_subsequent_rows[row_index] ||= Row.new)
47
+ subsequent_row[column_index] = text
48
+ end
49
+ end
50
+
51
+ current_row.to_a
52
+ end
53
+ end
54
+
55
+ def raw_rows
56
+ doc.css('tr')
57
+ end
58
+
59
+ def doc
60
+ response = Faraday.get(URL)
61
+ Nokogiri(response.body)
62
+ end
63
+
64
+ class Row
65
+ def [](index)
66
+ array[index]
67
+ end
68
+
69
+ def []=(index, element)
70
+ index += 1 until array[index].nil?
71
+ array[index] = element
72
+ end
73
+
74
+ def array
75
+ @array ||= []
76
+ end
77
+
78
+ alias to_a array
79
+ end
80
+ end
81
+ end
82
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JapanETC
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: japan_etc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-06 00:00:00.000000000 Z
11
+ date: 2019-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: pdf-reader
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +107,7 @@ files:
93
107
  - lib/japan_etc/database_provider/central_nexco.rb
94
108
  - lib/japan_etc/database_provider/hanshin_expressway.rb
95
109
  - lib/japan_etc/database_provider/metropolitan_expressway.rb
110
+ - lib/japan_etc/database_provider/nagoya_expressway.rb
96
111
  - lib/japan_etc/direction.rb
97
112
  - lib/japan_etc/entrance_or_exit.rb
98
113
  - lib/japan_etc/error.rb