journey_planner 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe TFLJourneyPlanner::Journey do
4
+
5
+ it "should return an array of instructions" do
6
+ 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
+ array = ["Continue along Fruen Road for 143 metres (2 minutes, 8 seconds).",
10
+ "Turn right on to Bedfont Lane, continue for 172 metres (2 minutes, 33 seconds).",
11
+ "H25 bus to Bedfont Library / H25 bus towards Hatton Cross",
12
+ "Continue along Staines Road for 64 metres (0 minutes, 57 seconds).",
13
+ "Turn left on to Grovestile Waye, continue for 95 metres (1 minute, 21 seconds)."]
14
+ expect(journeys[0].instructions).to eq array
15
+ end
16
+ end
17
+
18
+ # it "should return the average duration of a journey" do
19
+ # VCR.use_cassette "hello", record: :none do
20
+ # client = TFLJourneyPlanner::Client.new(app_id: ENV["TFL_ID"], app_key: ENV["TFL_KEY"])
21
+ # results = client.get_journeys(from: "tw14 9nt", to: "tw14 8ex")
22
+ # journeys = client.process_journeys_from results
23
+ # expect(journeys[0].average_duration).to eq 13.5
24
+ # end
25
+
26
+ # end
27
+
28
+
29
+
30
+
31
+
32
+
33
+ end
@@ -0,0 +1,24 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe TFLJourneyPlanner::Results, vcr: true do
4
+
5
+
6
+ it "must work" do
7
+ 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
+ expect(journeys[0].start_date_time).to be_a String
11
+ end
12
+ end
13
+
14
+
15
+ it 'must process journeys into objects' do
16
+ 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
+ expect(journeys).to be_a Array
20
+ expect(journeys[0]).to be_a TFLJourneyPlanner::Journey
21
+ end
22
+ end
23
+
24
+ end
@@ -0,0 +1,17 @@
1
+ require 'tfl_jp'
2
+
3
+ require 'webmock'
4
+ require 'vcr'
5
+
6
+
7
+
8
+ VCR.configure do |c|
9
+ c.configure_rspec_metadata!
10
+ c.cassette_library_dir = 'spec/fixtures/tfl_jp_casettes'
11
+ c.hook_into :webmock
12
+ end
13
+
14
+ RSpec.configure do |config|
15
+ # config.extend VCR::RSpec::Macros
16
+
17
+ end
data/tfl_jp.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'journey_planner/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "journey_planner"
7
+ spec.version = TFLJourneyPlanner::VERSION
8
+ spec.authors = ["jpatel531"]
9
+ spec.email = ["jamie@notespublication.com"]
10
+ spec.summary = %q{Ruby wrapper for TFL API Journey Planner}
11
+ spec.description = %q{Retrieves journey data from the TFL API}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: journey_planner
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ platform: ruby
6
+ authors:
7
+ - jpatel531
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-03 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Retrieves journey data from the TFL API
42
+ email:
43
+ - jamie@notespublication.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - lib/journey.rb
55
+ - lib/journey_planner.rb
56
+ - lib/journey_planner/version.rb
57
+ - lib/results.rb
58
+ - lib/rubify_keys.rb
59
+ - spec/client_spec.rb
60
+ - spec/fixtures/tfl_jp_casettes/hello.yml
61
+ - spec/journey_spec.rb
62
+ - spec/results_spec.rb
63
+ - spec/spec_helper.rb
64
+ - tfl_jp.gemspec
65
+ homepage: ''
66
+ licenses:
67
+ - MIT
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.2.2
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Ruby wrapper for TFL API Journey Planner
89
+ test_files:
90
+ - spec/client_spec.rb
91
+ - spec/fixtures/tfl_jp_casettes/hello.yml
92
+ - spec/journey_spec.rb
93
+ - spec/results_spec.rb
94
+ - spec/spec_helper.rb