yahoo-placemaker 0.0.4.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/lib/yahoo-placemaker.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "yahoo-placemaker/response"
|
2
|
+
require "yahoo-placemaker/exception"
|
2
3
|
require "yahoo-placemaker/version"
|
3
4
|
|
4
5
|
require "json"
|
@@ -10,6 +11,11 @@ module Yahoo
|
|
10
11
|
# Main method for interacting w/ the Yahoo! Placemaker API
|
11
12
|
|
12
13
|
def self.extract (text = '', options = {})
|
14
|
+
|
15
|
+
unless defined?(Yahoo::Placemaker::APP_ID)
|
16
|
+
raise Yahoo::Placemaker::Exception.new("Invalid APP_ID")
|
17
|
+
end
|
18
|
+
|
13
19
|
result = nil
|
14
20
|
host = 'wherein.yahooapis.com'
|
15
21
|
|
@@ -32,7 +32,7 @@ class Yahoo::Placemaker::Document
|
|
32
32
|
@places << Yahoo::Placemaker::Place.new(json['placeDetails'])
|
33
33
|
end
|
34
34
|
|
35
|
-
if json.class ==
|
35
|
+
if json.class == Hash
|
36
36
|
multiple_place_details = (json.map{ |k,v| k =~ /^[\d]+$/ ? v : nil }).compact
|
37
37
|
if multiple_place_details.any?
|
38
38
|
multiple_place_details.each do |place|
|
@@ -4,7 +4,7 @@ class Yahoo::Placemaker::Extents
|
|
4
4
|
|
5
5
|
attr_accessor :center, :south_west, :north_east
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize(json)
|
8
8
|
@center = Yahoo::Placemaker::LatLng.new(json['center'])
|
9
9
|
@south_west = Yahoo::Placemaker::LatLng.new(json['southWest'])
|
10
10
|
@north_east = Yahoo::Placemaker::LatLng.new(json['northEast'])
|
@@ -16,6 +16,13 @@ describe Yahoo::Placemaker do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
it "returns two places (a country, and a city)" do
|
20
|
+
VCR.use_cassette('France Columbus Ohio') do
|
21
|
+
response = Yahoo::Placemaker.extract "Columbus Ohio France"
|
22
|
+
response.document.places.size.should == 2
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
19
26
|
it "contains only one item in reference_list when given 'Atlanta Georgia'" do
|
20
27
|
VCR.use_cassette('atlanta_georgia') do
|
21
28
|
response = Yahoo::Placemaker.extract "Atlanta Georgia"
|
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.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-26 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70294204088140 !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: *
|
24
|
+
version_requirements: *70294204088140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fakeweb
|
27
|
-
requirement: &
|
27
|
+
requirement: &70294204087600 !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: *
|
35
|
+
version_requirements: *70294204087600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: vcr
|
38
|
-
requirement: &
|
38
|
+
requirement: &70294204087020 !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: *
|
46
|
+
version_requirements: *70294204087020
|
47
47
|
description: Easily interact w/ the Yahoo Placemaker API
|
48
48
|
email:
|
49
49
|
- kyle.decot@me.com
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/yahoo-placemaker/ancestor.rb
|
63
63
|
- lib/yahoo-placemaker/config.rb
|
64
64
|
- lib/yahoo-placemaker/document.rb
|
65
|
+
- lib/yahoo-placemaker/exception.rb
|
65
66
|
- lib/yahoo-placemaker/extents.rb
|
66
67
|
- lib/yahoo-placemaker/geographic_scope.rb
|
67
68
|
- lib/yahoo-placemaker/lat_lng.rb
|