london-bike-hire-cli 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +4 -4
- data/README.md +1 -0
- data/bike-cli.gif +0 -0
- data/lib/london_bike_hire_cli/feed_parser.rb +3 -4
- data/lib/london_bike_hire_cli/version.rb +1 -1
- data/spec/fixtures/feed_xml.yml +2 -2
- data/spec/spec_helper.rb +34 -42
- data/spec/station_repo_spec.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64d1ae38527d6deb4803a1f79edf34abc3ca46c5
|
4
|
+
data.tar.gz: 5ab0b656086b1a45516697a112e5d8637ba41752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecafd661f8e5691e0a381d5eb6ae03cd430225328b3e31670949d1617c6129e73d4b4dcbe2a46bbf641f9a355a4d94559e11f485af7ab033b21d3567a2fc4d7f
|
7
|
+
data.tar.gz: d408f0ddf041ac94a334df72cc8beffe485258a9569937d7d8546630a472769ca6bb44dc38907d20e68ae4262e7f67e9282deefc70debc78175b44f34a692bb7
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.3
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -26,6 +26,7 @@ Here's the spec for **London Bike Hire CLI**:
|
|
26
26
|
* [Find by name](#find-all-bike-stations-by-name)
|
27
27
|
* [Display status of stations](#results)
|
28
28
|
|
29
|
+
![Demo commands](bike-cli.gif?raw=true "Some London Bike Hire CLI example commands in terminal")
|
29
30
|
|
30
31
|
### Getting started
|
31
32
|
|
data/bike-cli.gif
ADDED
Binary file
|
@@ -3,7 +3,7 @@ require 'open-uri'
|
|
3
3
|
|
4
4
|
module LondonBikeHireCli
|
5
5
|
class FeedParser
|
6
|
-
TFL_FEED_URL = '
|
6
|
+
TFL_FEED_URL = 'https://tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml'.freeze
|
7
7
|
|
8
8
|
def fetch
|
9
9
|
params = { 'User-Agent' => 'Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0' }
|
@@ -17,11 +17,10 @@ module LondonBikeHireCli
|
|
17
17
|
attr_reader :feed_time
|
18
18
|
|
19
19
|
def parse_xml(xml_doc)
|
20
|
-
stations = []
|
21
20
|
parse_feed_time(xml_doc)
|
22
21
|
|
23
|
-
xml_doc.root.elements.
|
24
|
-
|
22
|
+
stations = xml_doc.root.elements.inject([]) do |collection, node|
|
23
|
+
collection << parse_station(node)
|
25
24
|
end
|
26
25
|
|
27
26
|
QueryResponse.new(last_update: feed_time, results: stations)
|
data/spec/fixtures/feed_xml.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri:
|
5
|
+
uri: https://tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -817,6 +817,6 @@ http_interactions:
|
|
817
817
|
Park, Parsons Green</name><terminalName>300098</terminalName><lat>51.470131</lat><long>-0.20464</long><installed>true</installed><locked>false</locked><installDate>1396265880000</installDate><removalDate></removalDate><temporary>false</temporary><nbBikes>15</nbBikes><nbEmptyDocks>5</nbEmptyDocks><nbDocks>20</nbDocks></station><station><id>775</id><name>Little
|
818
818
|
Brook Green, Brook Green</name><terminalName>300101</terminalName><lat>51.496664</lat><long>-0.223868</long><installed>true</installed><locked>false</locked><installDate>1396270320000</installDate><removalDate></removalDate><temporary>false</temporary><nbBikes>22</nbBikes><nbEmptyDocks>10</nbEmptyDocks><nbDocks>32</nbDocks></station><station><id>777</id><name>Limburg
|
819
819
|
Road, Clapham Common</name><terminalName>300100</terminalName><lat>51.4619230679</lat><long>-0.165297856693</long><installed>true</installed><locked>false</locked><installDate></installDate><removalDate></removalDate><temporary>false</temporary><nbBikes>19</nbBikes><nbEmptyDocks>1</nbEmptyDocks><nbDocks>21</nbDocks></station></stations>\r\n"
|
820
|
-
http_version:
|
820
|
+
http_version:
|
821
821
|
recorded_at: Sun, 10 Aug 2014 09:56:57 GMT
|
822
822
|
recorded_with: VCR 2.9.2
|
data/spec/spec_helper.rb
CHANGED
@@ -7,23 +7,32 @@ Coveralls.wear!
|
|
7
7
|
require File.join(File.dirname(__FILE__), '..', '/lib/', 'london_bike_hire_cli')
|
8
8
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
9
9
|
|
10
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
11
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
12
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
13
|
-
# file to always be loaded, without a need to explicitly require it in any files.
|
14
|
-
#
|
15
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
16
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
17
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
18
|
-
# individual file that may not need all of that loaded. Instead, make a
|
19
|
-
# separate helper file that requires this one and then use it only in the specs
|
20
|
-
# that actually need it.
|
21
|
-
#
|
22
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
23
|
-
# users commonly want.
|
24
10
|
#
|
25
11
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
26
12
|
RSpec.configure do |config|
|
13
|
+
# rspec-expectations config goes here. You can use an alternate
|
14
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
15
|
+
# assertions if you prefer.
|
16
|
+
config.expect_with :rspec do |expectations|
|
17
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
18
|
+
# and `failure_message` of custom matchers include text for helper methods
|
19
|
+
# defined using `chain`, e.g.:
|
20
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
21
|
+
# # => "be bigger than 2 and smaller than 4"
|
22
|
+
# ...rather than:
|
23
|
+
# # => "be bigger than 2"
|
24
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
25
|
+
end
|
26
|
+
|
27
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
28
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
29
|
+
config.mock_with :rspec do |mocks|
|
30
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
31
|
+
# a real object. This is generally recommended, and will default to
|
32
|
+
# `true` in RSpec 4.
|
33
|
+
mocks.verify_partial_doubles = true
|
34
|
+
end
|
35
|
+
|
27
36
|
# These two settings work together to allow you to limit a spec run
|
28
37
|
# to individual examples or groups you care about by tagging them with
|
29
38
|
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
@@ -31,6 +40,17 @@ RSpec.configure do |config|
|
|
31
40
|
config.filter_run :focus
|
32
41
|
config.run_all_when_everything_filtered = true
|
33
42
|
|
43
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
44
|
+
# recommended. For more details, see:
|
45
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
46
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
47
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
48
|
+
config.disable_monkey_patching!
|
49
|
+
|
50
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
51
|
+
# be too noisy due to issues in dependencies.
|
52
|
+
config.warnings = true
|
53
|
+
|
34
54
|
# Many RSpec users commonly either run the entire suite or an individual
|
35
55
|
# file, and it's useful to allow more verbose output when running an
|
36
56
|
# individual spec file.
|
@@ -41,11 +61,6 @@ RSpec.configure do |config|
|
|
41
61
|
config.default_formatter = 'doc'
|
42
62
|
end
|
43
63
|
|
44
|
-
# Print the 10 slowest examples and example groups at the
|
45
|
-
# end of the spec run, to help surface which specs are running
|
46
|
-
# particularly slow.
|
47
|
-
config.profile_examples = 10
|
48
|
-
|
49
64
|
# Run specs in random order to surface order dependencies. If you find an
|
50
65
|
# order dependency and want to debug it, you can fix the order by providing
|
51
66
|
# the seed, which is printed after each run.
|
@@ -57,27 +72,4 @@ RSpec.configure do |config|
|
|
57
72
|
# test failures related to randomization by passing the same `--seed` value
|
58
73
|
# as the one that triggered the failure.
|
59
74
|
Kernel.srand config.seed
|
60
|
-
|
61
|
-
# rspec-expectations config goes here. You can use an alternate
|
62
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
63
|
-
# assertions if you prefer.
|
64
|
-
config.expect_with :rspec do |expectations|
|
65
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
66
|
-
# For more details, see:
|
67
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
68
|
-
expectations.syntax = :expect
|
69
|
-
end
|
70
|
-
|
71
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
72
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
73
|
-
config.mock_with :rspec do |mocks|
|
74
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
75
|
-
# For more details, see:
|
76
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
77
|
-
mocks.syntax = :expect
|
78
|
-
|
79
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
80
|
-
# a real object. This is generally recommended.
|
81
|
-
mocks.verify_partial_doubles = true
|
82
|
-
end
|
83
75
|
end
|
data/spec/station_repo_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: london-bike-hire-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Murray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -238,6 +238,7 @@ files:
|
|
238
238
|
- LICENSE
|
239
239
|
- README.md
|
240
240
|
- Rakefile
|
241
|
+
- bike-cli.gif
|
241
242
|
- bin/lbh
|
242
243
|
- boris-on-a-bike_med.jpg
|
243
244
|
- lib/london_bike_hire_cli.rb
|
@@ -293,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
293
294
|
version: '0'
|
294
295
|
requirements: []
|
295
296
|
rubyforge_project:
|
296
|
-
rubygems_version: 2.4.
|
297
|
+
rubygems_version: 2.4.8
|
297
298
|
signing_key:
|
298
299
|
specification_version: 4
|
299
300
|
summary: A command line interface to London's Bike Hire API.
|