summon 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +11 -0
- data/lib/summon/transport/canned.json +5 -2
- data/lib/summon/transport/qstring.rb +12 -7
- data/lib/summon/version.rb +1 -1
- data/spec/summon/transport/qstring_spec.rb +12 -7
- data/summon.gemspec +3 -2
- metadata +61 -85
data/.travis.yml
ADDED
@@ -1441,7 +1441,7 @@
|
|
1441
1441
|
"facetValueFilters": [
|
1442
1442
|
|
1443
1443
|
],
|
1444
|
-
"queryString": "s.ho=t&s.rff=PublicationDate%2C*%3A2000%2C2001%3A2001%2C2002%3A2002%2C2003%3A2003%2C2004%3A2004%2C2005%3A2005%2C2006%3A2006%2C2007%3A2007%2C2008%3A2008%2C2009%3A2009&s.ps=10&s.ff=IsScholarly%2Cor%2C1%2C2&s.ff=Language%2Cor%2C1%2C6&s.ff=ContentType%2Cor%2C1%2C6&s.ff=IsFullText%2Cor%2C1%2C2&s.ff=Library%2Cor%2C1%2C6&s.ff=SubjectTerms%2Cand%2C1%2C6",
|
1444
|
+
"queryString": "s.ho=t&s.rff=PublicationDate%2C*%3A2000%2C2001%3A2001%2C2002%3A2002%2C2003%3A2003%2C2004%3A2004%2C2005%3A2005%2C2006%3A2006%2C2007%3A2007%2C2008%3A2008%2C2009%3A2009&s.ps=10&s.ff=IsScholarly%2Cor%2C1%2C2&s.ff=Language%2Cor%2C1%2C6&s.ff=ContentType%2Cor%2C1%2C6&s.ff=IsFullText%2Cor%2C1%2C2&s.ff=Library%2Cor%2C1%2C6&s.ff=SubjectTerms%2Cand%2C1%2C6&s.q=louis%2Crmstrong&s.pn=1&s.ps=10",
|
1445
1445
|
"facetFields": [
|
1446
1446
|
{
|
1447
1447
|
"pageSize": 2,
|
@@ -1490,7 +1490,10 @@
|
|
1490
1490
|
|
1491
1491
|
],
|
1492
1492
|
"textQueries": [
|
1493
|
-
|
1493
|
+
{
|
1494
|
+
"textQuery": "louis%2Crmstrong",
|
1495
|
+
"removeCommand": "removeTextQuery(louis%2Crmstrong)"
|
1496
|
+
}
|
1494
1497
|
],
|
1495
1498
|
"sort": [
|
1496
1499
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
|
2
2
|
require 'cgi'
|
3
|
+
require 'uri'
|
3
4
|
|
4
5
|
module Summon::Transport
|
5
6
|
module Qstring
|
6
|
-
|
7
|
+
|
7
8
|
def to_query_string(hash, urlencode = true)
|
8
9
|
hash.reject {|k,v| v.nil? || v == ''}.inject([]) do |qs,pair|
|
9
10
|
qs.tap do
|
@@ -16,21 +17,25 @@ module Summon::Transport
|
|
16
17
|
qs << encode_param(k, v, urlencode)
|
17
18
|
end
|
18
19
|
end
|
19
|
-
end.reject{|o| o.nil? || o.empty?}.sort.join('&')
|
20
|
+
end.reject{|o| o.nil? || o.empty?}.sort.join('&')
|
20
21
|
end
|
21
22
|
|
22
23
|
def urlencode(str)
|
23
|
-
|
24
|
+
if URI.respond_to?(:encode_www_form_component)
|
25
|
+
URI.encode_www_form_component str
|
26
|
+
else
|
27
|
+
str.gsub(/[^a-zA-Z0-9_\.\-]/n) {|s| sprintf('%%%02x', s[0].ord) }
|
28
|
+
end
|
24
29
|
end
|
25
30
|
|
26
31
|
def urldecode(str)
|
27
32
|
CGI.unescape(str)
|
28
33
|
end
|
29
|
-
|
34
|
+
|
30
35
|
def encode_param(k, v, do_urlencode)
|
31
36
|
"#{k.to_s}=#{do_urlencode ? urlencode(v.to_s) : v.to_s}"
|
32
37
|
end
|
33
|
-
|
38
|
+
|
34
39
|
def from_query_string(qstr)
|
35
40
|
qstr ||= ""
|
36
41
|
{}.tap do |result|
|
@@ -42,8 +47,8 @@ module Summon::Transport
|
|
42
47
|
else
|
43
48
|
result[k] = urldecode(v)
|
44
49
|
end
|
45
|
-
end
|
50
|
+
end
|
46
51
|
end
|
47
52
|
end
|
48
|
-
end
|
53
|
+
end
|
49
54
|
end
|
data/lib/summon/version.rb
CHANGED
@@ -1,30 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
3
|
|
3
4
|
describe Summon::Transport::Qstring do
|
4
5
|
before(:each) do
|
5
6
|
extend Summon::Transport::Qstring
|
6
7
|
end
|
7
|
-
|
8
|
+
|
8
9
|
it "can decode a query string into hash parameters" do
|
9
10
|
from_query_string("foo=bar&baz=bang").should == {"foo" => "bar", "baz" => "bang"}
|
10
11
|
end
|
11
|
-
|
12
|
+
|
12
13
|
it "stuffs multiple keys into the same value as a list" do
|
13
14
|
from_query_string("foo=bar&foo=baz&bar=bang").should == {"foo" => ["bar", "baz"], "bar" => "bang"}
|
14
15
|
end
|
15
|
-
|
16
|
+
|
16
17
|
it "url decodes keys and values" do
|
17
18
|
from_query_string("foo=bar%20bar&baz=bang+bang").should == {"foo" => "bar bar", "baz" => "bang bang"}
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
it "returns an empty hash if the query string is blank" do
|
21
22
|
from_query_string(nil).should be_empty
|
22
23
|
from_query_string("").should be_empty
|
23
24
|
end
|
24
|
-
|
25
|
+
|
25
26
|
it "encodes strings properly" do
|
26
27
|
to_query_string("foo" => "bar").should == "foo=bar"
|
27
|
-
to_query_string("foo" => "
|
28
|
+
to_query_string("foo" => "/").downcase.should == "foo=%2f"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "encodes UTF-8 strings" do
|
32
|
+
to_query_string("s.q"=> "らしさ」を失わな").downcase.should eql "s.q=%e3%82%89%e3%81%97%e3%81%95%e3%80%8d%e3%82%92%e5%a4%b1%e3%82%8f%e3%81%aa"
|
28
33
|
end
|
29
|
-
|
34
|
+
|
30
35
|
end
|
data/summon.gemspec
CHANGED
@@ -26,7 +26,8 @@ http://api.summon.serialssolutions.com
|
|
26
26
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
27
|
s.require_paths = ["lib"]
|
28
28
|
|
29
|
-
s.add_runtime_dependency "json"
|
30
|
-
|
29
|
+
s.add_runtime_dependency "json"
|
30
|
+
|
31
|
+
s.add_development_dependency "rspec", "~> 2.0"
|
31
32
|
s.add_development_dependency "rake"
|
32
33
|
end
|
metadata
CHANGED
@@ -1,83 +1,63 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: summon
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 2.0.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Charles Lowell
|
14
|
-
-
|
9
|
+
- Daniël van de Burgt
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 31
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 2
|
32
|
-
- 0
|
33
|
-
version: 1.2.0
|
34
|
-
version_requirements: *id001
|
13
|
+
date: 2011-11-17 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
35
16
|
name: json
|
36
|
-
|
37
|
-
type: :runtime
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2154273420 !ruby/object:Gem::Requirement
|
40
18
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
- 2
|
47
|
-
- 0
|
48
|
-
- 0
|
49
|
-
version: 2.0.0
|
50
|
-
version_requirements: *id002
|
51
|
-
name: rspec
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
52
24
|
prerelease: false
|
53
|
-
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
|
25
|
+
version_requirements: *2154273420
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &2154272460 !ruby/object:Gem::Requirement
|
56
29
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
|
62
|
-
- 0
|
63
|
-
version: "0"
|
64
|
-
version_requirements: *id003
|
65
|
-
name: rake
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
66
35
|
prerelease: false
|
36
|
+
version_requirements: *2154272460
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
requirement: &2154271680 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
67
45
|
type: :development
|
68
|
-
|
69
|
-
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2154271680
|
48
|
+
description: Ruby language bindings for Serials Solutions Summon Unified Discovery
|
49
|
+
Service
|
50
|
+
email:
|
70
51
|
- cowboyd@thefrontside.net
|
71
52
|
- daniel.vandeburgt@serialssolutions.com
|
72
|
-
executables:
|
53
|
+
executables:
|
73
54
|
- summon
|
74
55
|
- summonh
|
75
56
|
extensions: []
|
76
|
-
|
77
57
|
extra_rdoc_files: []
|
78
|
-
|
79
|
-
files:
|
58
|
+
files:
|
80
59
|
- .gitignore
|
60
|
+
- .travis.yml
|
81
61
|
- Changelog.md
|
82
62
|
- Gemfile
|
83
63
|
- README.md
|
@@ -134,46 +114,42 @@ files:
|
|
134
114
|
- spec/summon_spec.rb
|
135
115
|
- spike.rb
|
136
116
|
- summon.gemspec
|
137
|
-
has_rdoc: true
|
138
117
|
homepage: http://github.com/summon/summon.rb
|
139
118
|
licenses: []
|
119
|
+
post_install_message: ! '
|
140
120
|
|
141
|
-
post_install_message: |+
|
142
|
-
|
143
121
|
For comprehensive documentation on Summon API options and usage visit:
|
144
|
-
|
122
|
+
|
123
|
+
|
145
124
|
http://api.summon.serialssolutions.com
|
146
|
-
|
147
|
-
rdoc_options: []
|
148
125
|
|
149
|
-
|
126
|
+
|
127
|
+
'
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
150
130
|
- lib
|
151
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
132
|
none: false
|
153
|
-
requirements:
|
154
|
-
- -
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
|
157
|
-
segments:
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
segments:
|
158
138
|
- 0
|
159
|
-
|
160
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
hash: 940696890272720682
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
141
|
none: false
|
162
|
-
requirements:
|
163
|
-
- -
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
|
166
|
-
segments:
|
167
|
-
- 0
|
168
|
-
version: "0"
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
169
146
|
requirements: []
|
170
|
-
|
171
147
|
rubyforge_project:
|
172
|
-
rubygems_version: 1.
|
148
|
+
rubygems_version: 1.8.10
|
173
149
|
signing_key:
|
174
150
|
specification_version: 3
|
175
151
|
summary: Ruby language bindings for Serials Solutions Summon Unified Discovery Service
|
176
|
-
test_files:
|
152
|
+
test_files:
|
177
153
|
- spec/spec.opts
|
178
154
|
- spec/spec_helper.rb
|
179
155
|
- spec/summon/log_spec.rb
|