placefinder 0.1 → 0.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.
- data/README.markdown +11 -3
- data/lib/placefinder/base.rb +2 -3
- data/lib/placefinder/version.rb +1 -1
- metadata +4 -4
data/README.markdown
CHANGED
|
@@ -9,6 +9,7 @@ Synopsis
|
|
|
9
9
|
========
|
|
10
10
|
|
|
11
11
|
Install from RubyGems
|
|
12
|
+
|
|
12
13
|
gem install placefinder
|
|
13
14
|
|
|
14
15
|
Require it in your files:
|
|
@@ -16,15 +17,22 @@ Require it in your files:
|
|
|
16
17
|
require 'placefinder'
|
|
17
18
|
|
|
18
19
|
placefinder = Placefinder::Base.new(:api_key => your_api_key)
|
|
19
|
-
|
|
20
|
-
placefinder.get(params)
|
|
20
|
+
placefinder.get :q => "Central Park, NY, US", :flags => 'J'
|
|
21
21
|
|
|
22
22
|
You are encourage to check the documentation to see the params of the API:
|
|
23
23
|
http://developer.yahoo.com/geo/placefinder/guide/requests.html
|
|
24
24
|
|
|
25
25
|
Super easy! isn't ?
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
NOTES:
|
|
28
|
+
|
|
29
|
+
1- The api_key is not a required field, you can start hitting their api without it.
|
|
30
|
+
2- If you specify format in the :flags, it will be ignore, a hash is always returned.
|
|
31
|
+
|
|
32
|
+
Important
|
|
33
|
+
=========
|
|
34
|
+
Yahoo! PlaceFinder as geolocation service really sucks and I would recommend to use Google, you can checkout Geokit which makes interactions with Google really easy.
|
|
35
|
+
https://github.com/andre/geokit-gem
|
|
28
36
|
|
|
29
37
|
Author
|
|
30
38
|
======
|
data/lib/placefinder/base.rb
CHANGED
|
@@ -3,7 +3,6 @@ require 'httparty'
|
|
|
3
3
|
|
|
4
4
|
module Placefinder
|
|
5
5
|
class Base
|
|
6
|
-
include HTTParty
|
|
7
6
|
base_uri 'http://where.yahooapis.com/geocode'
|
|
8
7
|
|
|
9
8
|
def initialize(params = {})
|
|
@@ -11,8 +10,8 @@ module Placefinder
|
|
|
11
10
|
end
|
|
12
11
|
|
|
13
12
|
def get(params = {})
|
|
14
|
-
params.merge!({:appid => @api_key}) if @
|
|
15
|
-
response =
|
|
13
|
+
params.merge!({:appid => @api_key}) if @api_key
|
|
14
|
+
response = HTTParty.get('', :query => params)
|
|
16
15
|
response.parsed_response
|
|
17
16
|
end
|
|
18
17
|
end
|
data/lib/placefinder/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: placefinder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 15
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
version: "0.
|
|
8
|
+
- 2
|
|
9
|
+
version: "0.2"
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Adolfo Builes
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2011-
|
|
17
|
+
date: 2011-05-18 00:00:00 -05:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|