ebsco-eds 0.3.0.pre → 0.3.1.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5353c7f332e965904370d4defe3ffddc1c188992
4
- data.tar.gz: b2fb35896f412a06d76c3889337b9741f14d4bc9
3
+ metadata.gz: c5bc349f6a65afd5f8dad6d89441d9a72a5d7ee0
4
+ data.tar.gz: 7c028d8098e5555497964019848680acd3a5b5bb
5
5
  SHA512:
6
- metadata.gz: c586fb16ec00a3b975b24ff65a762e9aaff0993d4578fee0ed2f4f8f8b142e9abfb95f61fadccaf40ac2d2375bc13ea1c365f4178f399f30de85028b1e552646
7
- data.tar.gz: cbc65d09fa611f4f25cd51d9529b0722e3be36ee3cfc1b226467d6d2beb67d72383a6b59ef14195e67838bcbc3e5b9c885ab4b2ff203670479a374cd29852160
6
+ metadata.gz: fae36ea68f3dac43929a793b4e835f52537919a6a82319448904aa14881bbca3da12f68b0c951511a636c203e92715ef259b475b9249f61b66d5fefef6a5fcf3
7
+ data.tar.gz: fd665b635c020835db13eb6d87f2f3ab4b87bd07e81b3cc8ff92a963e1cf2a7a2cb094810b118bb0cea35cd2c2aedf29218794d1f6da43f4eefde6342b4f7114
@@ -129,7 +129,7 @@ module EBSCO
129
129
  end :
130
130
  @debug = @config[:debug]
131
131
 
132
- # use cache for auth token and info calls?
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
- # 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)
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
- req.url path
671
+ req.url path
672
672
  when :post
673
673
  unless payload.nil?
674
674
  json_payload = JSON.generate(payload)
675
- # add a cache_id to post search requests to make them cacheable
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
@@ -1,5 +1,5 @@
1
1
  module EBSCO
2
2
  module EDS
3
- VERSION = '0.3.0.pre'
3
+ VERSION = '0.3.1.pre'
4
4
  end
5
5
  end
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.0.pre
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-03 00:00:00.000000000 Z
12
+ date: 2017-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday