yboss 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -0
- data/VERSION +1 -1
- data/lib/yboss/oauth.rb +3 -1
- data/spec/yboss_spec.rb +81 -3
- data/yboss.gemspec +75 -0
- metadata +6 -4
data/.travis.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.0.0
|
4
|
+
- 1.9.3
|
5
|
+
before_script:
|
6
|
+
env:
|
7
|
+
global:
|
8
|
+
- secure: bWVJ4p39I5tDAWodbhdfOJpoWcc99yKLNES1cjFKAytlWrOXDXe6RQfL8KgNnXYfDCcgeQkUCRZ66iR94/YOJPlXyhllViIg5vxhfmWp6+CyjohgBx1XJK3TenXTVtjm7/xItnGylsLx/f8MVsUfYh7SO3l7meUk4+Gtird1qLw=
|
9
|
+
- secure: fymHE1nTyzFEVdt39CA85fInLpcs0b9yjB+kdvBitVPf+gghX6uihzLpxPgIlgoER1MQDPr0X4jjc8WCbage1Af9ouiYE7lquJs1HaSh7mPP3uS8qYQJ0YFmzmzXlRQdq2JvMnN9RI0AjGg5ua7XLLYBA7whXm2iUzXBHKeYcbM=
|
10
|
+
- secure: lRVODkMHmLr3ySixwA5o8luqvfZM0Lq/Q0nIDWEGw2iheL4YUJtRkvVLV73iP/DWjL5+atFQN3TTowweuc3f8Ec+fdETA0wAR1rRwnIKK7Sm4iOG/eskMEW33tpliYUQv6lkbDeIHNYtolASG1AcXHskzSvDCQQuf+UuUHUSGpM=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/yboss/oauth.rb
CHANGED
@@ -34,7 +34,9 @@ module YBoss
|
|
34
34
|
def percent_encode( string )
|
35
35
|
|
36
36
|
# ref http://snippets.dzone.com/posts/show/1260
|
37
|
-
return URI.escape(
|
37
|
+
return URI.escape(string,
|
38
|
+
Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")
|
39
|
+
).gsub('*', '%2A').gsub('\'','%27').gsub('(','%28').gsub(')','%29').gsub('!','%21')
|
38
40
|
end
|
39
41
|
|
40
42
|
# @ref http://oauth.net/core/1.0/#rfc.section.9.2
|
data/spec/yboss_spec.rb
CHANGED
@@ -1,7 +1,85 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
5
|
+
if ENV['YAHOO_BOSS_API_KEY_SUFFIX']
|
6
|
+
ENV['YAHOO_BOSS_API_KEY'] += ENV['YAHOO_BOSS_API_KEY_SUFFIX']
|
7
|
+
end
|
8
|
+
|
9
|
+
YBoss::Config.instance.oauth_key = ENV['YAHOO_BOSS_API_KEY']
|
10
|
+
YBoss::Config.instance.oauth_secret = ENV['YAHOO_BOSS_API_SECRET']
|
11
|
+
|
12
|
+
puts YBoss::Config.instance.oauth_key
|
13
|
+
|
14
|
+
def trySearch(search_type, query_string)
|
15
|
+
res = YBoss.send search_type, {:q => query_string}
|
16
|
+
res.responsecode.to_i.should == 200
|
17
|
+
res.count.to_i.should > 0
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "Yboss Test API Credentials" do
|
21
|
+
it "should have a consumer key" do
|
22
|
+
YBoss::Config.instance.oauth_key.should_not == nil
|
23
|
+
end
|
24
|
+
it "should have a consumer secret" do
|
25
|
+
YBoss::Config.instance.oauth_secret.should_not == nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "Yboss Basic Queries" do
|
30
|
+
it "should return some results for a purely alpha-numeric query" do
|
31
|
+
trySearch(:web, 'yahoo')
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should return some results for a query string with a space" do
|
35
|
+
trySearch(:web, 'yahoo sports')
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should return some results for a query string with parentheses" do
|
39
|
+
trySearch(:web, 'yahoo (sports)')
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return some results for a query string with punctuation" do
|
43
|
+
trySearch(:web, "yahoo's stock price")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return some results for a query string with non-english characters" do
|
47
|
+
trySearch(:web, "café au lait")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return some results for a query string with numbers and a percent sign" do
|
51
|
+
trySearch(:web, "who are the 99%?")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should return some results for a query string with brackets" do
|
55
|
+
trySearch(:web, "andrew [carnegie]")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should return some results for a query string with a colon" do
|
59
|
+
trySearch(:web, "mission: impossible")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should return some results for a query string with an at sign" do
|
63
|
+
trySearch(:web, "@Twitter")
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should return some results for a query string with a comma-delimited list" do
|
67
|
+
trySearch(:web, "Tyson, Neil deGrasse")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should return some results for a query string with an exclamation point" do
|
71
|
+
trySearch(:web, "yahoo ruby gems!")
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should return some results for a query string with an hash sign" do
|
75
|
+
trySearch(:web, "#colbert_bump")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should return some results for a query string with a dollar sign" do
|
79
|
+
trySearch(:web, "Ke$ha")
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should return some results for a query string with an equals sign" do
|
83
|
+
trySearch(:web, "1 + 1 = 3")
|
6
84
|
end
|
7
85
|
end
|
data/yboss.gemspec
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "yboss"
|
8
|
+
s.version = "0.2.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Tobias Begalke"]
|
12
|
+
s.date = "2013-12-03"
|
13
|
+
s.description = "yboss is a ruby library for the Yahoo BOSS API"
|
14
|
+
s.email = "tob@spyz.org"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".travis.yml",
|
23
|
+
"Gemfile",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"lib/yboss.rb",
|
29
|
+
"lib/yboss/base.rb",
|
30
|
+
"lib/yboss/blogs.rb",
|
31
|
+
"lib/yboss/config.rb",
|
32
|
+
"lib/yboss/images.rb",
|
33
|
+
"lib/yboss/limitedweb.rb",
|
34
|
+
"lib/yboss/news.rb",
|
35
|
+
"lib/yboss/oauth.rb",
|
36
|
+
"lib/yboss/related.rb",
|
37
|
+
"lib/yboss/result/base.rb",
|
38
|
+
"lib/yboss/result/item.rb",
|
39
|
+
"lib/yboss/spelling.rb",
|
40
|
+
"lib/yboss/web.rb",
|
41
|
+
"spec/spec_helper.rb",
|
42
|
+
"spec/yboss_spec.rb",
|
43
|
+
"yboss.gemspec"
|
44
|
+
]
|
45
|
+
s.homepage = "http://github.com/elcamino/yboss"
|
46
|
+
s.licenses = ["MIT"]
|
47
|
+
s.require_paths = ["lib"]
|
48
|
+
s.rubygems_version = "1.8.25"
|
49
|
+
s.summary = "Yahoo BOSS library"
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
56
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
57
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
59
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
62
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
63
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
64
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
65
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
66
|
+
end
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
69
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
70
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
72
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yboss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -101,6 +101,7 @@ extra_rdoc_files:
|
|
101
101
|
files:
|
102
102
|
- .document
|
103
103
|
- .rspec
|
104
|
+
- .travis.yml
|
104
105
|
- Gemfile
|
105
106
|
- LICENSE.txt
|
106
107
|
- README.rdoc
|
@@ -121,6 +122,7 @@ files:
|
|
121
122
|
- lib/yboss/web.rb
|
122
123
|
- spec/spec_helper.rb
|
123
124
|
- spec/yboss_spec.rb
|
125
|
+
- yboss.gemspec
|
124
126
|
homepage: http://github.com/elcamino/yboss
|
125
127
|
licenses:
|
126
128
|
- MIT
|
@@ -136,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
138
|
version: '0'
|
137
139
|
segments:
|
138
140
|
- 0
|
139
|
-
hash:
|
141
|
+
hash: -3283620770910580987
|
140
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
143
|
none: false
|
142
144
|
requirements:
|
@@ -145,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
147
|
version: '0'
|
146
148
|
requirements: []
|
147
149
|
rubyforge_project:
|
148
|
-
rubygems_version: 1.8.
|
150
|
+
rubygems_version: 1.8.25
|
149
151
|
signing_key:
|
150
152
|
specification_version: 3
|
151
153
|
summary: Yahoo BOSS library
|