geoplanet 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48f9a1e864994edc2566bf32bb9fa7c847437fa6
4
- data.tar.gz: 40ad06343c7b5a48b2dc16a683592e3c58ba975e
3
+ metadata.gz: 541c8406d8b069526b90a0d107fe69077d1bce66
4
+ data.tar.gz: bd1b20bba88e035d7bd4b1ec591489e98796471a
5
5
  SHA512:
6
- metadata.gz: 7b9cb13658ac365bc6229e075f78454dccf658033be8630cfd04bf1525f3c96ef6144b599bf5341393da8aae02c48b67520f84a4ce6f5859fcbdacd9d6c5d9a1
7
- data.tar.gz: 114fcc912096be99bf91f8681d99c559bb8d3e57e468552bdff1d585e2a6229345d66e44ec28f1b9b8093818b3c431dfa8c5c8e3a7aa8aaa395780fc3f7fced3
6
+ metadata.gz: 1cb3bc646df6394e049c9e2230a3ab00cf75f96cc75c055f9ad2b9ebd184f92868fa54adfa02c8e7dd4c44645ab8a8d20669bc6602492e30da2c430953240867
7
+ data.tar.gz: 1ecef6f061c9ebb86182225701ff1d8f37589d3f345f881fa68cbe7383271bf46a6309680c5a02e6255f01b70dc6e5f1c3083326549548d44945e60d57c49819
@@ -1,3 +1,5 @@
1
+ {<img src="https://badge.fury.io/rb/geoplanet.svg" alt="Gem Version" />}[http://badge.fury.io/rb/geoplanet]
2
+
1
3
  = geoplanet
2
4
 
3
5
  A Ruby wrapper for the Yahoo! GeoPlanet APIs. It's inspired on Mattt Thompson's yahoo-geoplanet gem,
@@ -140,4 +142,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
140
142
 
141
143
  Carlos Paramio
142
144
 
143
- http://h1labs.com
145
+ http://carlosparamio.com
@@ -1,14 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = "geoplanet"
3
- s.version = "0.2.7"
4
- s.date = "2014-05-09"
5
- s.summary = "A Ruby wrapper for the Yahoo! GeoPlanet API."
6
- s.email = "carlosparamio@gmail.com"
7
- s.homepage = "http://github.com/carlosparamio/geoplanet/"
2
+ s.name = "geoplanet"
3
+ s.version = "0.2.8"
4
+ s.date = "2014-05-09"
5
+ s.summary = "A Ruby wrapper for the Yahoo! GeoPlanet API."
6
+ s.email = "carlosparamio@gmail.com"
7
+ s.homepage = "http://github.com/carlosparamio/geoplanet/"
8
8
  s.description = "A Ruby wrapper for the Yahoo! GeoPlanet API. It uses JSON format by default to minimize bandwidth usage. See http://developer.yahoo.com/geo/ for more information about the API."
9
- s.authors = ["Carlos Paramio"]
9
+ s.authors = ["Carlos Paramio"]
10
10
 
11
- s.files = [
11
+ s.files = [
12
12
  "README.rdoc",
13
13
  "CONTRIBUTORS",
14
14
  "geoplanet.gemspec",
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
18
18
  "lib/geoplanet/version.rb"
19
19
  ]
20
20
 
21
- s.add_dependency("rest-client", [">= 0.9"])
22
- s.add_dependency("json", [">= 1.1.3"])
21
+ s.add_runtime_dependency 'rest-client', '~> 0.9'
22
+ s.add_runtime_dependency 'json', '~> 1.1'
23
23
 
24
24
  s.has_rdoc = false
25
25
  s.rdoc_options = ["--main", "README.rdoc"]
@@ -7,12 +7,12 @@ require 'geoplanet/place'
7
7
  module GeoPlanet
8
8
  API_VERSION = "v1"
9
9
  API_URL = "http://where.yahooapis.com/#{API_VERSION}/"
10
-
10
+
11
11
  class << self
12
12
  attr_accessor :appid, :debug
13
13
  end
14
14
 
15
- class BadRequest < StandardError; end
16
- class NotFound < StandardError; end
17
- class NotAcceptable < StandardError; end
15
+ class BadRequest < StandardError; end
16
+ class NotFound < StandardError; end
17
+ class NotAcceptable < StandardError; end
18
18
  end
@@ -37,7 +37,8 @@ module GeoPlanet
37
37
  raise NotFound, "woeid or URI invalid"
38
38
  end
39
39
 
40
- protected
40
+ protected
41
+
41
42
  def supported_options_for(resource_path)
42
43
  case resource_path
43
44
  when 'places'
@@ -25,8 +25,8 @@ module GeoPlanet
25
25
 
26
26
  def self.get_then_parse(url)
27
27
  results = JSON.parse get(url).to_s
28
- return results['places']['place'].map{|attrs| Place.new attrs} if results['places']
29
- return Place.new(results['place']) if results['place']
28
+ return results['places']['place'].map{|attrs| self.new attrs} if results['places']
29
+ return self.new(results['place']) if results['place']
30
30
  nil
31
31
  rescue
32
32
  nil
@@ -34,11 +34,11 @@ module GeoPlanet
34
34
 
35
35
  %w(parent ancestors belongtos neighbors siblings children descendants).each do |association|
36
36
  self.instance_eval <<-RUBY, __FILE__, __LINE__ + 1
37
- def self.#{association}_of(woeid, options = {})
37
+ def self.#{association}_of(woeid, options = {})
38
38
  url = build_url("place/\#{woeid}/#{association}", options.merge(:format => "json"))
39
39
  puts "Yahoo GeoPlanet: GET \#{url}" if GeoPlanet.debug
40
- get_then_parse(url)
41
- end
40
+ get_then_parse(url)
41
+ end
42
42
  RUBY
43
43
  end
44
44
 
@@ -55,7 +55,7 @@ module GeoPlanet
55
55
  def initialize_with_woe(woe, options = {})
56
56
  url = self.class.build_url("place/#{woe}", options.merge(:format => "json"))
57
57
  puts "Yahoo GeoPlanet: GET #{url}" if GeoPlanet.debug
58
- initialize_with_attrs JSON.parse(Place.get(url))['place']
58
+ initialize_with_attrs JSON.parse(self.class.get(url))['place']
59
59
  end
60
60
 
61
61
 
@@ -78,7 +78,7 @@ module GeoPlanet
78
78
  attrs['boundingBox']['southWest']['longitude'] ],
79
79
  [ attrs['boundingBox']['northEast']['latitude'],
80
80
  attrs['boundingBox']['northEast']['longitude'] ],
81
- ]
81
+ ]
82
82
  @country = attrs['country']
83
83
  @country_code = attrs['country attrs']['code'] rescue nil
84
84
  @postal = attrs['postal']
@@ -104,9 +104,9 @@ module GeoPlanet
104
104
  # Association Collections
105
105
  %w(parent ancestors belongtos neighbors siblings children descendants).each do |association|
106
106
  self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
107
- def #{association}(options = {})
108
- Place.send("#{association}_of", self.woeid, options)
109
- end
107
+ def #{association}(options = {})
108
+ self.class.send("#{association}_of", self.woeid, options)
109
+ end
110
110
  RUBY
111
111
  end
112
112
 
@@ -119,7 +119,7 @@ module GeoPlanet
119
119
  end
120
120
 
121
121
  def inspect
122
- "#<GeoPlanet::Place #{instance_variables.map{|ivar| "#{ivar}: #{instance_variable_get(ivar).inspect}"}.join(', ')}>"
122
+ "#<#{self.class} #{instance_variables.map{|ivar| "#{ivar}: #{instance_variable_get(ivar).inspect}"}.join(', ')}>"
123
123
  end
124
124
 
125
125
  end
@@ -2,7 +2,7 @@ module GeoPlanet
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 6
5
+ TINY = 8
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoplanet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Paramio
@@ -14,30 +14,30 @@ dependencies:
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.3
33
+ version: '1.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.1.3
40
+ version: '1.1'
41
41
  description: A Ruby wrapper for the Yahoo! GeoPlanet API. It uses JSON format by default
42
42
  to minimize bandwidth usage. See http://developer.yahoo.com/geo/ for more information
43
43
  about the API.