journey_planner 0.0.6 → 0.0.7
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 +4 -4
- data/README.md +24 -3
- data/lib/journey.rb +8 -0
- data/lib/journey_planner/version.rb +1 -1
- data/spec/journey_spec.rb +18 -10
- data/spec/results_spec.rb +4 -5
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51a282441331e412fef3cbffcfed99de9f63fe0b
|
4
|
+
data.tar.gz: 42a5108e049ebf722d04a904ff86deb0c921e713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3a320688af4b416ba283a2f157ec39df814feb3ee585956449595fdeb33344450e8a333baf0d8e01088a6cc7f9bd46ecb54142a6072cd2caf2264a6de08a6ed
|
7
|
+
data.tar.gz: b12769f311da7a5a7f833af05512b2cc154ee54e17784c491100aee989ed8fa36bd2be9a2a7737063ea0f5775ae9a1b7c92d8e19ad3736a09051557d7e64a22d
|
data/README.md
CHANGED
@@ -18,13 +18,34 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install journey_planner
|
20
20
|
|
21
|
-
## Usage
|
21
|
+
## Usage Examples
|
22
|
+
|
23
|
+
```
|
24
|
+
irb
|
25
|
+
```
|
26
|
+
```ruby
|
27
|
+
require 'journey_planner'
|
28
|
+
|
29
|
+
client = TFLJourneyPlanner::Client.new(app_id: your_app_id, app_key: your_app_key)
|
30
|
+
|
31
|
+
journeys = client.get_journeys from: "old street underground station", to: "oxford circus underground station"
|
32
|
+
|
33
|
+
# => returns an array of Journey objects, each representing one of the possible journeys
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
Methods you can play with:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
journeys.first.instructions
|
41
|
+
# => ["Northern line to Euston / Northern line towards Edgware, or High Barnet", "Victoria line to Oxford Circus / Victoria line towards Brixton"]
|
42
|
+
```
|
43
|
+
|
22
44
|
|
23
|
-
TODO: Write usage instructions here
|
24
45
|
|
25
46
|
## Contributing
|
26
47
|
|
27
|
-
1. Fork it ( https://github.com/[my-github-username]/
|
48
|
+
1. Fork it ( https://github.com/[my-github-username]/journey_planner_gem/fork )
|
28
49
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
50
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
51
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/journey.rb
CHANGED
data/spec/journey_spec.rb
CHANGED
@@ -2,10 +2,11 @@ require_relative 'spec_helper'
|
|
2
2
|
|
3
3
|
describe TFLJourneyPlanner::Journey do
|
4
4
|
|
5
|
+
let(:client) {client = TFLJourneyPlanner::Client.new(app_id: ENV["TFL_ID"], app_key: ENV["TFL_KEY"])}
|
6
|
+
let(:journeys) {journeys = client.get_journeys(from: "tw14 9nt", to: "tw14 8ex")}
|
7
|
+
|
5
8
|
it "should return an array of instructions" do
|
6
9
|
VCR.use_cassette "hello", record: :none do
|
7
|
-
client = TFLJourneyPlanner::Client.new(app_id: ENV["TFL_ID"], app_key: ENV["TFL_KEY"])
|
8
|
-
journeys = client.get_journeys(from: "tw14 9nt", to: "tw14 8ex")
|
9
10
|
array = ["Continue along Fruen Road for 143 metres (2 minutes, 8 seconds).",
|
10
11
|
"Turn right on to Bedfont Lane, continue for 172 metres (2 minutes, 33 seconds).",
|
11
12
|
"H25 bus to Bedfont Library / H25 bus towards Hatton Cross",
|
@@ -15,15 +16,22 @@ describe TFLJourneyPlanner::Journey do
|
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
it "should return a map path as an array of coordinates" do
|
20
|
+
VCR.use_cassette "hello", record: :none do
|
21
|
+
expect(journeys[0].map_path).to eq [[51.45151025215, -0.41971520833],[51.45144462064, -0.41951598516],[51.45031573039, -0.4204904277],[51.45054644033, -0.42092861212],[51.45077734235, -0.42138118615],[51.45094358299, -0.42170646688],[51.45129461858, -0.42239957193],[51.45127683589, -0.42241457688], [51.45129461858, -0.42239957193],[51.45148859493,
|
22
|
+
-0.42278147255],[51.45207032325, -0.42391280827],[51.45250417214, -0.42474702056],[51.45324177029,
|
23
|
+
-0.42610332716],[51.45343573478, -0.42648525981],[51.45343573478, -0.42648525981],[51.45368497803,
|
24
|
+
-0.42696604503],[51.45394320749, -0.42744652667],[51.45373007777, -0.42831741733],[51.45367101727,
|
25
|
+
-0.42860730096],[51.45367101727, -0.42860730096],[51.45366241474, -0.42863638187],[51.45346571073,
|
26
|
+
-0.4293915562],[51.45332960733, -0.42997193339],[51.45321911747, -0.43045068035],[51.45311684369,
|
27
|
+
-0.43087157293],[51.45304821115, -0.43111859968],[51.45298875872, -0.4313797036],[51.45298875872,
|
28
|
+
-0.4313797036],[51.45293752411, -0.43158295509],[51.45263967401, -0.43284530436],[51.45252878782,
|
29
|
+
-0.43329526574],[51.45214526251, -0.43487715283],[51.45188230071, -0.43471343855],[51.45214526251,
|
30
|
+
-0.43487715283],[51.451931885, -0.43573359002],[51.45157942641, -0.43560171477],[51.45124052845,
|
31
|
+
-0.43513836205],[51.45120399971, -0.43509643498],[51.451125602, -0.43528621086]]
|
32
|
+
end
|
25
33
|
|
26
|
-
|
34
|
+
end
|
27
35
|
|
28
36
|
|
29
37
|
|
data/spec/results_spec.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
|
-
describe TFLJourneyPlanner::Results, vcr: true do
|
3
|
+
describe TFLJourneyPlanner::Results, vcr: true do
|
4
|
+
|
5
|
+
let(:client) {client = TFLJourneyPlanner::Client.new(app_id: ENV["TFL_ID"], app_key: ENV["TFL_KEY"])}
|
6
|
+
let(:journeys) {journeys = client.get_journeys(from: "tw14 9nt", to: "tw14 8ex")}
|
4
7
|
|
5
8
|
|
6
9
|
it "must work" do
|
7
10
|
VCR.use_cassette "hello", record: :new_episodes do
|
8
|
-
client = TFLJourneyPlanner::Client.new(app_id: ENV["TFL_ID"], app_key: ENV["TFL_KEY"])
|
9
|
-
journeys = client.get_journeys(from: "tw14 9nt", to: "tw14 8ex")
|
10
11
|
expect(journeys[0].start_date_time).to be_a String
|
11
12
|
end
|
12
13
|
end
|
@@ -14,8 +15,6 @@ describe TFLJourneyPlanner::Results, vcr: true do
|
|
14
15
|
|
15
16
|
it 'must process journeys into objects' do
|
16
17
|
VCR.use_cassette "hello", record: :none do
|
17
|
-
client = TFLJourneyPlanner::Client.new(app_id: ENV["TFL_ID"], app_key: ENV["TFL_KEY"])
|
18
|
-
journeys = client.get_journeys(from: "tw14 9nt", to: "tw14 8ex")
|
19
18
|
expect(journeys).to be_a Array
|
20
19
|
expect(journeys[0]).to be_a TFLJourneyPlanner::Journey
|
21
20
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: journey_planner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jpatel531
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|