yahoo-local 0.1.0 → 0.1.1
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/MIT-LICENSE +20 -0
- data/README.md +1 -1
- data/Rakefile +40 -0
- data/VERSION +1 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/yahoo_local.rb +36 -0
- data/lib/yahoo_local/client.rb +24 -0
- data/pkg/yahoo-local-0.1.0.gem +0 -0
- data/tasks/yahoo_local_tasks.rake +4 -0
- data/test/test_helper.rb +3 -0
- data/test/yahoo_local_test.rb +8 -0
- data/uninstall.rb +1 -0
- data/yahoo-local.gemspec +57 -0
- metadata +18 -4
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# YahooLocal
|
2
2
|
|
3
|
-
This is a Ruby wrapper for the Yahoo Local Search API [http://developer.yahoo.com/search/local/V3/localSearch.html](http://developer.yahoo.com/search/local/V3/localSearch.html).
|
3
|
+
This is a Ruby wrapper for the Yahoo! Local Search API [http://developer.yahoo.com/search/local/V3/localSearch.html](http://developer.yahoo.com/search/local/V3/localSearch.html).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gem|
|
8
|
+
gem.name = "yahoo-local"
|
9
|
+
gem.summary = %Q{Ruby wrapper for the Yahoo! Local Search API}
|
10
|
+
gem.description = %Q{Ruby wrapper for the Yahoo! Local Search API}
|
11
|
+
gem.email = "johnnyn@gmail.com"
|
12
|
+
gem.homepage = "http://github.com/phuphighter/yahoo_local"
|
13
|
+
gem.authors = ["Johnny Khai Nguyen"]
|
14
|
+
|
15
|
+
gem.add_dependency('httparty', '>= 0.5.0')
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Default: run unit tests.'
|
23
|
+
task :default => :test
|
24
|
+
|
25
|
+
desc 'Test the yahoo_local plugin.'
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = true
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'Generate documentation for the yahoo_local plugin.'
|
34
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
35
|
+
rdoc.rdoc_dir = 'rdoc'
|
36
|
+
rdoc.title = 'Yahoo-local'
|
37
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
38
|
+
rdoc.rdoc_files.include('README')
|
39
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
40
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Include hook code here
|
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
data/lib/yahoo_local.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Yahoo-local
|
2
|
+
require 'rubygems'
|
3
|
+
gem 'httparty'
|
4
|
+
require 'httparty'
|
5
|
+
|
6
|
+
directory = File.expand_path(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
module YahooLocal
|
9
|
+
|
10
|
+
# create config/initializers/yahoo_local.rb
|
11
|
+
#
|
12
|
+
# YahooLocal.configure do |config|
|
13
|
+
# config.api_key = 'api_key'
|
14
|
+
# end
|
15
|
+
# client = YahooLocal::Client.new
|
16
|
+
#
|
17
|
+
# or
|
18
|
+
#
|
19
|
+
# YahooLocal.api_key = 'api_key'
|
20
|
+
#
|
21
|
+
# or
|
22
|
+
#
|
23
|
+
# YahooLocal::Client.new(:api_key => 'api_key')
|
24
|
+
|
25
|
+
def self.configure
|
26
|
+
yield self
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
class << self
|
31
|
+
attr_accessor :api_key
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
require File.join(directory, 'yahoo_local', 'client')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module YahooLocal
|
2
|
+
|
3
|
+
class Client
|
4
|
+
include HTTParty
|
5
|
+
base_uri "http://local.yahooapis.com/LocalSearchService/V3"
|
6
|
+
|
7
|
+
attr_reader :api_key
|
8
|
+
|
9
|
+
def initialize(options={})
|
10
|
+
@api_key = options[:appid] || YahooLocal.api_key
|
11
|
+
end
|
12
|
+
|
13
|
+
def search(options={})
|
14
|
+
response = self.class.get('/localSearch', :query => options.merge(self.default_options))
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def default_options
|
20
|
+
{:appid => @api_key, :output => "json"}
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
Binary file
|
data/test/test_helper.rb
ADDED
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
data/yahoo-local.gemspec
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{yahoo-local}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Johnny Khai Nguyen"]
|
12
|
+
s.date = %q{2010-05-25}
|
13
|
+
s.description = %q{Ruby wrapper for the Yahoo! Local Search API}
|
14
|
+
s.email = %q{johnnyn@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README.md",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"init.rb",
|
24
|
+
"install.rb",
|
25
|
+
"lib/yahoo_local.rb",
|
26
|
+
"lib/yahoo_local/client.rb",
|
27
|
+
"pkg/yahoo-local-0.1.0.gem",
|
28
|
+
"tasks/yahoo_local_tasks.rake",
|
29
|
+
"test/test_helper.rb",
|
30
|
+
"test/yahoo_local_test.rb",
|
31
|
+
"uninstall.rb",
|
32
|
+
"yahoo-local.gemspec"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/phuphighter/yahoo_local}
|
35
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.3.6}
|
38
|
+
s.summary = %q{Ruby wrapper for the Yahoo! Local Search API}
|
39
|
+
s.test_files = [
|
40
|
+
"test/test_helper.rb",
|
41
|
+
"test/yahoo_local_test.rb"
|
42
|
+
]
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0.5.0"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<httparty>, [">= 0.5.0"])
|
52
|
+
end
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<httparty>, [">= 0.5.0"])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Johnny Khai Nguyen
|
@@ -40,7 +40,20 @@ extensions: []
|
|
40
40
|
extra_rdoc_files:
|
41
41
|
- README.md
|
42
42
|
files:
|
43
|
+
- MIT-LICENSE
|
43
44
|
- README.md
|
45
|
+
- Rakefile
|
46
|
+
- VERSION
|
47
|
+
- init.rb
|
48
|
+
- install.rb
|
49
|
+
- lib/yahoo_local.rb
|
50
|
+
- lib/yahoo_local/client.rb
|
51
|
+
- pkg/yahoo-local-0.1.0.gem
|
52
|
+
- tasks/yahoo_local_tasks.rake
|
53
|
+
- test/test_helper.rb
|
54
|
+
- test/yahoo_local_test.rb
|
55
|
+
- uninstall.rb
|
56
|
+
- yahoo-local.gemspec
|
44
57
|
has_rdoc: true
|
45
58
|
homepage: http://github.com/phuphighter/yahoo_local
|
46
59
|
licenses: []
|
@@ -71,5 +84,6 @@ rubygems_version: 1.3.6
|
|
71
84
|
signing_key:
|
72
85
|
specification_version: 3
|
73
86
|
summary: Ruby wrapper for the Yahoo! Local Search API
|
74
|
-
test_files:
|
75
|
-
|
87
|
+
test_files:
|
88
|
+
- test/test_helper.rb
|
89
|
+
- test/yahoo_local_test.rb
|