ebsco-discovery-service-api 1.1.6 → 1.1.8
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 +8 -8
- data/lib/ebsco-discovery-service-api.rb +17 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWUzZWE2OGM1M2U5YzQ4YzI0NmRjZGVlYzQ2ZDFjY2ZhMjQ2YWNkZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2RlY2EyMjU5ZDMwOTk4NzhkYmQ1ZmMxZDM0YWVmZDVjMjQ5ZGE0OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGU3MDJjNTgwNTEwM2M2NGU3ZmRmOWQ0ZWYwNGMyM2ExNzY5MTY1ZjIzNDU1
|
10
|
+
MDE1ZTBiMTdmN2Y2MmU1M2E3MzIwNjNjN2VjZGIwMzY2MWQzZjNjNThmOTI2
|
11
|
+
MzM3YTMwY2M0NmRhNmU5NzRmNjQ0Y2E5ZGE0YmE4NzFhYTkwMmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTE0ODI1NGRhZDAyYjE5OWJiMjViMGVmYTcxYTA1MWQ0Y2U1MWQzZjQwYjkw
|
14
|
+
ZjJlZTFkZGRhNzgwNDRjNTExOGRhZWYxNzViOWI3ZWE5NDZkOWRiZWQ0N2E2
|
15
|
+
MzA5YTkxYzMxZjNjZWViOTE4YzE3ODc4ZDU4YjcwOTFkNjVlODQ=
|
@@ -51,7 +51,7 @@ module EDSApi
|
|
51
51
|
about "No response from server"
|
52
52
|
end
|
53
53
|
if doc.has_key?('ErrorNumber')
|
54
|
-
|
54
|
+
raise "Bad response from server - error code #{result['ErrorNumber']}"
|
55
55
|
else
|
56
56
|
@auth_token = doc['AuthToken']
|
57
57
|
end
|
@@ -67,7 +67,7 @@ module EDSApi
|
|
67
67
|
begin
|
68
68
|
doc = JSON.parse(https.request(req).body)
|
69
69
|
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
70
|
-
|
70
|
+
raise "No response from server"
|
71
71
|
end
|
72
72
|
@auth_token = doc['AuthToken']
|
73
73
|
end
|
@@ -86,7 +86,7 @@ module EDSApi
|
|
86
86
|
begin
|
87
87
|
return http.request(req).body
|
88
88
|
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
89
|
-
|
89
|
+
raise "No response from server"
|
90
90
|
end
|
91
91
|
}
|
92
92
|
end
|
@@ -99,7 +99,7 @@ module EDSApi
|
|
99
99
|
begin
|
100
100
|
http.request(req)
|
101
101
|
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
102
|
-
|
102
|
+
raise "No response from server"
|
103
103
|
end
|
104
104
|
}
|
105
105
|
return true
|
@@ -118,15 +118,22 @@ module EDSApi
|
|
118
118
|
begin
|
119
119
|
return http.request(req).body
|
120
120
|
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
121
|
-
|
121
|
+
raise "No response from server"
|
122
122
|
end
|
123
123
|
}
|
124
124
|
end
|
125
125
|
# Retrieve specific information
|
126
|
-
def retrieve(dbid, an, highlightterms = "", ebookpreferredformat = "
|
127
|
-
uri = URI "#{API_URL}edsapi/rest/retrieve?dbid=#{dbid}&an=#{an}
|
126
|
+
def retrieve(dbid, an, highlightterms = "", ebookpreferredformat = "", format = :xml)
|
127
|
+
uri = URI "#{API_URL}edsapi/rest/retrieve?dbid=#{dbid}&an=#{an}"
|
128
128
|
if highlightterms != ""
|
129
|
-
|
129
|
+
updateURI = uri.to_s
|
130
|
+
updateURI = updateURI + "&highlightterms=#{highlightterms}"
|
131
|
+
uri = URI updateURI
|
132
|
+
end
|
133
|
+
if ebookpreferredformat != ""
|
134
|
+
updateURI = uri.to_s
|
135
|
+
updateURI = updateURI + "&ebookpreferredformat=#{ebookpreferredformat}"
|
136
|
+
uri = URI updateURI
|
130
137
|
end
|
131
138
|
req = Net::HTTP::Get.new(uri.request_uri)
|
132
139
|
req['x-authenticationToken'] = @auth_token
|
@@ -137,7 +144,7 @@ module EDSApi
|
|
137
144
|
begin
|
138
145
|
return http.request(req).body
|
139
146
|
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
140
|
-
|
147
|
+
raise "No response from server"
|
141
148
|
end
|
142
149
|
}
|
143
150
|
end
|
@@ -152,7 +159,7 @@ module EDSApi
|
|
152
159
|
begin
|
153
160
|
return http.request(req).body
|
154
161
|
rescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
155
|
-
|
162
|
+
raise "No response from server"
|
156
163
|
end
|
157
164
|
}
|
158
165
|
end
|