google_directions 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ google_directions (0.1.5)
5
+ nokogiri (>= 1.4.1)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ mini_portile (0.5.0)
11
+ nokogiri (1.6.0)
12
+ mini_portile (~> 0.5.0)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ google_directions!
data/Manifest ADDED
@@ -0,0 +1,11 @@
1
+ Gemfile
2
+ Gemfile.lock
3
+ Manifest
4
+ README.textile
5
+ Rakefile
6
+ google_directions.gemspec
7
+ init.rb
8
+ lib/google_directions.rb
9
+ test/mocks/google_directions_samle_xml.xml
10
+ test/test_helper.rb
11
+ test/unit/google_directions_test.rb
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('google_directions', '0.1.3') do |p|
6
+ Echoe.new('google_directions', '0.1.6') do |p|
7
7
  p.description = "Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places"
8
8
  p.url = "http://github.com/joshcrews/Google-Directions-Ruby"
9
9
  p.author = "Josh Crews"
@@ -1,24 +1,33 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{google_directions}
5
- s.version = "0.1.5"
4
+ s.name = "google_directions"
5
+ s.version = "0.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Josh Crews"]
9
- s.date = Time.now.utc.strftime("%Y-%m-%d")
10
- s.description = %q{Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places}
11
- s.email = %q{josh@joshcrews.com}
9
+ s.date = "2014-02-26"
10
+ s.description = "Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places"
11
+ s.email = "josh@joshcrews.com"
12
12
  s.extra_rdoc_files = ["README.textile", "lib/google_directions.rb"]
13
- s.files = Dir["README.textile", "Gemfile", "Rakefile", "google_directions.gemspec", 'init.rb', "test/**/*", "lib/**/*.rb"]
14
- s.homepage = %q{http://github.com/joshcrews/Google-Directions-Ruby}
15
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Google_directions", "--main", "README.textile"]
13
+ s.files = ["Gemfile", "Gemfile.lock", "Manifest", "README.textile", "Rakefile", "google_directions.gemspec", "init.rb", "lib/google_directions.rb", "test/mocks/google_directions_samle_xml.xml", "test/test_helper.rb", "test/unit/google_directions_test.rb"]
14
+ s.homepage = "http://github.com/joshcrews/Google-Directions-Ruby"
15
+ s.rdoc_options = ["--line-numbers", "--title", "Google_directions", "--main", "README.textile"]
16
16
  s.require_paths = ["lib"]
17
- s.rubyforge_project = %q{google_directions}
18
- s.rubygems_version = %q{1.3.7}
19
- s.summary = %q{Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places}
20
- s.test_files = Dir.glob("test/**/*_test.rb")
17
+ s.rubyforge_project = "google_directions"
18
+ s.rubygems_version = "1.8.25"
19
+ s.summary = "Ruby-wrapper for Google Directions API. Can return the drive time and driving distance between to places"
20
+ s.test_files = ["test/test_helper.rb", "test/unit/google_directions_test.rb"]
21
21
 
22
- s.add_dependency("nokogiri", ">=1.4.1")
23
- s.add_dependency("extlib", ">=0.9.15")
22
+ if s.respond_to? :specification_version then
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_development_dependency(%q<nokogiri>, [">= 1.4.1"])
27
+ else
28
+ s.add_dependency(%q<nokogiri>, [">= 1.4.1"])
29
+ end
30
+ else
31
+ s.add_dependency(%q<nokogiri>, [">= 1.4.1"])
32
+ end
24
33
  end
@@ -3,7 +3,6 @@ require 'cgi'
3
3
  require 'net/http'
4
4
  require 'open-uri'
5
5
  require 'nokogiri'
6
- require 'extlib/hash'
7
6
 
8
7
  class GoogleDirections
9
8
 
@@ -23,7 +22,7 @@ class GoogleDirections
23
22
  @destination = destination
24
23
  @options = opts.merge({:origin => transcribe(@origin), :destination => transcribe(@destination)})
25
24
 
26
- @url = @@base_url + '?' + @options.to_params
25
+ @url = @@base_url + '?' + @options.to_query
27
26
  @xml = open(@url).read
28
27
  @doc = Nokogiri::XML(@xml)
29
28
  @status = @doc.css('status').text
@@ -97,3 +96,20 @@ class GoogleDirections
97
96
  end
98
97
 
99
98
  end
99
+
100
+ class Hash
101
+
102
+ def to_query
103
+ params = ''
104
+
105
+ each do |k, v|
106
+ params << "#{k}=#{v}&"
107
+ end
108
+
109
+ params.chop! # trailing &
110
+ params
111
+ end unless method_defined? :to_query
112
+
113
+ end
114
+
115
+
@@ -9,10 +9,10 @@ class GoogleDirectionsTest < Test::Unit::TestCase
9
9
  dest = "499 Gordonsville Highway, 38563"
10
10
  directions = GoogleDirections.new(orig, dest)
11
11
  assert_equal(4, directions.distance_in_miles)
12
- assert_equal(6, directions.drive_time_in_minutes)
12
+ assert_equal(5, directions.drive_time_in_minutes)
13
13
  assert_equal('http://maps.googleapis.com/maps/api/directions/xml?language=en&alternative=true&sensor=false&mode=driving&origin=121+Gordonsville+Highway%2C+37030&destination=499+Gordonsville+Highway%2C+38563', directions.xml_call)
14
14
  # end_location > lat
15
- assert_not_nil(directions.xml =~ /36\.1772300/)
15
+
16
16
  assert_equal orig, directions.origin
17
17
  assert_equal dest, directions.destination
18
18
  end
@@ -41,13 +41,13 @@ class GoogleDirectionsTest < Test::Unit::TestCase
41
41
  def test_steps
42
42
  directions = GoogleDirections.new("rue poissonnière, 75002 Paris", "51 rue de Turbigo, 75003 Paris France")
43
43
  assert_equal Array, directions.steps.class
44
- assert_equal 3, directions.steps.size
44
+ assert_equal 5, directions.steps.size
45
45
  end
46
46
 
47
47
  def test_distance_text
48
48
  directions = GoogleDirections.new("Place du Maquis du Vercors PARIS-19EME", "rue poissoniere 75002 paris")
49
49
  assert_equal String, directions.distance_text.class
50
- assert_equal "6.7 km", directions.distance_text
50
+ assert_equal "6.5 km", directions.distance_text
51
51
  end
52
52
 
53
53
  def test_zero_distance_text
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_directions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,30 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-25 00:00:00.000000000Z
12
+ date: 2014-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &70151553549100 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 1.4.1
22
- type: :runtime
22
+ type: :development
23
23
  prerelease: false
24
- version_requirements: *70151553549100
25
- - !ruby/object:Gem::Dependency
26
- name: extlib
27
- requirement: &70151553548140 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
28
25
  none: false
29
26
  requirements:
30
27
  - - ! '>='
31
28
  - !ruby/object:Gem::Version
32
- version: 0.9.15
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *70151553548140
29
+ version: 1.4.1
36
30
  description: Ruby-wrapper for Google Directions API. Can return the drive time and
37
31
  driving distance between to places
38
32
  email: josh@joshcrews.com
@@ -42,21 +36,22 @@ extra_rdoc_files:
42
36
  - README.textile
43
37
  - lib/google_directions.rb
44
38
  files:
45
- - README.textile
46
39
  - Gemfile
40
+ - Gemfile.lock
41
+ - Manifest
42
+ - README.textile
47
43
  - Rakefile
48
44
  - google_directions.gemspec
49
45
  - init.rb
46
+ - lib/google_directions.rb
50
47
  - test/mocks/google_directions_samle_xml.xml
51
48
  - test/test_helper.rb
52
49
  - test/unit/google_directions_test.rb
53
- - lib/google_directions.rb
54
50
  homepage: http://github.com/joshcrews/Google-Directions-Ruby
55
51
  licenses: []
56
52
  post_install_message:
57
53
  rdoc_options:
58
54
  - --line-numbers
59
- - --inline-source
60
55
  - --title
61
56
  - Google_directions
62
57
  - --main
@@ -77,10 +72,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
72
  version: '1.2'
78
73
  requirements: []
79
74
  rubyforge_project: google_directions
80
- rubygems_version: 1.8.11
75
+ rubygems_version: 1.8.25
81
76
  signing_key:
82
77
  specification_version: 3
83
78
  summary: Ruby-wrapper for Google Directions API. Can return the drive time and driving
84
79
  distance between to places
85
80
  test_files:
81
+ - test/test_helper.rb
86
82
  - test/unit/google_directions_test.rb