ym4r 0.5.4 → 0.6.0

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.
@@ -30,13 +30,13 @@ module Ym4r
30
30
  placemarks = Placemarks.new(response.elements['name'].text,response.elements['Status/code'].text.to_i)
31
31
  response.elements.each("Placemark") do |placemark|
32
32
  data = placemark.elements
33
- data_country = data['//CountryNameCode']
34
- data_administrative = data['//AdministrativeAreaName']
35
- data_sub_administrative = data['//SubAdministrativeAreaName']
36
- data_locality = data['//LocalityName']
37
- data_dependent_locality = data['//DependentLocalityName']
38
- data_thoroughfare = data['//ThoroughfareName']
39
- data_postal_code = data['//PostalCodeNumber']
33
+ data_country = data['descendant::CountryNameCode']
34
+ data_administrative = data['descendant::AdministrativeAreaName']
35
+ data_sub_administrative = data['descendant::SubAdministrativeAreaName']
36
+ data_locality = data['descendant::LocalityName']
37
+ data_dependent_locality = data['descendant::DependentLocalityName']
38
+ data_thoroughfare = data['descendant::ThoroughfareName']
39
+ data_postal_code = data['descendant::PostalCodeNumber']
40
40
  placemarks << Geocoding::Placemark.new(data['address'].text,
41
41
  data_country.nil? ? "" : data_country.text,
42
42
  data_administrative.nil? ? "" : data_administrative.text,
@@ -45,7 +45,7 @@ module Ym4r
45
45
  data_dependent_locality.nil? ? "" : data_dependent_locality.text,
46
46
  data_thoroughfare.nil? ? "" : data_thoroughfare.text,
47
47
  data_postal_code.nil? ? "" : data_postal_code.text,
48
- *(data['//coordinates'].text.split(",")[0..1].collect {|l| l.to_f }))
48
+ *(data['descendant::coordinates'].text.split(",")[0..1].collect {|l| l.to_f }))
49
49
  end
50
50
  placemarks
51
51
  end
@@ -24,13 +24,13 @@ spec = Gem::Specification::new do |s|
24
24
  s.platform = Gem::Platform::RUBY
25
25
 
26
26
  s.name = 'ym4r'
27
- s.version = "0.5.4"
27
+ s.version = "0.6.0"
28
28
  s.summary = "Helping the use of Google Maps and Yahoo! Maps API's from Ruby and Rails"
29
29
  s.description = <<EOF
30
30
  EOF
31
31
  s.author = 'Guilhem Vellut'
32
- s.email = 'guilhem.vellut@gmail.com'
33
- s.homepage = "http://thepochisuperstarmegashow.com"
32
+ s.email = 'guilhem.vellut+ym4r@gmail.com'
33
+ s.homepage = "http://thepochisuperstarmegashow.com/projects/#ym4r"
34
34
 
35
35
  s.requirements << 'none'
36
36
  s.require_path = 'lib'
@@ -26,10 +26,6 @@ class TestGeocoding< Test::Unit::TestCase
26
26
  assert_equal(result1.longitude,result2.longitude)
27
27
  end
28
28
 
29
- def test_garbage_location
30
- assert_raise(BadRequestException) {Ym4r::YahooMaps::BuildingBlock::Geocoding::get(:location => "AZEAEAEAEAEAE")}
31
- end
32
-
33
29
  def test_no_location
34
30
  assert_raise(MissingParameterException) {Ym4r::YahooMaps::BuildingBlock::Geocoding::get(:hello => "world")}
35
31
  end
@@ -24,5 +24,40 @@ class TestGmGeocoding< Test::Unit::TestCase
24
24
  assert_equal("PK",placemark.country_code)
25
25
  assert_equal("Lahore",placemark.locality)
26
26
  assert_equal("",placemark.thoroughfare)
27
+ end
28
+
29
+ def test_google_maps_multiple_matches
30
+ placemarks = Ym4r::GoogleMaps::Geocoding.get("gooseberry")
31
+ assert_equal(Ym4r::GoogleMaps::Geocoding::GEO_SUCCESS,placemarks.status)
32
+ assert_equal(4,placemarks.length)
33
+
34
+ placemark = placemarks[0]
35
+ assert_equal("US",placemark.country_code)
36
+ assert_equal("UT", placemark.administrative_area)
37
+ assert_equal("Blanding",placemark.locality)
38
+ assert_equal("Gooseberry",placemark.thoroughfare)
39
+ assert_equal("84511",placemark.postal_code)
40
+
41
+ placemark = placemarks[1]
42
+ assert_equal("US",placemark.country_code)
43
+ assert_equal("OR", placemark.administrative_area)
44
+ assert_equal("",placemark.locality)
45
+ assert_equal("",placemark.thoroughfare)
46
+ assert_equal("",placemark.postal_code)
47
+
48
+ placemark = placemarks[2]
49
+ assert_equal("US",placemark.country_code)
50
+ assert_equal("UT", placemark.administrative_area)
51
+ assert_equal("Salina",placemark.locality)
52
+ assert_equal("",placemark.thoroughfare)
53
+ assert_equal("",placemark.postal_code)
54
+
55
+ placemark = placemarks[3]
56
+ assert_equal("US",placemark.country_code)
57
+ assert_equal("CA", placemark.administrative_area)
58
+ assert_equal("",placemark.locality)
59
+ assert_equal("Gooseberry",placemark.thoroughfare)
60
+ assert_equal("93651",placemark.postal_code)
61
+
27
62
  end
28
63
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: ym4r
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.4
7
- date: 2006-10-30 00:00:00 +01:00
6
+ version: 0.6.0
7
+ date: 2007-09-12 00:00:00 +02:00
8
8
  summary: Helping the use of Google Maps and Yahoo! Maps API's from Ruby and Rails
9
9
  require_paths:
10
10
  - lib
11
- email: guilhem.vellut@gmail.com
12
- homepage: http://thepochisuperstarmegashow.com
11
+ email: guilhem.vellut+ym4r@gmail.com
12
+ homepage: http://thepochisuperstarmegashow.com/projects/#ym4r
13
13
  rubyforge_project:
14
14
  description: ""
15
15
  autorequire:
@@ -29,18 +29,18 @@ post_install_message:
29
29
  authors:
30
30
  - Guilhem Vellut
31
31
  files:
32
- - lib/ym4r.rb
33
- - lib/ym4r/google_maps.rb
34
- - lib/ym4r/yahoo_maps.rb
35
32
  - lib/ym4r/google_maps/api_key.rb
36
33
  - lib/ym4r/google_maps/geocoding.rb
34
+ - lib/ym4r/google_maps.rb
37
35
  - lib/ym4r/yahoo_maps/app_id.rb
38
- - lib/ym4r/yahoo_maps/building_block.rb
39
36
  - lib/ym4r/yahoo_maps/building_block/exception.rb
40
37
  - lib/ym4r/yahoo_maps/building_block/geocoding.rb
41
38
  - lib/ym4r/yahoo_maps/building_block/local_search.rb
42
39
  - lib/ym4r/yahoo_maps/building_block/map_image.rb
43
40
  - lib/ym4r/yahoo_maps/building_block/traffic.rb
41
+ - lib/ym4r/yahoo_maps/building_block.rb
42
+ - lib/ym4r/yahoo_maps.rb
43
+ - lib/ym4r.rb
44
44
  - lib/ym4r/google_maps/config/config.yml
45
45
  - test/test_geocoding.rb
46
46
  - test/test_gm_geocoding.rb