yahoo-placemaker 0.0.5 → 0.0.6
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.
- data/lib/yahoo-placemaker.rb +1 -56
- data/lib/yahoo/placemaker.rb +56 -0
- data/lib/yahoo/placemaker/administrative_scope.rb +8 -0
- data/lib/yahoo/placemaker/ancestor.rb +13 -0
- data/lib/{yahoo-placemaker → yahoo/placemaker}/config.rb +0 -0
- data/lib/{yahoo-placemaker → yahoo/placemaker}/document.rb +11 -7
- data/lib/yahoo/placemaker/exception.rb +6 -0
- data/lib/yahoo/placemaker/extents.rb +17 -0
- data/lib/yahoo/placemaker/geographic_scope.rb +8 -0
- data/lib/yahoo/placemaker/lat_lng.rb +11 -0
- data/lib/yahoo/placemaker/local_scope.rb +33 -0
- data/lib/yahoo/placemaker/place.rb +25 -0
- data/lib/yahoo/placemaker/reference.rb +19 -0
- data/lib/yahoo/placemaker/response.rb +14 -0
- data/lib/yahoo/placemaker/scope.rb +18 -0
- data/lib/{yahoo-placemaker → yahoo/placemaker}/version.rb +1 -1
- data/spec/lat_lng_spec.rb +16 -0
- data/spec/reference_spec.rb +6 -0
- data/spec/yahoo_placemaker_spec.rb +0 -1
- data/yahoo-placemaker.gemspec +1 -1
- metadata +27 -22
- data/lib/yahoo-placemaker/administrative_scope.rb +0 -4
- data/lib/yahoo-placemaker/ancestor.rb +0 -11
- data/lib/yahoo-placemaker/exception.rb +0 -2
- data/lib/yahoo-placemaker/extents.rb +0 -13
- data/lib/yahoo-placemaker/geographic_scope.rb +0 -4
- data/lib/yahoo-placemaker/lat_lng.rb +0 -7
- data/lib/yahoo-placemaker/local_scope.rb +0 -24
- data/lib/yahoo-placemaker/place.rb +0 -21
- data/lib/yahoo-placemaker/reference.rb +0 -16
- data/lib/yahoo-placemaker/response.rb +0 -10
- data/lib/yahoo-placemaker/scope.rb +0 -13
data/lib/yahoo-placemaker.rb
CHANGED
@@ -1,56 +1 @@
|
|
1
|
-
require
|
2
|
-
require "yahoo-placemaker/exception"
|
3
|
-
require "yahoo-placemaker/version"
|
4
|
-
|
5
|
-
require "json"
|
6
|
-
require "net/http"
|
7
|
-
|
8
|
-
module Yahoo
|
9
|
-
module Placemaker
|
10
|
-
|
11
|
-
# Main method for interacting w/ the Yahoo! Placemaker API
|
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
|
-
|
19
|
-
result = nil
|
20
|
-
host = 'wherein.yahooapis.com'
|
21
|
-
|
22
|
-
# These options need to be explicitly set!
|
23
|
-
options['documentContent'] = text
|
24
|
-
options['appid'] = Yahoo::Placemaker::APP_ID
|
25
|
-
options['outputType'] = 'json'
|
26
|
-
options['documentType'] = 'text/plain'
|
27
|
-
|
28
|
-
req = ::Net::HTTP::Post.new('/v1/document')
|
29
|
-
req.body = to_url_params(options)
|
30
|
-
begin
|
31
|
-
response = ::Net::HTTP.new(host).start do |http|
|
32
|
-
http.request(req)
|
33
|
-
end
|
34
|
-
json = ::JSON.parse(response.body)
|
35
|
-
|
36
|
-
result = Yahoo::Placemaker::Response.new(json)
|
37
|
-
rescue Exception => e
|
38
|
-
# puts e
|
39
|
-
# Something has gone horribly wrong...
|
40
|
-
end
|
41
|
-
|
42
|
-
result
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
# Takes a hash and turns it into a query string that can be used
|
49
|
-
# in a URL request
|
50
|
-
|
51
|
-
def self.to_url_params(params)
|
52
|
-
params.collect{|key, value| "#{key}=#{value}"}.join('&')
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
1
|
+
require 'yahoo/placemaker'
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "yahoo/placemaker/response"
|
2
|
+
require "yahoo/placemaker/exception"
|
3
|
+
require "yahoo/placemaker/version"
|
4
|
+
|
5
|
+
require "json"
|
6
|
+
require "net/http"
|
7
|
+
|
8
|
+
module Yahoo
|
9
|
+
module Placemaker
|
10
|
+
|
11
|
+
# Main method for interacting w/ the Yahoo! Placemaker API
|
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
|
+
|
19
|
+
result = nil
|
20
|
+
host = 'wherein.yahooapis.com'
|
21
|
+
|
22
|
+
# These options need to be explicitly set!
|
23
|
+
options['documentContent'] = text
|
24
|
+
options['appid'] = Yahoo::Placemaker::APP_ID
|
25
|
+
options['outputType'] = 'json'
|
26
|
+
options['documentType'] = 'text/plain'
|
27
|
+
|
28
|
+
req = ::Net::HTTP::Post.new('/v1/document')
|
29
|
+
req.body = to_url_params(options)
|
30
|
+
begin
|
31
|
+
response = ::Net::HTTP.new(host).start do |http|
|
32
|
+
http.request(req)
|
33
|
+
end
|
34
|
+
json = ::JSON.parse(response.body)
|
35
|
+
|
36
|
+
result = Yahoo::Placemaker::Response.new(json)
|
37
|
+
rescue Exception => e
|
38
|
+
# puts e
|
39
|
+
# Something has gone horribly wrong...
|
40
|
+
end
|
41
|
+
|
42
|
+
result
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
# Takes a hash and turns it into a query string that can be used
|
49
|
+
# in a URL request
|
50
|
+
|
51
|
+
def self.to_url_params(params)
|
52
|
+
params.collect{|key, value| "#{key}=#{value}"}.join('&')
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
File without changes
|
@@ -1,11 +1,13 @@
|
|
1
|
-
require 'yahoo
|
2
|
-
require 'yahoo
|
3
|
-
require 'yahoo
|
4
|
-
require 'yahoo
|
5
|
-
require 'yahoo
|
6
|
-
require 'yahoo
|
1
|
+
require 'yahoo/placemaker/geographic_scope'
|
2
|
+
require 'yahoo/placemaker/local_scope'
|
3
|
+
require 'yahoo/placemaker/administrative_scope'
|
4
|
+
require 'yahoo/placemaker/reference'
|
5
|
+
require 'yahoo/placemaker/extents'
|
6
|
+
require 'yahoo/placemaker/place'
|
7
7
|
|
8
|
-
|
8
|
+
module Yahoo
|
9
|
+
module Placemaker
|
10
|
+
class Document
|
9
11
|
attr_accessor :administrative_scope, :geographic_scope, :local_scopes, :references, :extents, :places
|
10
12
|
def initialize(json)
|
11
13
|
|
@@ -69,5 +71,7 @@ class Yahoo::Placemaker::Document
|
|
69
71
|
end
|
70
72
|
end
|
71
73
|
|
74
|
+
end
|
75
|
+
end
|
72
76
|
end
|
73
77
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'yahoo/placemaker/lat_lng'
|
2
|
+
|
3
|
+
module Yahoo
|
4
|
+
module Placemaker
|
5
|
+
class Extents
|
6
|
+
|
7
|
+
attr_accessor :center, :south_west, :north_east
|
8
|
+
|
9
|
+
def initialize(json)
|
10
|
+
@center = Yahoo::Placemaker::LatLng.new(json['center'])
|
11
|
+
@south_west = Yahoo::Placemaker::LatLng.new(json['southWest'])
|
12
|
+
@north_east = Yahoo::Placemaker::LatLng.new(json['northEast'])
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'yahoo/placemaker/scope'
|
2
|
+
require 'yahoo/placemaker/ancestor'
|
3
|
+
|
4
|
+
module Yahoo
|
5
|
+
module Placemaker
|
6
|
+
class LocalScope < Yahoo::Placemaker::Scope
|
7
|
+
|
8
|
+
attr_accessor :ancestors, :centroid, :south_west, :north_east
|
9
|
+
|
10
|
+
def initialize (json)
|
11
|
+
super(json)
|
12
|
+
@centroid = Yahoo::Placemaker::LatLng.new json['centroid']
|
13
|
+
@south_west = Yahoo::Placemaker::LatLng.new json['southWest']
|
14
|
+
@north_east = Yahoo::Placemaker::LatLng.new json['northEast']
|
15
|
+
|
16
|
+
# Yahoo doesn't always return an array of ancestors; ancestors can
|
17
|
+
# be an array, a hash, or a string containing "\n"?! We need to
|
18
|
+
# account for this and stuff everything into @ancestors...
|
19
|
+
|
20
|
+
@ancestors = Array.new
|
21
|
+
if json['ancestors'].class == Array
|
22
|
+
json['ancestors'].each do |ancestor|
|
23
|
+
@ancestors << Yahoo::Placemaker::Ancestor.new(ancestor['ancestor'])
|
24
|
+
end
|
25
|
+
elsif json['ancestors'].class == Hash
|
26
|
+
@ancestors << Yahoo::Placemaker::Ancestor.new(json['ancestors']['ancestor'])
|
27
|
+
else
|
28
|
+
# no ancestors...country?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'yahoo/placemaker/lat_lng'
|
2
|
+
|
3
|
+
module Yahoo
|
4
|
+
module Placemaker
|
5
|
+
class Place
|
6
|
+
|
7
|
+
attr_accessor :place_id, :match_type, :place_reference_ids, :weight, :confidence
|
8
|
+
attr_accessor :centroid, :type, :woe_id, :name
|
9
|
+
|
10
|
+
def initialize(json)
|
11
|
+
|
12
|
+
@place_id = json['placeId']
|
13
|
+
@centroid = Yahoo::Placemaker::LatLng.new json['place']['centroid']
|
14
|
+
@type = json['place']['type']
|
15
|
+
@woe_id = json['place']['woeId']
|
16
|
+
@name = json['place']['name']
|
17
|
+
|
18
|
+
@match_type = json['matchType']
|
19
|
+
@place_reference_ids = json['placeReferenceIds']
|
20
|
+
@weight = json['weight'].to_i
|
21
|
+
@confidence = json['confidence'].to_i
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Yahoo
|
2
|
+
module Placemaker
|
3
|
+
class Reference
|
4
|
+
attr_accessor :woe_ids, :end, :start, :place_reference_id, :place_ids, :text, :type, :xpath, :is_plaintext_marker
|
5
|
+
|
6
|
+
def initialize(json)
|
7
|
+
@woe_ids = json['woeIds']
|
8
|
+
@end = json['end'].to_i
|
9
|
+
@start = json['start'].to_i
|
10
|
+
@place_reference_id = json['placeReferenceId']
|
11
|
+
@place_ids = json['placeIds']
|
12
|
+
@text = json['text']
|
13
|
+
@type = json['type']
|
14
|
+
@xpath = json['xpath']
|
15
|
+
@is_plaintext_marker = json['isPlaintextMarker']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'yahoo/placemaker/document'
|
2
|
+
|
3
|
+
module Yahoo
|
4
|
+
module Placemaker
|
5
|
+
class Response
|
6
|
+
attr_accessor :document, :version, :processing_time
|
7
|
+
def initialize (json)
|
8
|
+
@document = Yahoo::Placemaker::Document.new(json['document'])
|
9
|
+
@version = json['version']
|
10
|
+
@processing_time = json['processingTime']
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'yahoo/placemaker/lat_lng'
|
2
|
+
|
3
|
+
module Yahoo
|
4
|
+
module Placemaker
|
5
|
+
class Scope
|
6
|
+
|
7
|
+
attr_accessor :woe_id, :type, :name, :centroid
|
8
|
+
|
9
|
+
def initialize(json)
|
10
|
+
@centroid = Yahoo::Placemaker::LatLng.new(json['centroid'])
|
11
|
+
@woe_id = json['woeId']
|
12
|
+
@type = json['type']
|
13
|
+
@name = json['name']
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Yahoo::Placemaker::LatLng do
|
4
|
+
|
5
|
+
it "returns the latitude" do
|
6
|
+
stub = { :latitude => 0.0, :longitude => 0.0 }
|
7
|
+
ll = Yahoo::Placemaker::LatLng.new stub
|
8
|
+
ll.latitude.should == 0.0
|
9
|
+
end
|
10
|
+
|
11
|
+
it "returns the longitude" do
|
12
|
+
stub = { :latitude => 0.0, :longitude => 0.0 }
|
13
|
+
ll = Yahoo::Placemaker::LatLng.new stub
|
14
|
+
ll.longitude.should == 0.0
|
15
|
+
end
|
16
|
+
end
|
data/yahoo-placemaker.gemspec
CHANGED
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.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-27 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70155972433600 !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: *70155972433600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fakeweb
|
27
|
-
requirement: &
|
27
|
+
requirement: &70155972433000 !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: *70155972433000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: vcr
|
38
|
-
requirement: &
|
38
|
+
requirement: &70155972432000 !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: *70155972432000
|
47
47
|
description: Easily interact w/ the Yahoo Placemaker API
|
48
48
|
email:
|
49
49
|
- kyle.decot@me.com
|
@@ -58,20 +58,23 @@ files:
|
|
58
58
|
- README.markdown
|
59
59
|
- Rakefile
|
60
60
|
- lib/yahoo-placemaker.rb
|
61
|
-
- lib/yahoo
|
62
|
-
- lib/yahoo
|
63
|
-
- lib/yahoo
|
64
|
-
- lib/yahoo
|
65
|
-
- lib/yahoo
|
66
|
-
- lib/yahoo
|
67
|
-
- lib/yahoo
|
68
|
-
- lib/yahoo
|
69
|
-
- lib/yahoo
|
70
|
-
- lib/yahoo
|
71
|
-
- lib/yahoo
|
72
|
-
- lib/yahoo
|
73
|
-
- lib/yahoo
|
74
|
-
- lib/yahoo
|
61
|
+
- lib/yahoo/placemaker.rb
|
62
|
+
- lib/yahoo/placemaker/administrative_scope.rb
|
63
|
+
- lib/yahoo/placemaker/ancestor.rb
|
64
|
+
- lib/yahoo/placemaker/config.rb
|
65
|
+
- lib/yahoo/placemaker/document.rb
|
66
|
+
- lib/yahoo/placemaker/exception.rb
|
67
|
+
- lib/yahoo/placemaker/extents.rb
|
68
|
+
- lib/yahoo/placemaker/geographic_scope.rb
|
69
|
+
- lib/yahoo/placemaker/lat_lng.rb
|
70
|
+
- lib/yahoo/placemaker/local_scope.rb
|
71
|
+
- lib/yahoo/placemaker/place.rb
|
72
|
+
- lib/yahoo/placemaker/reference.rb
|
73
|
+
- lib/yahoo/placemaker/response.rb
|
74
|
+
- lib/yahoo/placemaker/scope.rb
|
75
|
+
- lib/yahoo/placemaker/version.rb
|
76
|
+
- spec/lat_lng_spec.rb
|
77
|
+
- spec/reference_spec.rb
|
75
78
|
- spec/spec_helper.rb
|
76
79
|
- spec/yahoo_placemaker_spec.rb
|
77
80
|
- yahoo-placemaker.gemspec
|
@@ -100,5 +103,7 @@ signing_key:
|
|
100
103
|
specification_version: 3
|
101
104
|
summary: Easily interact w/ the Yahoo Placemaker API
|
102
105
|
test_files:
|
106
|
+
- spec/lat_lng_spec.rb
|
107
|
+
- spec/reference_spec.rb
|
103
108
|
- spec/spec_helper.rb
|
104
109
|
- spec/yahoo_placemaker_spec.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'yahoo-placemaker/lat_lng'
|
2
|
-
|
3
|
-
class Yahoo::Placemaker::Extents
|
4
|
-
|
5
|
-
attr_accessor :center, :south_west, :north_east
|
6
|
-
|
7
|
-
def initialize(json)
|
8
|
-
@center = Yahoo::Placemaker::LatLng.new(json['center'])
|
9
|
-
@south_west = Yahoo::Placemaker::LatLng.new(json['southWest'])
|
10
|
-
@north_east = Yahoo::Placemaker::LatLng.new(json['northEast'])
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'yahoo-placemaker/scope'
|
2
|
-
require 'yahoo-placemaker/ancestor'
|
3
|
-
|
4
|
-
class Yahoo::Placemaker::LocalScope < Yahoo::Placemaker::Scope
|
5
|
-
|
6
|
-
attr_accessor :ancestors, :centroid, :south_west, :north_east
|
7
|
-
|
8
|
-
def initialize (json)
|
9
|
-
super(json)
|
10
|
-
@centroid = Yahoo::Placemaker::LatLng.new json['centroid']
|
11
|
-
@south_west = Yahoo::Placemaker::LatLng.new json['southWest']
|
12
|
-
@north_east = Yahoo::Placemaker::LatLng.new json['northEast']
|
13
|
-
@ancestors = Array.new
|
14
|
-
if json['ancestors'].class == Array
|
15
|
-
json['ancestors'].each do |ancestor|
|
16
|
-
@ancestors << Yahoo::Placemaker::Ancestor.new(ancestor['ancestor'])
|
17
|
-
end
|
18
|
-
elsif json['ancestors'].class == Hash
|
19
|
-
@ancestors << Yahoo::Placemaker::Ancestor.new(json['ancestors']['ancestor'])
|
20
|
-
else
|
21
|
-
# no ancestors...country?
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'yahoo-placemaker/lat_lng'
|
2
|
-
|
3
|
-
class Yahoo::Placemaker::Place
|
4
|
-
|
5
|
-
attr_accessor :place_id, :match_type, :place_reference_ids, :weight, :confidence
|
6
|
-
attr_accessor :centroid, :type, :woe_id, :name
|
7
|
-
|
8
|
-
def initialize(json)
|
9
|
-
|
10
|
-
@place_id = json['placeId']
|
11
|
-
@centroid = Yahoo::Placemaker::LatLng.new json['place']['centroid']
|
12
|
-
@type = json['place']['type']
|
13
|
-
@woe_id = json['place']['woeId']
|
14
|
-
@name = json['place']['name']
|
15
|
-
|
16
|
-
@match_type = json['matchType']
|
17
|
-
@place_reference_ids = json['placeReferenceIds']
|
18
|
-
@weight = json['weight'].to_i
|
19
|
-
@confidence = json['confidence'].to_i
|
20
|
-
end
|
21
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class Yahoo::Placemaker::Reference
|
2
|
-
attr_accessor :woe_ids, :end, :start, :place_reference_id, :place_ids, :text, :type, :xpath, :is_plaintext_marker
|
3
|
-
|
4
|
-
def initialize(json)
|
5
|
-
@woe_ids = json['woeIds']
|
6
|
-
@end = json['end'].to_i
|
7
|
-
@start = json['start'].to_i
|
8
|
-
@place_reference_id = json['placeReferenceId']
|
9
|
-
@place_ids = json['placeIds']
|
10
|
-
@text = json['text']
|
11
|
-
@type = json['type']
|
12
|
-
@xpath = json['xpath']
|
13
|
-
@is_plaintext_marker = json['isPlaintextMarker']
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'yahoo-placemaker/document'
|
2
|
-
|
3
|
-
class Yahoo::Placemaker::Response
|
4
|
-
attr_accessor :document, :version, :processing_time
|
5
|
-
def initialize (json)
|
6
|
-
@document = Yahoo::Placemaker::Document.new(json['document'])
|
7
|
-
@version = json['version']
|
8
|
-
@processing_time = json['processingTime']
|
9
|
-
end
|
10
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'yahoo-placemaker/lat_lng'
|
2
|
-
|
3
|
-
class Yahoo::Placemaker::Scope
|
4
|
-
attr_accessor :woe_id, :type, :name, :centroid
|
5
|
-
|
6
|
-
def initialize(json)
|
7
|
-
@centroid = Yahoo::Placemaker::LatLng.new(json['centroid'])
|
8
|
-
@woe_id = json['woeId']
|
9
|
-
@type = json['type']
|
10
|
-
@name = json['name']
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|