london-bike-hire-cli 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +35 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +14 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +11 -0
  8. data/LICENSE +21 -0
  9. data/README.md +144 -0
  10. data/Rakefile +19 -0
  11. data/bin/lbh +5 -0
  12. data/boris-on-a-bike_med.jpg +0 -0
  13. data/lib/london_bike_hire_cli.rb +15 -0
  14. data/lib/london_bike_hire_cli/application.rb +71 -0
  15. data/lib/london_bike_hire_cli/basic_renderer.rb +38 -0
  16. data/lib/london_bike_hire_cli/controller.rb +82 -0
  17. data/lib/london_bike_hire_cli/feed_parser.rb +76 -0
  18. data/lib/london_bike_hire_cli/geocoding_adapter.rb +27 -0
  19. data/lib/london_bike_hire_cli/query_response.rb +22 -0
  20. data/lib/london_bike_hire_cli/spatial_search.rb +20 -0
  21. data/lib/london_bike_hire_cli/station.rb +16 -0
  22. data/lib/london_bike_hire_cli/station_adapter.rb +19 -0
  23. data/lib/london_bike_hire_cli/station_repository.rb +51 -0
  24. data/lib/london_bike_hire_cli/version.rb +3 -0
  25. data/london-bike-hire-cli.gemspec +37 -0
  26. data/spec/controller_spec.rb +186 -0
  27. data/spec/feed_parser_spec.rb +42 -0
  28. data/spec/fixtures/feed_xml.yml +822 -0
  29. data/spec/fixtures/n19ae_geocode.yml +114 -0
  30. data/spec/fixtures/no_results_geocode.yml +50 -0
  31. data/spec/geocoding_adapter_spec.rb +47 -0
  32. data/spec/spatial_search_spec.rb +27 -0
  33. data/spec/spec_helper.rb +83 -0
  34. data/spec/station_adapter_spec.rb +29 -0
  35. data/spec/station_respository_spec.rb +117 -0
  36. data/spec/station_spec.rb +28 -0
  37. data/spec/support/test_datasource.rb +24 -0
  38. data/spec/support/vcr.rb +7 -0
  39. data/test.rb +6 -0
  40. metadata +307 -0
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LondonBikeHireCli::Station do
4
+ let(:params) do
5
+ { id: 1, name: 'test-station-1', docks_total: 30, docks_free: 10, lat: 51.53005939, long: -0.120973687 }
6
+ end
7
+ subject { described_class.new(params) }
8
+
9
+ describe '#map_link' do
10
+ it 'returns a link with lat and long' do
11
+ expect(subject.map_link).to eq('https://www.google.co.uk/maps/preview/@51.53005939,-0.120973687,17z')
12
+ end
13
+ end
14
+
15
+ describe '#position' do
16
+ it 'returns a hash' do
17
+ expect(subject.position).to be_instance_of(Hash)
18
+ end
19
+
20
+ it 'contains latitude value' do
21
+ expect(subject.position[:lat]).to eq(params[:lat])
22
+ end
23
+
24
+ it 'contains longitude value' do
25
+ expect(subject.position[:long]).to eq(params[:long])
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ class TestDatasource
2
+ def fetch
3
+ {
4
+ 1 => TestStation.new(
5
+ id: 1,
6
+ name: 'test-station-1',
7
+ docks_total: 30,
8
+ docks_free: 10,
9
+ lat: 51.53005939,
10
+ long: -0.120973687
11
+ ),
12
+ 2 => TestStation.new(
13
+ id: 2,
14
+ name: 'test-station-2',
15
+ docks_total: 30,
16
+ docks_free: 20,
17
+ lat: 51.50810309,
18
+ long: -0.12602103
19
+ )
20
+ }
21
+ end
22
+
23
+ TestStation = OpenStruct
24
+ end
@@ -0,0 +1,7 @@
1
+ require 'vcr'
2
+
3
+ VCR.configure do |c|
4
+ c.cassette_library_dir = 'spec/fixtures'
5
+ c.hook_into :webmock # or :fakeweb
6
+ c.configure_rspec_metadata!
7
+ end
data/test.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup
4
+ require 'london_bike_hire_cli'
5
+
6
+ LondonBikeHireCli::Application.new.run
metadata ADDED
@@ -0,0 +1,307 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: london-bike-hire-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Rob Murray
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !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'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: pry-byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '4.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '4.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: vcr
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.9'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.9'
125
+ - !ruby/object:Gem::Dependency
126
+ name: webmock
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: coveralls
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.7'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.7'
153
+ - !ruby/object:Gem::Dependency
154
+ name: codeclimate-test-reporter
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: commander
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '4.2'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '4.2'
181
+ - !ruby/object:Gem::Dependency
182
+ name: nokogiri
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.6'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.6'
195
+ - !ruby/object:Gem::Dependency
196
+ name: kdtree
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '0.3'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '0.3'
209
+ - !ruby/object:Gem::Dependency
210
+ name: geocoder
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '1.2'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '1.2'
223
+ description: Find information about London's Bike Hire stations from command line
224
+ interface.
225
+ email:
226
+ - robmurray17@gmail.com
227
+ executables:
228
+ - lbh
229
+ extensions: []
230
+ extra_rdoc_files: []
231
+ files:
232
+ - ".gitignore"
233
+ - ".rspec"
234
+ - ".ruby-version"
235
+ - ".travis.yml"
236
+ - Gemfile
237
+ - Guardfile
238
+ - LICENSE
239
+ - README.md
240
+ - Rakefile
241
+ - bin/lbh
242
+ - boris-on-a-bike_med.jpg
243
+ - lib/london_bike_hire_cli.rb
244
+ - lib/london_bike_hire_cli/application.rb
245
+ - lib/london_bike_hire_cli/basic_renderer.rb
246
+ - lib/london_bike_hire_cli/controller.rb
247
+ - lib/london_bike_hire_cli/feed_parser.rb
248
+ - lib/london_bike_hire_cli/geocoding_adapter.rb
249
+ - lib/london_bike_hire_cli/query_response.rb
250
+ - lib/london_bike_hire_cli/spatial_search.rb
251
+ - lib/london_bike_hire_cli/station.rb
252
+ - lib/london_bike_hire_cli/station_adapter.rb
253
+ - lib/london_bike_hire_cli/station_repository.rb
254
+ - lib/london_bike_hire_cli/version.rb
255
+ - london-bike-hire-cli.gemspec
256
+ - spec/controller_spec.rb
257
+ - spec/feed_parser_spec.rb
258
+ - spec/fixtures/feed_xml.yml
259
+ - spec/fixtures/n19ae_geocode.yml
260
+ - spec/fixtures/no_results_geocode.yml
261
+ - spec/geocoding_adapter_spec.rb
262
+ - spec/spatial_search_spec.rb
263
+ - spec/spec_helper.rb
264
+ - spec/station_adapter_spec.rb
265
+ - spec/station_respository_spec.rb
266
+ - spec/station_spec.rb
267
+ - spec/support/test_datasource.rb
268
+ - spec/support/vcr.rb
269
+ - test.rb
270
+ homepage: https://github.com/rob-murray/london-bike-hire-cli
271
+ licenses:
272
+ - MIT
273
+ metadata: {}
274
+ post_install_message:
275
+ rdoc_options: []
276
+ require_paths:
277
+ - lib
278
+ required_ruby_version: !ruby/object:Gem::Requirement
279
+ requirements:
280
+ - - ">="
281
+ - !ruby/object:Gem::Version
282
+ version: '0'
283
+ required_rubygems_version: !ruby/object:Gem::Requirement
284
+ requirements:
285
+ - - ">="
286
+ - !ruby/object:Gem::Version
287
+ version: '0'
288
+ requirements: []
289
+ rubyforge_project:
290
+ rubygems_version: 2.2.2
291
+ signing_key:
292
+ specification_version: 4
293
+ summary: A command line interface to London's Bike Hire API.
294
+ test_files:
295
+ - spec/controller_spec.rb
296
+ - spec/feed_parser_spec.rb
297
+ - spec/fixtures/feed_xml.yml
298
+ - spec/fixtures/n19ae_geocode.yml
299
+ - spec/fixtures/no_results_geocode.yml
300
+ - spec/geocoding_adapter_spec.rb
301
+ - spec/spatial_search_spec.rb
302
+ - spec/spec_helper.rb
303
+ - spec/station_adapter_spec.rb
304
+ - spec/station_respository_spec.rb
305
+ - spec/station_spec.rb
306
+ - spec/support/test_datasource.rb
307
+ - spec/support/vcr.rb