yahoo-placemaker 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,2 @@
1
1
  source "http://rubygems.org"
2
- gemspec
3
-
4
- gem 'rake', '>= 0.8.7'
5
- gem 'json'
2
+ gemspec
@@ -12,6 +12,8 @@ module Yahoo
12
12
 
13
13
  def self.extract (text = '', options = {})
14
14
 
15
+ # TODO: make sure only valid options are passed in..
16
+
15
17
  unless defined?(Yahoo::Placemaker::APP_ID)
16
18
  raise Yahoo::Placemaker::Exception.new("Invalid APP_ID")
17
19
  end
@@ -11,16 +11,18 @@ module Yahoo
11
11
  attr_accessor :administrative_scope, :geographic_scope, :local_scopes, :references, :extents, :places
12
12
  def initialize(json)
13
13
 
14
- if json['administrativeScope']
15
- @administrative_scope = json['administrativeScope']
16
- end
17
-
18
14
  if json['geographicScope']
19
15
  @geographic_scope = Yahoo::Placemaker::GeographicScope.new(json['geographicScope'])
20
16
  end
21
17
 
18
+ # If Yahoo has detected a continent then it will return some REALLY annoying data. It will
19
+ # give us back administrativeScope hash w/ a type of "Undefined" and coordinates of 0,0.
20
+ # Obviously this isn't useful information so we won't set @administrative_scope in that case
21
+
22
22
  if json['administrativeScope']
23
- @administrative_scope = Yahoo::Placemaker::AdministrativeScope.new(json['administrativeScope'])
23
+ unless json['administrativeScope']['type'] == 'Undefined'
24
+ @administrative_scope = Yahoo::Placemaker::AdministrativeScope.new(json['administrativeScope'])
25
+ end
24
26
  end
25
27
 
26
28
  @places = Array.new
@@ -1,5 +1,5 @@
1
1
  module Yahoo
2
2
  module Placemaker
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -37,6 +37,13 @@ describe Yahoo::Placemaker do
37
37
  end
38
38
  end
39
39
 
40
+ it "should not have an administrative_scope" do
41
+ VCR.use_cassette('africa') do
42
+ response = Yahoo::Placemaker::extract "Africa"
43
+ response.document.administrative_scope.should == nil
44
+ end
45
+ end
46
+
40
47
  it "doesn't return any places for 'foobar'" do
41
48
  VCR.use_cassette('foobar') do
42
49
  response = Yahoo::Placemaker.extract "foobar"
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.version = Yahoo::Placemaker::VERSION
9
9
  s.authors = ["Kyle Decot"]
10
10
  s.email = ["kyle.decot@me.com"]
11
- s.homepage = ""
11
+ s.homepage = "http://github.com/kyledecot/yahoo-placemaker"
12
12
  s.summary = "Easily interact w/ the Yahoo Placemaker API"
13
13
  s.description = "Easily interact w/ the Yahoo Placemaker API"
14
14
 
@@ -19,6 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
+ s.add_runtime_dependency "json"
23
+
24
+ s.add_development_dependency "rake"
22
25
  s.add_development_dependency "rspec"
23
26
  s.add_development_dependency "fakeweb"
24
27
  s.add_development_dependency "vcr"
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.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,9 +11,31 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-02-27 00:00:00.000000000Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: &70178721828820 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70178721828820
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70178721824120 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70178721824120
14
36
  - !ruby/object:Gem::Dependency
15
37
  name: rspec
16
- requirement: &70155972433600 !ruby/object:Gem::Requirement
38
+ requirement: &70178721822780 !ruby/object:Gem::Requirement
17
39
  none: false
18
40
  requirements:
19
41
  - - ! '>='
@@ -21,10 +43,10 @@ dependencies:
21
43
  version: '0'
22
44
  type: :development
23
45
  prerelease: false
24
- version_requirements: *70155972433600
46
+ version_requirements: *70178721822780
25
47
  - !ruby/object:Gem::Dependency
26
48
  name: fakeweb
27
- requirement: &70155972433000 !ruby/object:Gem::Requirement
49
+ requirement: &70178721821840 !ruby/object:Gem::Requirement
28
50
  none: false
29
51
  requirements:
30
52
  - - ! '>='
@@ -32,10 +54,10 @@ dependencies:
32
54
  version: '0'
33
55
  type: :development
34
56
  prerelease: false
35
- version_requirements: *70155972433000
57
+ version_requirements: *70178721821840
36
58
  - !ruby/object:Gem::Dependency
37
59
  name: vcr
38
- requirement: &70155972432000 !ruby/object:Gem::Requirement
60
+ requirement: &70178721821280 !ruby/object:Gem::Requirement
39
61
  none: false
40
62
  requirements:
41
63
  - - ! '>='
@@ -43,7 +65,7 @@ dependencies:
43
65
  version: '0'
44
66
  type: :development
45
67
  prerelease: false
46
- version_requirements: *70155972432000
68
+ version_requirements: *70178721821280
47
69
  description: Easily interact w/ the Yahoo Placemaker API
48
70
  email:
49
71
  - kyle.decot@me.com
@@ -51,7 +73,6 @@ executables: []
51
73
  extensions: []
52
74
  extra_rdoc_files: []
53
75
  files:
54
- - .gemtest
55
76
  - .gitignore
56
77
  - .rspec
57
78
  - Gemfile
@@ -78,7 +99,7 @@ files:
78
99
  - spec/spec_helper.rb
79
100
  - spec/yahoo_placemaker_spec.rb
80
101
  - yahoo-placemaker.gemspec
81
- homepage: ''
102
+ homepage: http://github.com/kyledecot/yahoo-placemaker
82
103
  licenses: []
83
104
  post_install_message:
84
105
  rdoc_options: []
data/.gemtest DELETED
File without changes