yahoo-placemaker 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +14 -0
- data/Rakefile +1 -1
- data/lib/yahoo-placemaker/version.rb +1 -1
- data/lib/yahoo-placemaker.rb +9 -8
- metadata +2 -2
- data/README.rdoc +0 -0
data/README.markdown
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
![Yahoo Placemaker](http://developer.yahoo.com/geo/placemaker/guide/images/logo.png)
|
2
|
+
|
3
|
+
`yahoo-placemaker` is a rubygem that allows for easy interaction w/ the [Yahoo Placemaker](http://developer.yahoo.com/geo/placemaker) API.
|
4
|
+
|
5
|
+
|
6
|
+
## Examples
|
7
|
+
|
8
|
+
require 'yahoo-placemaker'
|
9
|
+
Yahoo::Placemaker.APP_ID = 'xxxx'
|
10
|
+
place = Yahoo::Placemaker.extact "Columbus Ohio is my hometown"
|
11
|
+
|
12
|
+
## Contributing
|
13
|
+
|
14
|
+
I am by not means a Ruby guru so if you have seen something that I have done incorrectly or that could be improved please feel free to contribute some code!h
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/yahoo-placemaker.rb
CHANGED
@@ -6,17 +6,18 @@ require "net/http"
|
|
6
6
|
module Yahoo
|
7
7
|
module Placemaker
|
8
8
|
|
9
|
-
def self.extract (text = '')
|
9
|
+
def self.extract (text = '', options = {})
|
10
|
+
|
10
11
|
host = 'wherein.yahooapis.com'
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
|
13
|
+
# These options need to be explicitly set!
|
14
|
+
options['documentContent'] = text
|
15
|
+
options['appid'] = Yahoo::Placemaker::APP_ID
|
16
|
+
options['outputType'] = 'json'
|
17
|
+
options['documentType'] = 'text/plain'
|
17
18
|
|
18
19
|
req = ::Net::HTTP::Post.new('/v1/document')
|
19
|
-
req.body = to_url_params(
|
20
|
+
req.body = to_url_params(options)
|
20
21
|
response = ::Net::HTTP.new(host).start do |http|
|
21
22
|
http.request(req)
|
22
23
|
end
|
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.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -20,7 +20,7 @@ extra_rdoc_files: []
|
|
20
20
|
files:
|
21
21
|
- .gitignore
|
22
22
|
- Gemfile
|
23
|
-
- README.
|
23
|
+
- README.markdown
|
24
24
|
- Rakefile
|
25
25
|
- lib/yahoo-placemaker.rb
|
26
26
|
- lib/yahoo-placemaker/config.rb
|
data/README.rdoc
DELETED
File without changes
|