rail_feeds 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +5 -0
- data/FUNDING.yml +10 -0
- data/README.md +4 -15
- data/THANKS.md +3 -0
- data/lib/rail_feeds/credentials.rb +3 -3
- data/lib/rail_feeds/national_rail/http_client.rb +2 -2
- data/lib/rail_feeds/national_rail/knowledge_base/national_service_indicator.rb +2 -2
- data/lib/rail_feeds/network_rail/schedule/association.rb +2 -2
- data/lib/rail_feeds/network_rail/schedule/header/cif.rb +2 -4
- data/lib/rail_feeds/network_rail/schedule/tiploc.rb +2 -0
- data/lib/rail_feeds/network_rail/schedule/train_schedule.rb +4 -2
- data/lib/rail_feeds/network_rail/schedule/train_schedule/change_en_route.rb +2 -0
- data/lib/rail_feeds/network_rail/schedule/train_schedule/location/intermediate.rb +2 -0
- data/lib/rail_feeds/network_rail/schedule/train_schedule/location/origin.rb +2 -0
- data/lib/rail_feeds/network_rail/schedule/train_schedule/location/terminating.rb +2 -0
- data/lib/rail_feeds/version.rb +1 -1
- data/rail_feeds.gemspec +1 -1
- data/spec/rail_feeds/national_rail/http_client_spec.rb +4 -4
- data/spec/rail_feeds/national_rail/knowledge_base/national_service_indicator_spec.rb +2 -2
- data/spec/rail_feeds/network_rail/schedule/parser/cif_spec.rb +9 -1
- data/spec/spec_helper.rb +2 -2
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a1013f3b8ef5f80c4b7948c1879ca1a6643799361bb383275c344b8e0cffe74
|
4
|
+
data.tar.gz: a0ff6b8569bfd1d1460fd471f629c3c72f3d889cf7b5564372198ddebb5c029b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb80002043f3d749e9555aa58ef4f9a7512100c637b87d78f4ed0c075610cc32aad2f63120854d922896f70173358653c4f4b9ccc7fa76d2a6a954c57d23782d
|
7
|
+
data.tar.gz: b9d3d94b01a91822320b2f860e5424c2cb679d0e6379c0585d879d1304c9a9a28d936d7430eb56d0e65190215eee86d29d5f46ea4d6d80ee878af7ee1a6113bd
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -3,15 +3,22 @@ rvm:
|
|
3
3
|
- 2.4.4
|
4
4
|
- 2.4.5
|
5
5
|
- 2.4.6
|
6
|
+
- 2.4.7
|
7
|
+
- 2.4.8
|
6
8
|
- 2.5.0
|
7
9
|
- 2.5.1
|
8
10
|
- 2.5.2
|
9
11
|
- 2.5.3
|
10
12
|
- 2.5.4
|
11
13
|
- 2.5.5
|
14
|
+
- 2.5.6
|
15
|
+
- 2.5.7
|
12
16
|
- 2.6.0
|
13
17
|
- 2.6.1
|
14
18
|
- 2.6.2
|
19
|
+
- 2.6.3
|
20
|
+
- 2.6.4
|
21
|
+
- 2.6.5
|
15
22
|
- jruby-9.2.0.0
|
16
23
|
- jruby-9.2.1.0
|
17
24
|
- jruby-9.2.3.0
|
@@ -27,10 +34,18 @@ branches:
|
|
27
34
|
- staging
|
28
35
|
- /gh(?:\d)+(?:-.+)?/
|
29
36
|
- /dev_ver_\d+\.\d+/
|
37
|
+
env:
|
38
|
+
global:
|
39
|
+
# CC_TEST_REPORTER_ID for reporting test coverage to code climate
|
40
|
+
- secure: "LJDr3rGTkn3gi8Vpvo2LdgvgjfuJHbPD7LIHNfhn+WtjoIXRCBom+CiB8OvStwxHnmK+KkaFK3RJgYSVs7QjgGFquuyVlWnWLU1uJBElZgSHhcgPcenjvzT8GglxR1JBJF322iPblqNDfTaplJw7rNt78dxrJhkCKD8lybwYoE/ops6p510pVsaV44m+N5qcYd8w9WTUhXIr0KZB2bDLAkkZAvdqOrN3qFM/fsnnzzn+EKI3QSxWgfGTzVMlhHPLntsY1DdVvmdK0cDo0jxJ0CbRdkt4XFGfwbSBF2llZ/Mbw7AOm0Ej7xT/Ge6hhg9+hOkrgsd4F0pnmQD8mh5ZR1lCQBCA8D8AHJFUv63bG1GoHs77X5fUNet+NQOnCgs7Xmp7YUYEg8ZqSRqw3FWJ7xn/H9K9s3rHZ3cgQXi+L+ZRocSMnVqEe9BupkgKW6jxtu0RS1Do7jXj32wnNOQoXKRxEdEzvXZyp1XLYw4H2SZkfw8ig3KK0wd8qzBUTVvZCluoOYSvd6AMzf3ZBaKE+r/3HI5M5mW0oCQQPWbz6f3fIlMeRUajzwSiabdRPLT/15FD17OygkhKA0OdIHywQJCmGzjf1r86qxpZXxFjr2+ePQRTH+/3Oj3r4Yb8IkhYnA1gNZgxtnaQSDFcjoFmLwHX2Hx8B9lTTV1teTq7xXc="
|
30
41
|
before_install: gem update bundler
|
42
|
+
before_script:
|
43
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && chmod +x ./cc-test-reporter && ./cc-test-reporter before-build
|
31
44
|
script:
|
32
45
|
- bundle exec rubocop
|
33
46
|
- bundle exec rspec
|
47
|
+
after_script:
|
48
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
34
49
|
notifications:
|
35
50
|
slack:
|
36
51
|
on_success: always
|
data/CHANGELOG.md
CHANGED
data/FUNDING.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
2
|
+
patreon: robertgauld
|
3
|
+
open_collective: # Replace with a single Open Collective username
|
4
|
+
ko_fi: # Replace with a single Ko-fi username
|
5
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
6
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
7
|
+
liberapay: # Replace with a single Liberapay username
|
8
|
+
issuehunt: # Replace with a single IssueHunt username
|
9
|
+
otechie: # Replace with a single Otechie username
|
10
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
data/README.md
CHANGED
@@ -1,28 +1,17 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/rail_feeds.png)](http://badge.fury.io/rb/rail_feeds)
|
2
|
-
|
3
|
-
Master branch:
|
4
2
|
[![Build Status](https://secure.travis-ci.org/robertgauld/rail_feeds.png?branch=master)](http://travis-ci.org/robertgauld/rail_feeds)
|
5
3
|
[![Coveralls Status](https://coveralls.io/repos/robertgauld/rail_feeds/badge.png?branch=master)](https://coveralls.io/r/robertgauld/rail_feeds)
|
6
4
|
[![Code Climate](https://codeclimate.com/github/robertgauld/rail_feeds.png?branch=master)](https://codeclimate.com/github/robertgauld/rail_feeds)
|
7
|
-
|
8
|
-
Staging branch:
|
9
|
-
[![Build Status](https://secure.travis-ci.org/robertgauld/rail_feeds.png?branch=staging)](http://travis-ci.org/robertgauld/rail_feeds)
|
10
|
-
[![Coveralls Status](https://coveralls.io/repos/robertgauld/rail_feeds/badge.png?branch=staging)](https://coveralls.io/r/robertgauld/rail_feeds)
|
11
|
-
|
12
|
-
|
13
|
-
## Build State
|
14
|
-
This project uses continuous integration to help ensure that a quality product is delivered.
|
15
|
-
Travis CI monitors two branches (versions) of the code - Master (which is what gets released)
|
16
|
-
and Staging (which is what is currently being developed ready for moving to master).
|
5
|
+
[![security](https://hakiri.io/github/robertgauld/rail_feeds/master.svg)](https://hakiri.io/github/robertgauld/rail_feeds/master)
|
17
6
|
|
18
7
|
|
19
8
|
## Ruby Versions
|
20
9
|
This gem supports the following versions of ruby, it may work on other versions but is not tested against them so don't rely on it.
|
21
10
|
|
22
11
|
* ruby:
|
23
|
-
* 2.4.4 - 2.4.
|
24
|
-
* 2.5.0 - 2.5.
|
25
|
-
* 2.6.0 - 2.6.
|
12
|
+
* 2.4.4 - 2.4.7
|
13
|
+
* 2.5.0 - 2.5.6
|
14
|
+
* 2.6.0 - 2.6.5
|
26
15
|
* jruby:
|
27
16
|
* 9.2.0.0 - 9.2.6.0
|
28
17
|
|
data/THANKS.md
ADDED
@@ -27,9 +27,9 @@ module RailFeeds
|
|
27
27
|
|
28
28
|
# Initialize a new cresential.
|
29
29
|
def initialize(
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
username: self.class.username,
|
31
|
+
password: self.class.password
|
32
|
+
)
|
33
33
|
@username = username.to_s.clone
|
34
34
|
@password = password.to_s.clone
|
35
35
|
end
|
@@ -14,7 +14,7 @@ module RailFeeds
|
|
14
14
|
# @yield contents
|
15
15
|
# @yieldparam [IO] file Either a Tempfile or StringIO.
|
16
16
|
def fetch(path)
|
17
|
-
super "https://
|
17
|
+
super "https://opendata.nationalrail.co.uk/#{path}", 'X-Auth-Token' => auth_token
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
@@ -25,7 +25,7 @@ module RailFeeds
|
|
25
25
|
|
26
26
|
logger.info 'Getting an auth token for national rail.'
|
27
27
|
response = Net::HTTP.post_form(
|
28
|
-
URI('https://
|
28
|
+
URI('https://opendata.nationalrail.co.uk/authenticate'),
|
29
29
|
credentials.to_h
|
30
30
|
)
|
31
31
|
response.value # Raise an exception if not successful
|
@@ -34,7 +34,7 @@ module RailFeeds
|
|
34
34
|
# The path to the file to save the .xml download in.
|
35
35
|
def self.download(file, credentials = Credentials)
|
36
36
|
client = HTTPClient.new(credentials: credentials)
|
37
|
-
client.download '
|
37
|
+
client.download 'api/staticfeeds/4.0/serviceIndicators', file
|
38
38
|
end
|
39
39
|
|
40
40
|
# Fetch the current data.
|
@@ -42,7 +42,7 @@ module RailFeeds
|
|
42
42
|
# @return [IO]
|
43
43
|
def self.fetch(credentials = Credentials, &block)
|
44
44
|
client = HTTPClient.new(credentials: credentials)
|
45
|
-
client.fetch '
|
45
|
+
client.fetch 'api/staticfeeds/4.0/serviceIndicators', &block
|
46
46
|
end
|
47
47
|
|
48
48
|
# Load data from either a .json or .json.gz file.
|
@@ -159,15 +159,14 @@ module RailFeeds
|
|
159
159
|
end
|
160
160
|
|
161
161
|
# rubocop:disable Metrics/AbcSize
|
162
|
+
# rubocop:disable Style/FormatStringToken
|
162
163
|
def to_cif
|
163
164
|
format('%-80.80s', [
|
164
165
|
'AAN',
|
165
166
|
format('%-6.6s', main_train_uid),
|
166
167
|
format('%-6.6s', associated_train_uid),
|
167
|
-
# rubocop:disable Style/FormatStringToken
|
168
168
|
format('%-6.6s', start_date&.strftime('%y%m%d')),
|
169
169
|
format('%-6.6s', end_date&.strftime('%y%m%d')),
|
170
|
-
# rubocop:enable Style/FormatStringToken
|
171
170
|
days_to_cif,
|
172
171
|
format('%-2.2s', category),
|
173
172
|
format('%-1.1s', date_indicator),
|
@@ -179,6 +178,7 @@ module RailFeeds
|
|
179
178
|
].join) + "\n"
|
180
179
|
end
|
181
180
|
# rubocop:enable Metrics/AbcSize
|
181
|
+
# rubocop:enable Style/FormatStringToken
|
182
182
|
|
183
183
|
# rubocop:disable Metrics/MethodLength
|
184
184
|
def to_json(**opts)
|
@@ -70,24 +70,22 @@ module RailFeeds
|
|
70
70
|
end
|
71
71
|
|
72
72
|
# rubocop:disable Metrics/AbcSize
|
73
|
+
# rubocop:disable Style/FormatStringToken
|
73
74
|
def to_cif
|
74
75
|
format('%-80.80s', [
|
75
76
|
'HD',
|
76
77
|
format('%-20.20s', file_identity),
|
77
|
-
# rubocop:disable Style/FormatStringToken
|
78
78
|
format('%-10.10s', extracted_at&.strftime('%d%m%y%H%M')),
|
79
|
-
# rubocop:enable Style/FormatStringToken
|
80
79
|
format('%-7.7s', current_file_reference),
|
81
80
|
format('%-7.7s', previous_file_reference),
|
82
81
|
format('%-1.1s', update_indicator),
|
83
82
|
format('%-1.1s', version),
|
84
|
-
# rubocop:disable Style/FormatStringToken
|
85
83
|
format('%-6.6s', start_date&.strftime('%d%m%y')),
|
86
84
|
format('%-6.6s', end_date&.strftime('%d%m%y'))
|
87
|
-
# rubocop:enable Style/FormatStringToken
|
88
85
|
].join) + "\n"
|
89
86
|
end
|
90
87
|
# rubocop:enable Metrics/AbcSize
|
88
|
+
# rubocop:enable Style/FormatStringToken
|
91
89
|
|
92
90
|
def to_s
|
93
91
|
"File #{file_identity.inspect} (version #{version}) " \
|
@@ -66,6 +66,7 @@ module RailFeeds
|
|
66
66
|
tiploc.dup
|
67
67
|
end
|
68
68
|
|
69
|
+
# rubocop:disable Style/FormatStringToken
|
69
70
|
def to_cif
|
70
71
|
format('%-80.80s', [
|
71
72
|
'TI',
|
@@ -80,6 +81,7 @@ module RailFeeds
|
|
80
81
|
format('%-16.16s', nlc_description)
|
81
82
|
].join) + "\n"
|
82
83
|
end
|
84
|
+
# rubocop:enable Style/FormatStringToken
|
83
85
|
|
84
86
|
def to_json(**opts)
|
85
87
|
{
|
@@ -268,14 +268,13 @@ module RailFeeds
|
|
268
268
|
|
269
269
|
# rubocop:disable Metrics/AbcSize
|
270
270
|
# rubocop:disable Metrics/MethodLength
|
271
|
+
# rubocop:disable Style/FormatStringToken
|
271
272
|
def basic_to_cif
|
272
273
|
format('%-80.80s', [
|
273
274
|
'BSN',
|
274
275
|
format('%-6.6s', uid),
|
275
|
-
# rubocop:disable Style/FormatStringToken
|
276
276
|
format('%-6.6s', start_date&.strftime('%y%m%d')),
|
277
277
|
format('%-6.6s', end_date&.strftime('%y%m%d')),
|
278
|
-
# rubocop:enable Style/FormatStringToken
|
279
278
|
days_to_cif,
|
280
279
|
format('%-1.1s', bank_holiday_running),
|
281
280
|
format('%-1.1s', status),
|
@@ -301,7 +300,9 @@ module RailFeeds
|
|
301
300
|
end
|
302
301
|
# rubocop:enable Metrics/AbcSize
|
303
302
|
# rubocop:enable Metrics/MethodLength
|
303
|
+
# rubocop:enable Style/FormatStringToken
|
304
304
|
|
305
|
+
# rubocop:disable Style/FormatStringToken
|
305
306
|
def extra_to_cif
|
306
307
|
format('%-80.80s', [
|
307
308
|
'BX ',
|
@@ -310,6 +311,7 @@ module RailFeeds
|
|
310
311
|
format('%-1.1s', (applicable_timetable ? 'Y' : 'N'))
|
311
312
|
].join) + "\n"
|
312
313
|
end
|
314
|
+
# rubocop:enable Style/FormatStringToken
|
313
315
|
|
314
316
|
def self.location_from_json(hash)
|
315
317
|
case hash['record_identity']
|
@@ -116,6 +116,7 @@ module RailFeeds
|
|
116
116
|
|
117
117
|
# rubocop:disable Metrics/AbcSize
|
118
118
|
# rubocop:disable Metrics/MethodLength
|
119
|
+
# rubocop:disable Style/FormatStringToken
|
119
120
|
def to_cif
|
120
121
|
format('%-80.80s', [
|
121
122
|
'CR',
|
@@ -143,6 +144,7 @@ module RailFeeds
|
|
143
144
|
end
|
144
145
|
# rubocop:enable Metrics/AbcSize
|
145
146
|
# rubocop:enable Metrics/MethodLength
|
147
|
+
# rubocop:enable Style/FormatStringToken
|
146
148
|
|
147
149
|
def hash
|
148
150
|
"#{tiploc}-#{tiploc_suffix}"
|
@@ -68,6 +68,7 @@ module RailFeeds
|
|
68
68
|
|
69
69
|
# rubocop:disable Metrics/AbcSize
|
70
70
|
# rubocop:disable Metrics/MethodLength
|
71
|
+
# rubocop:disable Style/FormatStringToken
|
71
72
|
def to_cif
|
72
73
|
format('%-80.80s', [
|
73
74
|
'LI',
|
@@ -89,6 +90,7 @@ module RailFeeds
|
|
89
90
|
end
|
90
91
|
# rubocop:enable Metrics/AbcSize
|
91
92
|
# rubocop:enable Metrics/MethodLength
|
93
|
+
# rubocop:enable Style/FormatStringToken
|
92
94
|
|
93
95
|
# rubocop:disable Metrics/MethodLength
|
94
96
|
def to_hash_for_json
|
@@ -51,6 +51,7 @@ module RailFeeds
|
|
51
51
|
# rubocop:enable Metrics/AbcSize
|
52
52
|
|
53
53
|
# rubocop:disable Metrics/AbcSize
|
54
|
+
# rubocop:disable Style/FormatStringToken
|
54
55
|
def to_cif
|
55
56
|
format('%-80.80s', [
|
56
57
|
'LO',
|
@@ -67,6 +68,7 @@ module RailFeeds
|
|
67
68
|
].join) + "\n"
|
68
69
|
end
|
69
70
|
# rubocop:enable Metrics/AbcSize
|
71
|
+
# rubocop:enable Style/FormatStringToken
|
70
72
|
|
71
73
|
def to_hash_for_json
|
72
74
|
{
|
@@ -39,6 +39,7 @@ module RailFeeds
|
|
39
39
|
end
|
40
40
|
# rubocop:enable Metrics/AbcSize
|
41
41
|
|
42
|
+
# rubocop:disable Style/FormatStringToken
|
42
43
|
def to_cif
|
43
44
|
format('%-80.80s', [
|
44
45
|
'LT',
|
@@ -51,6 +52,7 @@ module RailFeeds
|
|
51
52
|
format('%-12.12s', activity)
|
52
53
|
].join) + "\n"
|
53
54
|
end
|
55
|
+
# rubocop:enable Style/FormatStringToken
|
54
56
|
|
55
57
|
def to_hash_for_json
|
56
58
|
{
|
data/lib/rail_feeds/version.rb
CHANGED
data/rail_feeds.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.required_ruby_version = '>= 2.4'
|
22
22
|
gem.required_rubygems_version = '>= 2.6.14'
|
23
23
|
|
24
|
-
gem.add_dependency 'nokogiri', '~> 1.
|
24
|
+
gem.add_dependency 'nokogiri', '~> 1.10', '>= 1.10.4'
|
25
25
|
gem.add_dependency 'stomp', '~> 1.4'
|
26
26
|
|
27
27
|
gem.add_development_dependency 'coveralls', '~> 0.7'
|
@@ -17,13 +17,13 @@ describe RailFeeds::NationalRail::HTTPClient do
|
|
17
17
|
|
18
18
|
it 'It has not been fetched yet' do
|
19
19
|
expect(subject).to receive(:auth_token)
|
20
|
-
expect(URI).to receive(:parse).with('https://
|
20
|
+
expect(URI).to receive(:parse).with('https://opendata.nationalrail.co.uk/path').and_return(uri)
|
21
21
|
subject.fetch('path') {}
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'Token is over an hour old' do
|
25
25
|
expect(subject).to receive(:auth_token).twice
|
26
|
-
expect(URI).to receive(:parse).with('https://
|
26
|
+
expect(URI).to receive(:parse).with('https://opendata.nationalrail.co.uk/path')
|
27
27
|
.and_return(uri).twice
|
28
28
|
subject.fetch('path') {} # Get the auth token
|
29
29
|
Timecop.travel 3601
|
@@ -36,7 +36,7 @@ describe RailFeeds::NationalRail::HTTPClient do
|
|
36
36
|
expect(response).to receive(:value)
|
37
37
|
expect(response).to receive(:body).and_return('{"token":"TOKEN"}')
|
38
38
|
expect(Net::HTTP).to receive(:post_form)
|
39
|
-
.with(URI('https://
|
39
|
+
.with(URI('https://opendata.nationalrail.co.uk/authenticate'), { username: '', password: '' })
|
40
40
|
.and_return(response)
|
41
41
|
expect(subject.send(:auth_token)).to eq 'TOKEN'
|
42
42
|
end
|
@@ -48,7 +48,7 @@ describe RailFeeds::NationalRail::HTTPClient do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'Adds server to path then delegates to super' do
|
51
|
-
expect(URI).to receive(:parse).with('https://
|
51
|
+
expect(URI).to receive(:parse).with('https://opendata.nationalrail.co.uk/path').and_return(uri)
|
52
52
|
expect(uri).to receive(:open)
|
53
53
|
subject.fetch('path') {}
|
54
54
|
end
|
@@ -40,7 +40,7 @@ describe RailFeeds::NationalRail::KnowledgeBase::NationalServiceIndicator do
|
|
40
40
|
expect(RailFeeds::NationalRail::HTTPClient).to receive(:new)
|
41
41
|
.with(credentials: RailFeeds::NationalRail::Credentials).and_return(http_client)
|
42
42
|
expect(http_client).to receive(:download)
|
43
|
-
.with('
|
43
|
+
.with('api/staticfeeds/4.0/serviceIndicators', 'file')
|
44
44
|
described_class.download 'file'
|
45
45
|
end
|
46
46
|
|
@@ -58,7 +58,7 @@ describe RailFeeds::NationalRail::KnowledgeBase::NationalServiceIndicator do
|
|
58
58
|
expect(RailFeeds::NationalRail::HTTPClient).to receive(:new)
|
59
59
|
.with(credentials: RailFeeds::NationalRail::Credentials).and_return(http_client)
|
60
60
|
expect(http_client).to receive(:fetch)
|
61
|
-
.with('
|
61
|
+
.with('api/staticfeeds/4.0/serviceIndicators').and_return(temp_file)
|
62
62
|
expect(described_class.fetch).to eq temp_file
|
63
63
|
end
|
64
64
|
|
@@ -48,6 +48,7 @@ describe RailFeeds::NetworkRail::Schedule::Parser::CIF do
|
|
48
48
|
"AAD 0102030405060101010 P\n"
|
49
49
|
end
|
50
50
|
let(:train_schedule_create_lines) do
|
51
|
+
# rubocop:disable Style/FormatStringToken
|
51
52
|
[
|
52
53
|
format('%-79s', 'BSN 010203040506') + 'P',
|
53
54
|
format('%-80s', 'BX'),
|
@@ -59,8 +60,10 @@ describe RailFeeds::NetworkRail::Schedule::Parser::CIF do
|
|
59
60
|
format('%-80s', 'LO'),
|
60
61
|
format('%-80s', 'LT')
|
61
62
|
].join("\n") + "\n"
|
63
|
+
# rubocop:enable Style/FormatStringToken
|
62
64
|
end
|
63
65
|
let(:train_schedule_update_lines) do
|
66
|
+
# rubocop:disable Style/FormatStringToken
|
64
67
|
[
|
65
68
|
format('%-79s', 'BSR 010203040506') + 'P',
|
66
69
|
format('%-80s', 'BX'),
|
@@ -72,8 +75,13 @@ describe RailFeeds::NetworkRail::Schedule::Parser::CIF do
|
|
72
75
|
format('%-80s', 'LO'),
|
73
76
|
format('%-80s', 'LT')
|
74
77
|
].join("\n") + "\n"
|
78
|
+
# rubocop:enable Style/FormatStringToken
|
79
|
+
end
|
80
|
+
let(:train_schedule_delete_line) do
|
81
|
+
# rubocop:disable Style/FormatStringToken
|
82
|
+
format('%-79.79s', 'BSD 010203040506') + "P\n"
|
83
|
+
# rubocop:enable Style/FormatStringToken
|
75
84
|
end
|
76
|
-
let(:train_schedule_delete_line) { format('%-79.79s', 'BSD 010203040506') + "P\n" }
|
77
85
|
|
78
86
|
let(:smallest_file) { StringIO.new header_line + trailer_line }
|
79
87
|
|
data/spec/spec_helper.rb
CHANGED
@@ -4,13 +4,13 @@ require 'timecop'
|
|
4
4
|
require 'yaml'
|
5
5
|
|
6
6
|
require 'simplecov'
|
7
|
-
SimpleCov.coverage_dir(File.join('tmp', 'coverage'))
|
7
|
+
SimpleCov.coverage_dir(File.join('tmp', 'coverage')) unless ENV.key?('TRAVIS')
|
8
8
|
SimpleCov.start do
|
9
9
|
add_filter 'spec/'
|
10
10
|
end
|
11
11
|
|
12
12
|
require 'coveralls'
|
13
|
-
Coveralls.wear! if ENV
|
13
|
+
Coveralls.wear! if ENV.key?('TRAVIS')
|
14
14
|
|
15
15
|
RSPEC_ROOT = File.dirname __FILE__
|
16
16
|
RSPEC_FIXTURES = File.join RSPEC_ROOT, 'fixtures'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rail_feeds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gauld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.10'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.10.4
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
29
|
+
version: '1.10'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.10.4
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: stomp
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,11 +209,13 @@ files:
|
|
203
209
|
- ".rubocop.yml"
|
204
210
|
- ".travis.yml"
|
205
211
|
- CHANGELOG.md
|
212
|
+
- FUNDING.yml
|
206
213
|
- Gemfile
|
207
214
|
- Guardfile
|
208
215
|
- LICENSE.md
|
209
216
|
- README.md
|
210
217
|
- Rakefile
|
218
|
+
- THANKS.md
|
211
219
|
- doc/guides/Logging.md
|
212
220
|
- doc/guides/National Rail/Knowledge Base/National Service Indicator.md
|
213
221
|
- doc/guides/Network Rail/CORPUS.md
|