japan_etc 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,7 @@ require 'csv'
6
6
  module JapanETC
7
7
  class Database
8
8
  CSV_HEADER = %i[
9
- road_number
10
- tollbooth_number
9
+ tollbooth_id
11
10
  road_name
12
11
  route_name
13
12
  tollbooth_name
@@ -12,7 +12,7 @@ module JapanETC
12
12
  class CentralNEXCO < Base
13
13
  include Util
14
14
 
15
- URL = 'https://highwaypost.c-nexco.co.jp/faq/etc/use/documents/190423-2etcriyoukanouic.pdf'
15
+ URL = 'https://highwaypost.c-nexco.co.jp/faq/etc/use/documents/etcriyoukanouic.pdf'
16
16
 
17
17
  WHITESPACE = /[\s ]/.freeze
18
18
 
@@ -62,7 +62,7 @@ module JapanETC
62
62
 
63
63
  def to_a
64
64
  [
65
- identifier.to_a,
65
+ identifier.to_s,
66
66
  road.to_a,
67
67
  name,
68
68
  direction,
@@ -161,12 +161,18 @@ module JapanETC
161
161
  def initialize(road_number, tollbooth_number)
162
162
  road_number = convert_to_integer(road_number)
163
163
  raise ValidationError, '#road_number cannot be nil' if road_number.nil?
164
+ raise ValidationError, '#road_number must be lower than 100' if road_number >= 100
164
165
 
165
166
  tollbooth_number = convert_to_integer(tollbooth_number)
166
167
  raise ValidationError, '#tollbooth_number cannot be nil' if tollbooth_number.nil?
168
+ raise ValidationError, '#road_number must be lower than 1000' if tollbooth_number >= 1000
167
169
 
168
170
  super(road_number, tollbooth_number)
169
171
  end
172
+
173
+ def to_s
174
+ format('%02d-%03d', road_number, tollbooth_number)
175
+ end
170
176
  end
171
177
  end
172
178
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JapanETC
4
- VERSION = '0.1.0'
4
+ VERSION = '0.3.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.1.0
4
+ version: 0.3.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-06-10 00:00:00.000000000 Z
11
+ date: 2019-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday