drifter 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. data/lib/drifter/version.rb +1 -1
  2. metadata +5 -11
  3. data/README +0 -102
@@ -1,3 +1,3 @@
1
1
  module Drifter
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drifter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Ahmed Adam
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-01-23 00:00:00 +00:00
17
+ date: 2011-01-24 00:00:00 +00:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 11
30
28
  segments:
31
29
  - 1
32
30
  - 4
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 3
46
43
  segments:
47
44
  - 0
48
45
  version: "0"
@@ -59,7 +56,6 @@ extra_rdoc_files: []
59
56
  files:
60
57
  - .gitignore
61
58
  - Gemfile
62
- - README
63
59
  - README.rdoc
64
60
  - Rakefile
65
61
  - drifter.gemspec
@@ -100,7 +96,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
96
  requirements:
101
97
  - - ">="
102
98
  - !ruby/object:Gem::Version
103
- hash: 3
104
99
  segments:
105
100
  - 0
106
101
  version: "0"
@@ -109,14 +104,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
104
  requirements:
110
105
  - - ">="
111
106
  - !ruby/object:Gem::Version
112
- hash: 3
113
107
  segments:
114
108
  - 0
115
109
  version: "0"
116
110
  requirements: []
117
111
 
118
112
  rubyforge_project: drifter
119
- rubygems_version: 1.4.2
113
+ rubygems_version: 1.3.7
120
114
  signing_key:
121
115
  specification_version: 3
122
116
  summary: Simple geocoding library for ruby
data/README DELETED
@@ -1,102 +0,0 @@
1
- == drifter
2
-
3
- drifter is a simple geocoding library with support for the Google Geocoder API and
4
- the Yahoo Placefinder API. It also supports IP address geocoding using the hostip.info API
5
-
6
- === Installation
7
-
8
- gem install drifter
9
- require 'rubygems'
10
- require 'drifter'
11
-
12
- # if you're using rails:
13
- gem install drifter
14
- gem 'drifter' # in Gemfile
15
-
16
-
17
- === Usage
18
-
19
- Drifter.geocode() takes a string representing an address or location and returns
20
- an array of Drifter::Location objects
21
-
22
- >> london = Drifter.geocode("London, UK").first
23
- => <#Drifter::Location>
24
-
25
- Drifter::Location objects hold common address attributes like city, state, post_code
26
- country_code, lat and lng:
27
-
28
- >> [london.country_code, london.lat, london.lng]
29
- => ['GB', 51.5001524, -0.1262362]
30
-
31
- Reverse geocoding is also supported. Instead of passing a string to geocode(), you can
32
- pass a two item array or an object that responds to lat() and lng()
33
-
34
- >> loc = Drifter.geocode( [53.4807125, -2.2343765] ).first
35
- => [loc.city, loc.state].join(', ')
36
- => "Manchester, England"
37
-
38
- IP address gecoding is supported using the hostip.info api. Just pass the IP as the
39
- location parameter
40
-
41
- >> loc = Drifter.geocode('1.2.3.4').first
42
- => <#Drifter::Location>
43
-
44
- hostip.info only provides the city, country, lat and lng. If you need more info, you
45
- can reverse geocode the result:
46
-
47
- >> loc = Drifter.geocode('1.2.3.4').first
48
- >> loc = Drifter.geocode(loc).first
49
- >> loc.state_code
50
- => 'CA'
51
-
52
- Google is the default geocoding provider and works out of the box. Yahoo's placefinder
53
- is also supported but you'll need an api key (they call it an appid)
54
-
55
- >> Drifter.default_geocoder = :yahoo
56
- >> Drifter::Geocoders::Yahoo.api_key = 'my_key'
57
-
58
- >> bh = Drifter.geocode("90210").first
59
- => <#Drifter::Location>
60
-
61
- You can change the geocoder per request:
62
-
63
- >> Drifter.geocode("springfield", :geocoder => :yahoo)
64
- >> Drifter.geocode("springfield", :geocoder => :google)
65
-
66
- Both Yahoo and Google return a lot more info than is held in Drifter::Location's standard
67
- attributes. You can access the extra data using the data() method which returns a Hash
68
-
69
- # using google as the provider:
70
- >> london.data["geometry"]["location_type"]
71
- => "APPROXIMATE"
72
-
73
- The key => value pairs in the data Hash are specific to each provider, so you'll have to
74
- check their docs to see what's available. You can also modify the query sent to the
75
- geocoder to customise the results. Any option other than :geocoder will be URL encoded
76
- and sent as a query string parameter e.g. Yahoo's service returns a timezone if you pass a
77
- 'flags' parameter containing a 'T':
78
-
79
- >> Drifter.default_geocoder = :yahoo
80
- >> paris = Drifter.geocode("Paris", :flags => 'T').first
81
- >> paris.data["timezone"]
82
- => "Europe/paris"
83
-
84
- Finally, Drifter::Location objects have a distance_to() method
85
-
86
- >> london.distance_to(bh)
87
- => 5438.60013996461
88
-
89
- Distances are returned in miles by default. You can change this per request or change the default
90
-
91
- >> Drifter.default_units = :km
92
- >> london.distance_to(bh, :units => :miles)
93
-
94
- Drifter.geocode() always returns an array if the request was processed successfully by the
95
- geocoding service. An empty array indicates that the service returned no results.
96
-
97
- If the geocoding service returns an error, Drifter.geocode() returns nil and Drifter.last_error()
98
- returns a hash with the error :code and :message
99
-
100
- === License
101
-
102
- MIT License. Copyright 2011 Ahmed Adam (http://github.com/ahmedrb)