yahoo-placemaker 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,11 +29,16 @@ class Yahoo::Placemaker::Document
29
29
  # yahoo has given us back some POORLY formatted data which
30
30
  # is in numeric keys so we'll search for them and pull them out
31
31
 
32
- if json.has_key? 'placeDetails'
32
+ if json['placeDetails']
33
33
  @places << Yahoo::Placemaker::Place.new(json['placeDetails'])
34
- else
35
- (json.map{ |k,v| k =~ /^[\d]+$/ ? v : nil }).compact.each do |place|
36
- @places << Yahoo::Placemaker::Place.new(place['placeDetails'])
34
+ end
35
+
36
+ if json.class == Array
37
+ multiple_place_details = (json.map{ |k,v| k =~ /^[\d]+$/ ? v : nil }).compact
38
+ if multiple_place_details.any?
39
+ multiple_place_details.each do |place|
40
+ @places << Yahoo::Placemaker::Place.new(place['placeDetails'])
41
+ end
37
42
  end
38
43
  end
39
44
 
@@ -1,5 +1,5 @@
1
1
  module Yahoo
2
2
  module Placemaker
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -23,4 +23,11 @@ describe Yahoo::Placemaker do
23
23
  end
24
24
  end
25
25
 
26
+ it "doesn't return any places for 'foobar'" do
27
+ VCR.use_cassette('foobar') do
28
+ response = Yahoo::Placemaker.extract "foobar"
29
+ response.document.geographic_scope.should == nil
30
+ end
31
+ end
32
+
26
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo-placemaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70211849137140 !ruby/object:Gem::Requirement
16
+ requirement: &70185541547500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70211849137140
24
+ version_requirements: *70185541547500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fakeweb
27
- requirement: &70211849136500 !ruby/object:Gem::Requirement
27
+ requirement: &70185541545820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70211849136500
35
+ version_requirements: *70185541545820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: vcr
38
- requirement: &70211849135540 !ruby/object:Gem::Requirement
38
+ requirement: &70185541543640 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70211849135540
46
+ version_requirements: *70185541543640
47
47
  description: Easily interact w/ the Yahoo Placemaker API
48
48
  email:
49
49
  - kyle.decot@me.com