ebsco-discovery-service-api 1.0.4 → 1.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.
- checksums.yaml +15 -0
- data/lib/ebsco-discovery-service-api.rb +17 -20
- metadata +5 -8
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZmVlNjYwZWRlMTFiOTBiN2NlZDlkNzBkY2U2ZDg1MGYyMjAzOTdiOA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjgwMGE2MTViMzRiN2VkNDYxOTMzM2E0YTRjMDcwMTA5NGYxZWRkNA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjZjYjE5YjM1ODcwNTljNmYzM2E1M2Y3ZmZiNDNlOWZjOGFkM2JkMzllYjFj
|
10
|
+
MDFjODI4OTIyZTQxZTgwNTUwMDY4NzllYWE1ZTRkZWRjNGViNDAyZDljYzNm
|
11
|
+
MjUyMzFhNjg4ZDkwNThkYjM3NzBlMWQzYmM3Y2VjMTczZjQ5ZDU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OWUyOTI5ZGMzZmE2MmI2MzUzZGNhNWFjODA3NTFjZmYxM2U3ODIzZGQ0N2Qw
|
14
|
+
YzA2OTFmMGVmMzhlOWUzMjExZTYzODA0Mjg1NTEzYzIzZGMzYzU1NzQ5ZDhi
|
15
|
+
NWU1Mzc2OTEzMTM3OGUxYTc3YWFmZDIzYTZhODlhNjRlNDU2MTE=
|
@@ -13,12 +13,11 @@ module EDSApi
|
|
13
13
|
# Connection object. Does what it says. ConnectionHandler is what is usually desired and wraps auto-reonnect features, etc.
|
14
14
|
class Connection
|
15
15
|
|
16
|
-
attr_accessor :auth_token, :session_token, :
|
16
|
+
attr_accessor :auth_token, :session_token, :guest
|
17
17
|
attr_writer :userid, :password
|
18
18
|
|
19
19
|
# Init the object with userid and pass.
|
20
20
|
def uid_init(userid, password, profile, guest = 'y')
|
21
|
-
@debug_notes = "<p>Setting guest as " << guest.to_s << "</p>"
|
22
21
|
@userid = userid
|
23
22
|
@password = password
|
24
23
|
@profile = profile
|
@@ -41,13 +40,13 @@ module EDSApi
|
|
41
40
|
req["Content-Type"] = "application/xml"
|
42
41
|
req["Accept"] = "application/json" #if format == :json
|
43
42
|
req.body = xml
|
44
|
-
@debug_notes << "<p>UID Authentication Call to " << uri.to_s << ": " << xml << "</p>";
|
45
43
|
https = Net::HTTP.new(uri.hostname, uri.port)
|
44
|
+
https.read_timeout=10
|
46
45
|
https.use_ssl = true
|
47
46
|
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
48
47
|
begin
|
49
48
|
doc = JSON.parse(https.request(req).body)
|
50
|
-
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
49
|
+
rescue Timeout::Error, Errno::EINVAL, Net::ReadTimeout, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
51
50
|
about "No response from server"
|
52
51
|
end
|
53
52
|
if doc.has_key?('ErrorNumber')
|
@@ -61,11 +60,12 @@ module EDSApi
|
|
61
60
|
req = Net::Http:Post.new(uri.request_uri)
|
62
61
|
req["Accept"] = "application/json" #if format == :json
|
63
62
|
https = Net::HTTP.new(uri.hostname, uri.port)
|
63
|
+
https.read_timeout=10
|
64
64
|
https.use_ssl = true
|
65
65
|
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
66
66
|
begin
|
67
67
|
doc = JSON.parse(https.request(req).body)
|
68
|
-
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
68
|
+
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
69
69
|
abort "No response from server"
|
70
70
|
end
|
71
71
|
@auth_token = doc['AuthToken']
|
@@ -76,15 +76,15 @@ module EDSApi
|
|
76
76
|
req = Net::HTTP::Get.new(uri.request_uri)
|
77
77
|
req['x-authenticationToken'] = @auth_token
|
78
78
|
req['Accept'] = "application/json"
|
79
|
-
@debug_notes << "<p>CREATE SESSION Call to " << uri.to_s << " with auth token: " << req['x-authenticationToken'].to_s << "</p>";
|
80
79
|
# Net::HTTP.start(uri.hostname, uri.port) { |http|
|
81
80
|
# doc = JSON.parse(http.request(req).body)
|
82
81
|
# return doc['SessionToken']
|
83
82
|
# }
|
84
|
-
Net::HTTP.start(uri.hostname, uri.port) { |http|
|
83
|
+
Net::HTTP.start(uri.hostname, uri.port, :read_timeout => 10) { |http|
|
84
|
+
|
85
85
|
begin
|
86
86
|
return http.request(req).body
|
87
|
-
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
87
|
+
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
88
88
|
abort "No response from server"
|
89
89
|
end
|
90
90
|
}
|
@@ -94,10 +94,10 @@ module EDSApi
|
|
94
94
|
uri = URI "#{API_URL}edsapi/rest/endsession?sessiontoken=#{CGI::escape(session_token)}"
|
95
95
|
req = Net::HTTP::Get.new(uri.request_uri)
|
96
96
|
req['x-authenticationToken'] = @auth_token
|
97
|
-
Net::HTTP.start(uri.hostname, uri.port) { |http|
|
97
|
+
Net::HTTP.start(uri.hostname, uri.port, :read_timeout => 10) { |http|
|
98
98
|
begin
|
99
99
|
http.request(req)
|
100
|
-
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
100
|
+
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
101
101
|
abort "No response from server"
|
102
102
|
end
|
103
103
|
}
|
@@ -108,15 +108,15 @@ module EDSApi
|
|
108
108
|
uri = URI "#{API_URL}edsapi/rest/Search?#{options}"
|
109
109
|
#return uri.request_uri
|
110
110
|
req = Net::HTTP::Get.new(uri.request_uri)
|
111
|
+
|
111
112
|
req['x-authenticationToken'] = @auth_token
|
112
113
|
req['x-sessionToken'] = @session_token
|
113
114
|
req['Accept'] = 'application/json' #if format == :json
|
114
|
-
@debug_notes << "<p>SEARCH Call to " << uri.to_s << " with auth token: " << req['x-authenticationToken'].to_s << " and session token: " << req['x-sessionToken'].to_s << "</p>";
|
115
115
|
|
116
|
-
Net::HTTP.start(uri.hostname, uri.port) { |http|
|
116
|
+
Net::HTTP.start(uri.hostname, uri.port, :read_timeout => 10) { |http|
|
117
117
|
begin
|
118
118
|
return http.request(req).body
|
119
|
-
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
119
|
+
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
120
120
|
abort "No response from server"
|
121
121
|
end
|
122
122
|
}
|
@@ -131,12 +131,11 @@ module EDSApi
|
|
131
131
|
req['x-authenticationToken'] = @auth_token
|
132
132
|
req['x-sessionToken'] = @session_token
|
133
133
|
req['Accept'] = 'application/json' #if format == :json
|
134
|
-
@debug_notes << "<p>RETRIEVE Call to " << uri.to_s << " with auth token: " << req['x-authenticationToken'].to_s << " and session token: " << req['x-sessionToken'].to_s << "</p>";
|
135
134
|
|
136
|
-
Net::HTTP.start(uri.hostname, uri.port) { |http|
|
135
|
+
Net::HTTP.start(uri.hostname, uri.port, :read_timeout => 10) { |http|
|
137
136
|
begin
|
138
137
|
return http.request(req).body
|
139
|
-
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
138
|
+
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
140
139
|
abort "No response from server"
|
141
140
|
end
|
142
141
|
}
|
@@ -148,11 +147,10 @@ module EDSApi
|
|
148
147
|
req['x-authenticationToken'] = @auth_token
|
149
148
|
req['x-sessionToken'] = @session_token
|
150
149
|
req['Accept'] = 'application/json' #if format == :json
|
151
|
-
|
152
|
-
Net::HTTP.start(uri.hostname, uri.port) { |http|
|
150
|
+
Net::HTTP.start(uri.hostname, uri.port, :read_timeout => 10) { |http|
|
153
151
|
begin
|
154
152
|
return http.request(req).body
|
155
|
-
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
153
|
+
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
156
154
|
abort "No response from server"
|
157
155
|
end
|
158
156
|
}
|
@@ -188,7 +186,6 @@ module EDSApi
|
|
188
186
|
loop do
|
189
187
|
result = JSON.parse(super(options, format))
|
190
188
|
if result.has_key?('ErrorNumber')
|
191
|
-
@debug_notes << "<p>Found ERROR " << result['ErrorNumber'].to_s
|
192
189
|
case result['ErrorNumber']
|
193
190
|
when "108"
|
194
191
|
@session_token = self.create_session
|
metadata
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebsco-discovery-service-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
- Richard McCormack
|
9
7
|
- Eric Frierson
|
10
8
|
autorequire:
|
11
9
|
bindir: bin
|
12
10
|
cert_chain: []
|
13
|
-
date:
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
14
12
|
dependencies: []
|
15
13
|
description: Set of Ruby functions to interface with the EBSCO Discovery Service API.
|
16
14
|
email: eds@ebscohost.com
|
@@ -21,26 +19,25 @@ files:
|
|
21
19
|
- lib/ebsco-discovery-service-api.rb
|
22
20
|
homepage: http://rubygems.org/gems/ebsco-discovery-service-api
|
23
21
|
licenses: []
|
22
|
+
metadata: {}
|
24
23
|
post_install_message:
|
25
24
|
rdoc_options: []
|
26
25
|
require_paths:
|
27
26
|
- lib
|
28
27
|
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
28
|
requirements:
|
31
29
|
- - ! '>='
|
32
30
|
- !ruby/object:Gem::Version
|
33
31
|
version: '0'
|
34
32
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
33
|
requirements:
|
37
34
|
- - ! '>='
|
38
35
|
- !ruby/object:Gem::Version
|
39
36
|
version: '0'
|
40
37
|
requirements: []
|
41
38
|
rubyforge_project:
|
42
|
-
rubygems_version:
|
39
|
+
rubygems_version: 2.2.2
|
43
40
|
signing_key:
|
44
|
-
specification_version:
|
41
|
+
specification_version: 4
|
45
42
|
summary: EBSCO Discovery Service API Ruby Library
|
46
43
|
test_files: []
|