ebsco-eds 0.3.0.pre → 0.3.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ebsco/eds/session.rb +15 -11
- data/lib/ebsco/eds/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5bc349f6a65afd5f8dad6d89441d9a72a5d7ee0
|
4
|
+
data.tar.gz: 7c028d8098e5555497964019848680acd3a5b5bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae36ea68f3dac43929a793b4e835f52537919a6a82319448904aa14881bbca3da12f68b0c951511a636c203e92715ef259b475b9249f61b66d5fefef6a5fcf3
|
7
|
+
data.tar.gz: fd665b635c020835db13eb6d87f2f3ab4b87bd07e81b3cc8ff92a963e1cf2a7a2cb094810b118bb0cea35cd2c2aedf29218794d1f6da43f4eefde6342b4f7114
|
data/lib/ebsco/eds/session.rb
CHANGED
@@ -129,7 +129,7 @@ module EBSCO
|
|
129
129
|
end :
|
130
130
|
@debug = @config[:debug]
|
131
131
|
|
132
|
-
# use cache for auth token and
|
132
|
+
# use cache for auth token, info, search and retrieve calls?
|
133
133
|
if @use_cache
|
134
134
|
cache_dir = File.join(@cache_dir, 'faraday_eds_cache')
|
135
135
|
@cache_store = ActiveSupport::Cache::FileStore.new cache_dir
|
@@ -255,9 +255,9 @@ module EBSCO
|
|
255
255
|
#
|
256
256
|
def retrieve(dbid:, an:, highlight: nil, ebook: 'ebook-pdf')
|
257
257
|
payload = { DbId: dbid, An: an, HighlightTerms: highlight, EbookPreferredFormat: ebook }
|
258
|
-
|
259
|
-
retrieve_params = "?an=#{an}&dbid=#{dbid}&ebookpreferredformat=#{ebook}"
|
260
|
-
retrieve_response = do_request(:get, path: @config[:retrieve_url] + retrieve_params)
|
258
|
+
retrieve_response = do_request(:post, path: @config[:retrieve_url], payload: payload)
|
259
|
+
#retrieve_params = "?an=#{an}&dbid=#{dbid}&ebookpreferredformat=#{ebook}"
|
260
|
+
#retrieve_response = do_request(:get, path: @config[:retrieve_url] + retrieve_params)
|
261
261
|
record = EBSCO::EDS::Record.new(retrieve_response)
|
262
262
|
# puts 'RECORD: ' + record.pretty_inspect
|
263
263
|
record
|
@@ -668,16 +668,11 @@ module EBSCO
|
|
668
668
|
qs = CGI.escape(payload.to_query_string)
|
669
669
|
path << '?' + qs
|
670
670
|
end
|
671
|
-
|
671
|
+
req.url path
|
672
672
|
when :post
|
673
673
|
unless payload.nil?
|
674
674
|
json_payload = JSON.generate(payload)
|
675
|
-
|
676
|
-
if path == '/edsapi/rest/Search'
|
677
|
-
# puts 'CHECKSUM PAYLOAD: ' + json_payload
|
678
|
-
checksum = Digest::MD5.hexdigest json_payload
|
679
|
-
path << '?cache_id=' + checksum
|
680
|
-
end
|
675
|
+
path << get_cache_id(path, json_payload) if @use_cache
|
681
676
|
req.body = json_payload
|
682
677
|
end
|
683
678
|
req.url path
|
@@ -837,6 +832,15 @@ module EBSCO
|
|
837
832
|
}
|
838
833
|
end
|
839
834
|
|
835
|
+
# generate a cache id for search and retrieve post requests, using a hash of the payload + guest mode
|
836
|
+
def get_cache_id(path, payload)
|
837
|
+
if path == '/edsapi/rest/Search' or path == '/edsapi/rest/Retrieve'
|
838
|
+
'?cache_id=' + Digest::MD5.hexdigest(payload + @guest.to_s)
|
839
|
+
else
|
840
|
+
''
|
841
|
+
end
|
842
|
+
end
|
843
|
+
|
840
844
|
end
|
841
845
|
|
842
846
|
end
|
data/lib/ebsco/eds/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebsco-eds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bill McKinney
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-08-
|
12
|
+
date: 2017-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|