google_geocoding 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{google_geocoding}
8
- s.version = "0.1.5"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rodrigo Kochenburger"]
12
- s.date = %q{2010-03-04}
12
+ s.date = %q{2010-03-30}
13
13
  s.description = %q{GoogleGeocoding is a small library for performing geocoding using the Google's HTTP geocoding API}
14
14
  s.email = %q{divoxx@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -25,21 +25,29 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "google_geocoding.gemspec",
27
27
  "lib/google_geocoding.rb",
28
+ "lib/google_geocoding/address_component.rb",
28
29
  "lib/google_geocoding/errors.rb",
29
30
  "lib/google_geocoding/geocoder.rb",
30
- "lib/google_geocoding/placemark.rb",
31
+ "lib/google_geocoding/request.rb",
31
32
  "lib/google_geocoding/response.rb",
32
- "spec/google_geocoding_spec.rb",
33
+ "lib/google_geocoding/result.rb",
34
+ "spec/classes/request_spec.rb",
35
+ "spec/classes/response_spec.rb",
36
+ "spec/classes/result_spec.rb",
37
+ "spec/integration_spec.rb",
33
38
  "spec/spec.opts",
34
39
  "spec/spec_helper.rb"
35
40
  ]
36
41
  s.homepage = %q{http://github.com/divoxx/google_geocoding}
37
42
  s.rdoc_options = ["--charset=UTF-8"]
38
43
  s.require_paths = ["lib"]
39
- s.rubygems_version = %q{1.3.5}
44
+ s.rubygems_version = %q{1.3.6}
40
45
  s.summary = %q{Google's geocoding library}
41
46
  s.test_files = [
42
- "spec/google_geocoding_spec.rb",
47
+ "spec/classes/request_spec.rb",
48
+ "spec/classes/response_spec.rb",
49
+ "spec/classes/result_spec.rb",
50
+ "spec/integration_spec.rb",
43
51
  "spec/spec_helper.rb"
44
52
  ]
45
53
 
@@ -0,0 +1,25 @@
1
+ module GoogleGeocoding
2
+ class AddressComponent
3
+ REQUIRED_ATTRIBUTES = [:long_name, :short_name, :types].freeze
4
+ attr_reader *REQUIRED_ATTRIBUTES
5
+
6
+ def initialize(params)
7
+ process_args(params)
8
+ end
9
+
10
+ private
11
+ def process_args(args)
12
+ error = Errors::InvalidParametersError.new(self)
13
+
14
+ REQUIRED_ATTRIBUTES.each do |req_attr|
15
+ error.add(req_attr, :required) unless args.include?(req_attr)
16
+ end
17
+
18
+ raise error unless error.empty?
19
+
20
+ @types = Array(args[:types]).map { |type| type.to_sym }.freeze
21
+ @long_name = args[:long_name].freeze
22
+ @short_name = args[:short_name].freeze
23
+ end
24
+ end
25
+ end
@@ -1,75 +1,44 @@
1
1
  module GoogleGeocoding
2
2
  module Errors
3
- # Base error for the geocoding service, all error should inherit from this one.
4
- class BaseError < StandardError; end
5
-
6
- # Http error, will be raised when the server returns with a status code outside the 200...300 range.
7
- class HttpError < BaseError
8
- def initialize(address, response)
9
- @address = address
10
- @response = response
11
- super "Could not geocode '#{@address}'. Server responded with #{@response.status}"
3
+ # Error representing that the parameters provided to the request are invalid.
4
+ class InvalidParametersError < BaseError
5
+ def initialize(request)
6
+ @request = request
7
+ @messages = Hash.new { |h,k| h[k] = [] }
12
8
  end
13
- end
14
-
15
- # Services error means the service was reached but returned a unsuccessful response.
16
- class ServiceError < BaseError; end
17
-
18
- # 500 G_GEO_SERVER_ERROR
19
- class ServerError < ServiceError
20
- def initialize
21
- super("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is unknown.")
22
- end
23
- end
24
-
25
- # 601 G_GEO_MISSING_QUERY
26
- class MissingQueryError < ServiceError
27
- def initialize
28
- super("An empty address was specified")
29
- end
30
- end
31
9
 
32
- # 602 G_GEO_UNKNOWN_ADDRESS
33
- class UnknownAddressError < ServiceError
34
- def initialize
35
- super("No corresponding geographic location could be found for the specified address, possibly because the address is relatively new, or because it may be incorrect.")
10
+ # Add a error message for the given param.
11
+ def add(param, identifier)
12
+ @messages[param] << identifier
36
13
  end
37
- end
38
-
39
- # 603 G_GEO_UNAVAILABLE_ADDRESS
40
- class UnavailableAddressError < ServiceError
41
- def initialize
42
- super("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.")
14
+
15
+ # Returns the messages for the given param
16
+ def on(param)
17
+ @messages[param]
43
18
  end
44
- end
45
-
46
- # 610 G_GEO_BAD_KEY
47
- class BadKeyError < ServiceError
48
- def initialize
49
- super("The given key is either invalid or does not match the domain for which it was given.")
19
+
20
+ # Returns a descriptive message of the error.
21
+ def message
22
+ message = "Some of the request parameters are invalid:"
23
+ @messages.each { |param, identifiers| message << "\n * #{param}: #{identifiers.join(', ')}" }
24
+ message
50
25
  end
51
- end
52
-
53
- # 620 G_GEO_TOO_MANY_QUERIES
54
- class TooManyQueriesError < ServiceError
55
- def initialize
56
- super("The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time. If you're sending multiple requests in parallel or in a tight loop, use a timer or pause in your code to make sure you don't send the requests too quickly.")
26
+
27
+ # Alias to_s to messages for easy terminal output
28
+ alias_method :to_s, :message
29
+
30
+ # Returns true/false for whether there are an error on any params
31
+ def empty?
32
+ @messages.empty?
57
33
  end
58
34
  end
59
35
 
60
- # Extend ServiceError to include factory method based on status codes.
61
- class ServiceError
62
- ERRORS_MAPPING = {
63
- 500 => ServerError,
64
- 601 => MissingQueryError,
65
- 602 => UnknownAddressError,
66
- 603 => UnknownAddressError,
67
- 610 => BadKeyError,
68
- 620 => TooManyQueriesError
69
- }
70
-
71
- def self.build(status)
72
- ERRORS_MAPPING[status].new
36
+ # Http error, will be raised when the server returns with a status code outside the 200...300 range.
37
+ class HttpError < BaseError
38
+ def initialize(address, response)
39
+ @address = address
40
+ @response = response
41
+ super "Could not geocode '#{@address}'. Server responded with #{@response.status}"
73
42
  end
74
43
  end
75
44
  end
@@ -10,7 +10,7 @@ module GoogleGeocoding
10
10
  @options = options
11
11
  @sess = Patron::Session.new
12
12
  @sess.timeout = options[:timeout] || 10
13
- @sess.base_url = "http://maps.google.com/maps/geo"
13
+ @sess.base_url = "http://maps.google.com/maps/api/geocode"
14
14
  @sess.headers['User-Agent'] = options[:user_agent]
15
15
  end
16
16
 
@@ -19,12 +19,11 @@ module GoogleGeocoding
19
19
  # @param [String, #to_s]
20
20
  # @return [Response]
21
21
  def query(address)
22
- params = "?q=#{URI.encode(address.to_s)}"
23
- params << "&key=#{@options[:api_key]}" if @options[:api_key]
24
- resp = @sess.get(params)
22
+ request = Request.new(:address => address, :sensor => false)
23
+ response = @sess.get("/json?#{request.query_string}")
25
24
 
26
- if (200...300).include?(resp.status)
27
- Response.new(resp.body)
25
+ if (200...300).include?(response.status)
26
+ Response.new(response.body)
28
27
  else
29
28
  raise Errors::HttpError.new(address, resp)
30
29
  end
@@ -0,0 +1,47 @@
1
+ module GoogleGeocoding
2
+ # Encapsulation of the request information to be sent to the API endpoing.
3
+ class Request
4
+ # Creates a new request.
5
+ #
6
+ # @param [Hash] params hash of the parameters for the request. Valid parameters are:
7
+ # - address (required) - The address that you want to geocode.
8
+ # - *OR* latlng (required) - The textual latitude/longitude value for which you wish to obtain the closest, human-readable address.
9
+ # - bounds (optional) - The bounding box of the viewport within which to bias geocode results more prominently.
10
+ # - region (optional) - The region code, specified as a ccTLD ("top-level domain") two-character value.
11
+ # - language (optional) - The language in which to return results. See the supported list of domain languages.
12
+ # - sensor (required) - Indicates whether or not the geocoding request comes from a device with a location sensor. This value must be either true or false.
13
+ #
14
+ # @raise InvalidRequestParametersError
15
+ def initialize(params = {})
16
+ @params = params.dup
17
+ check_params!
18
+ end
19
+
20
+ # Return the request query string.
21
+ # @return [String]
22
+ def query_string
23
+ @params.map { |param, value| "#{CGI.escape(param.to_s)}=#{CGI.escape(value.to_s)}" }.join("&")
24
+ end
25
+
26
+ private
27
+ def check_params!
28
+ error = Errors::InvalidParametersError.new(self)
29
+
30
+ if @params[:address].nil?
31
+ error.add(:address, :required)
32
+ end
33
+
34
+ if @params[:required] && @params[:latlng].nil?
35
+ error.add(:latlng, :required)
36
+ end
37
+
38
+ if @params[:sensor].nil?
39
+ error.add(:sensor, :required)
40
+ elsif ![true, false].include?(@params[:sensor])
41
+ error.add(:sensor, :boolean)
42
+ end
43
+
44
+ raise error unless error.empty?
45
+ end
46
+ end
47
+ end
@@ -3,71 +3,44 @@ module GoogleGeocoding
3
3
  # Creates a new response object from the given response body, expects to be a JSON string.
4
4
  #
5
5
  # @param [String]
6
- def initialize(resp_body)
7
- @data = JSON.parse(resp_body)
6
+ def initialize(payload, result_class = nil)
7
+ @data = JSON.parse(payload)
8
+ @result_class = result_class || GoogleGeocoding.const_get(:Result)
8
9
  end
9
10
 
10
11
  # Return the status code included in the server response.
11
12
  #
12
- # @return [Integer]
13
- # @see http://code.google.com/apis/maps/documentation/geocoding/index.html#StatusCodes
14
- def status_code
15
- Integer(@data["Status"]["code"])
13
+ # @return [Symbol]
14
+ # @see http://code.google.com/apis/maps/documentation/geocoding/#StatusCodes
15
+ def status
16
+ @status ||= @data["status"].downcase.to_sym
16
17
  end
17
18
 
18
19
  # Return whether response successfully resolved the geolocation
19
20
  def success?
20
- status_code == 200
21
+ status == :ok
21
22
  end
22
23
 
23
24
  # Return whether response failed to resolved the geolocation
24
25
  def failure?
25
26
  !success?
26
27
  end
27
-
28
- # Return the placemarks included in the response.
29
- #
30
- # @return [Array<Placemark>]
31
- def placemarks
32
- if failure?
33
- raise Errors::ServiceError.build(status_code)
34
- else
35
- placemarks = []
36
-
37
- @data["Placemark"].each do |placemark_data|
38
- details = placemark_data["AddressDetails"]
39
- coordinates = placemark_data["Point"]["coordinates"][0..1].reverse
40
- accurracy = Integer(details["Accuracy"])
41
- placemark = Placemark.new
42
- placemark.accurracy = accurracy
43
- placemark.coordinates = coordinates
44
-
45
- if country = details["Country"]
46
- placemark.country_name = country["CountryName"],
47
- placemark.country_code = country["CountryNameCode"]
48
-
49
- if admarea = country["AdministrativeArea"]
50
- placemark.region = admarea["AdministrativeAreaName"]
51
- subadmarea = admarea["SubAdministrativeArea"]
52
- locality = subadmarea ? subadmarea["Locality"] : admarea["Locality"]
53
-
54
- if locality
55
- placemark.city = locality["LocalityName"]
56
-
57
- if postal_code = locality["PostalCode"]
58
- placemark.postal_code = postal_code["PostalCodeNumber"]
59
- end
60
-
61
- if thoroughfare = locality["Thoroughfare"]
62
- placemark.street = thoroughfare["ThoroughfareName"]
63
- end
64
- end
65
- end
66
- end
67
-
68
- placemarks << placemark
28
+
29
+ # Return the types of the result
30
+ def results
31
+ @result ||= @data["results"].map do |result_data|
32
+ result = @result_class.new(
33
+ :types => result_data["types"],
34
+ :address => result_data["formatted_address"],
35
+ :coordinates => result_data["geometry"]["location"].values_at("lat", "lng"),
36
+ :precision => result_data["geometry"]["location_type"]
37
+ )
38
+
39
+ result_data["address_components"].each do |addr_comp_data|
40
+ result << AddressComponent.new(:short_name => addr_comp_data["short_name"], :long_name => addr_comp_data["long_name"], :types => addr_comp_data["types"])
69
41
  end
70
- placemarks
42
+
43
+ result
71
44
  end
72
45
  end
73
46
  end
@@ -0,0 +1,36 @@
1
+ module GoogleGeocoding
2
+ # Model that represents a placemark returned by the geocoding service.
3
+ class Result
4
+ REQUIRED_ATTRIBUTES = [:types, :address, :coordinates, :precision].freeze
5
+ attr_reader :components, *REQUIRED_ATTRIBUTES
6
+
7
+ def initialize(args = {})
8
+ process_args(args)
9
+ @components = []
10
+ end
11
+
12
+ def <<(component)
13
+ @components << component
14
+ end
15
+
16
+ def each(&block)
17
+ @component.each(&block)
18
+ end
19
+
20
+ private
21
+ def process_args(args)
22
+ error = Errors::InvalidParametersError.new(self)
23
+
24
+ REQUIRED_ATTRIBUTES.each do |req_attr|
25
+ error.add(req_attr, :required) unless args.include?(req_attr)
26
+ end
27
+
28
+ raise error unless error.empty?
29
+
30
+ @types = Array(args[:types]).map { |type| type.to_sym }.freeze
31
+ @address = args[:address].freeze
32
+ @coordinates = args[:coordinates].freeze
33
+ @precision = args[:precision].downcase.to_sym
34
+ end
35
+ end
36
+ end
@@ -1,6 +1,23 @@
1
+ begin
2
+ require 'rubygems'
3
+ rescue LoadError
4
+ # Ignore
5
+ end
6
+
7
+ # Dependencies
8
+ require 'cgi'
1
9
  require 'json'
2
10
  require 'patron'
11
+
12
+ module GoogleGeocoding
13
+ # Base class for all errors
14
+ class BaseError < StandardError; end
15
+ end
16
+
17
+ # Require google_geocoding parts
3
18
  require 'google_geocoding/errors'
4
- require 'google_geocoding/placemark'
19
+ require 'google_geocoding/request'
20
+ require 'google_geocoding/address_component'
21
+ require 'google_geocoding/result'
5
22
  require 'google_geocoding/response'
6
23
  require 'google_geocoding/geocoder'
@@ -0,0 +1,26 @@
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
+
3
+ describe Request do
4
+ describe "request creation" do
5
+ it "should create a request with valid params" do
6
+ lambda { Request.new(:address => "2 Townsend St, San Francisco, CA", :sensor => false) }.should_not raise_error(Errors::InvalidParametersError)
7
+ end
8
+
9
+ it "should raise InvalidRequestParametersError when address is missing" do
10
+ lambda { Request.new }.should raise_error(Errors::InvalidParametersError) do |error|
11
+ error.on_param(:address).should include(:required)
12
+ error.on_param(:sensor).should include(:required)
13
+ end
14
+ end
15
+ end
16
+
17
+ describe "request usage" do
18
+ before :each do
19
+ @request = Request.new(:address => "2 Townsend St, San Francisco, CA", :sensor => false)
20
+ end
21
+
22
+ it "should return the query string" do
23
+ @request.query_string.should == "address=2+Townsend+St%2C+San+Francisco%2C+CA&sensor=false"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,80 @@
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
+
3
+ describe Response do
4
+ before :each do
5
+ @result_inst = mock(:result_instance, :<< => nil)
6
+ @result_class = mock(:result_class, :new => @result_inst)
7
+ @response = Response.new(DATA, @result_class)
8
+ end
9
+
10
+ it "should provide status" do
11
+ @response.status.should == :ok
12
+ end
13
+
14
+ it "should provide whether it is a successful request" do
15
+ @response.should be_success
16
+ end
17
+
18
+ it "should provide whether it is a failure request" do
19
+ @response.should_not be_failure
20
+ end
21
+
22
+ it "should provide the results" do
23
+ args = {:types => ["street_address"], :address => "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA", :coordinates => [37.4219720, -122.0841430], :precision => "ROOFTOP"}
24
+ @result_class.should_receive(:new).once.with(args).and_return(@result_inst)
25
+ @response.results.should be_instance_of(Array)
26
+ @response.results.each { |item| item.should be(@result_inst) }
27
+ end
28
+
29
+ DATA = <<-EOF
30
+ {
31
+ "status": "OK",
32
+ "results": [ {
33
+ "types": [ "street_address" ],
34
+ "formatted_address": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
35
+ "address_components": [ {
36
+ "long_name": "1600",
37
+ "short_name": "1600",
38
+ "types": [ "street_number" ]
39
+ }, {
40
+ "long_name": "Amphitheatre Pkwy",
41
+ "short_name": "Amphitheatre Pkwy",
42
+ "types": [ "route" ]
43
+ }, {
44
+ "long_name": "Mountain View",
45
+ "short_name": "Mountain View",
46
+ "types": [ "locality", "political" ]
47
+ }, {
48
+ "long_name": "California",
49
+ "short_name": "CA",
50
+ "types": [ "administrative_area_level_1", "political" ]
51
+ }, {
52
+ "long_name": "United States",
53
+ "short_name": "US",
54
+ "types": [ "country", "political" ]
55
+ }, {
56
+ "long_name": "94043",
57
+ "short_name": "94043",
58
+ "types": [ "postal_code" ]
59
+ } ],
60
+ "geometry": {
61
+ "location": {
62
+ "lat": 37.4219720,
63
+ "lng": -122.0841430
64
+ },
65
+ "location_type": "ROOFTOP",
66
+ "viewport": {
67
+ "southwest": {
68
+ "lat": 37.4188244,
69
+ "lng": -122.0872906
70
+ },
71
+ "northeast": {
72
+ "lat": 37.4251196,
73
+ "lng": -122.0809954
74
+ }
75
+ }
76
+ }
77
+ } ]
78
+ }
79
+ EOF
80
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
+
3
+ describe Result do
4
+ describe "result creation" do
5
+ it "should create object and set properties" do
6
+ result = Result.new(
7
+ :types => ["street_address"],
8
+ :address => "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
9
+ :coordinates => [37.4219720, -122.0841430],
10
+ :precision => "ROOFTOP"
11
+ )
12
+
13
+ result.types.should == [:street_address]
14
+ result.address.should == "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA"
15
+ result.coordinates.should == [37.4219720, -122.0841430]
16
+ result.precision.should == :rooftop
17
+ end
18
+
19
+ %w(types address coordinates precision).each do |missing_attr|
20
+ it "should raise an error when #{missing_attr} is missing" do
21
+ attrs = {
22
+ :types => ["street_address"],
23
+ :address => "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
24
+ :coordinates => [37.4219720, -122.0841430],
25
+ :precision => "ROOFTOP"
26
+ }
27
+ attrs.delete(missing_attr.to_sym)
28
+ lambda { Result.new(attrs) }.should raise_error(Errors::InvalidParametersError)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,14 @@
1
+ require File.expand_path("../spec_helper", __FILE__)
2
+
3
+ describe "Full-stack geocoding (Integration test)" do
4
+ before :each do
5
+ @geocoder = GoogleGeocoding::Geocoder.new
6
+ end
7
+
8
+ it "should return successful response with valida address" do
9
+ pending
10
+ response = @geocoder.query("2 Townsend St, San Francisco, CA")
11
+ response.status.should == :ok
12
+ response.should be_success
13
+ end
14
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,7 @@ require 'google_geocoding'
4
4
  require 'spec'
5
5
  require 'spec/autorun'
6
6
 
7
+ include GoogleGeocoding
8
+
7
9
  Spec::Runner.configure do |config|
8
-
9
10
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_geocoding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Rodrigo Kochenburger
@@ -9,49 +14,65 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-03-04 00:00:00 -08:00
17
+ date: 2010-03-30 00:00:00 -07:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: json
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 0
23
31
  version: 1.2.0
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: patron
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 4
44
+ - 5
33
45
  version: 0.4.5
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: rspec
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 2
58
+ - 9
43
59
  version: 1.2.9
44
- version:
60
+ type: :development
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
63
  name: yard
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - ">="
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ - 5
72
+ - 3
53
73
  version: 0.5.3
54
- version:
74
+ type: :development
75
+ version_requirements: *id004
55
76
  description: GoogleGeocoding is a small library for performing geocoding using the Google's HTTP geocoding API
56
77
  email: divoxx@gmail.com
57
78
  executables: []
@@ -70,11 +91,16 @@ files:
70
91
  - VERSION
71
92
  - google_geocoding.gemspec
72
93
  - lib/google_geocoding.rb
94
+ - lib/google_geocoding/address_component.rb
73
95
  - lib/google_geocoding/errors.rb
74
96
  - lib/google_geocoding/geocoder.rb
75
- - lib/google_geocoding/placemark.rb
97
+ - lib/google_geocoding/request.rb
76
98
  - lib/google_geocoding/response.rb
77
- - spec/google_geocoding_spec.rb
99
+ - lib/google_geocoding/result.rb
100
+ - spec/classes/request_spec.rb
101
+ - spec/classes/response_spec.rb
102
+ - spec/classes/result_spec.rb
103
+ - spec/integration_spec.rb
78
104
  - spec/spec.opts
79
105
  - spec/spec_helper.rb
80
106
  has_rdoc: true
@@ -90,21 +116,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
116
  requirements:
91
117
  - - ">="
92
118
  - !ruby/object:Gem::Version
119
+ segments:
120
+ - 0
93
121
  version: "0"
94
- version:
95
122
  required_rubygems_version: !ruby/object:Gem::Requirement
96
123
  requirements:
97
124
  - - ">="
98
125
  - !ruby/object:Gem::Version
126
+ segments:
127
+ - 0
99
128
  version: "0"
100
- version:
101
129
  requirements: []
102
130
 
103
131
  rubyforge_project:
104
- rubygems_version: 1.3.5
132
+ rubygems_version: 1.3.6
105
133
  signing_key:
106
134
  specification_version: 3
107
135
  summary: Google's geocoding library
108
136
  test_files:
109
- - spec/google_geocoding_spec.rb
137
+ - spec/classes/request_spec.rb
138
+ - spec/classes/response_spec.rb
139
+ - spec/classes/result_spec.rb
140
+ - spec/integration_spec.rb
110
141
  - spec/spec_helper.rb
@@ -1,30 +0,0 @@
1
- module GoogleGeocoding
2
- # Model that represents a placemark returned by the geocoding service.
3
- class Placemark
4
- # The level of accurracy for the placemark
5
- # @see http://code.google.com/apis/maps/documentation/geocoding/index.html#GeocodingAccuracy
6
- attr_accessor :accurracy
7
-
8
- # The country name
9
- attr_accessor :country_name
10
-
11
- # The country ISO code
12
- # @see http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
13
- attr_accessor :country_code
14
-
15
- # The region/province/state
16
- attr_accessor :region
17
-
18
- # The city name
19
- attr_accessor :city
20
-
21
- # The postal/zip code
22
- attr_accessor :postal_code
23
-
24
- # The street address, including the number
25
- attr_accessor :street
26
-
27
- # An array with two positions: latitude and longitude
28
- attr_accessor :coordinates
29
- end
30
- end
@@ -1,7 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "GoogleGeocoding" do
4
- it "fails" do
5
- fail "hey buddy, you should probably rename this file and start specing for real"
6
- end
7
- end