ebsco-eds 1.0.6 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +1 -2
- data/CHANGELOG.md +87 -4
- data/README.md +1 -1
- data/ebsco-eds.gemspec +16 -16
- data/lib/ebsco/eds/configuration.rb +2 -1
- data/lib/ebsco/eds/record.rb +6 -1
- data/lib/ebsco/eds/results.rb +69 -56
- data/lib/ebsco/eds/session.rb +38 -20
- data/lib/ebsco/eds/version.rb +1 -1
- data/lib/faraday/eds_exception_middleware.rb +13 -9
- metadata +85 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ad7eef9da8bc0d24c7603cebb0527274751d7b98a8823515f5c3e1fec78a49b9
|
4
|
+
data.tar.gz: 823e7b5a92adc097af3d723f89b0c6ea8933a2a77c311151a16a6619b7461b43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7f454baff334b3078566239f6bd7085438d47ddb0d02b92ee5afed73e3392e2c6d2ea198c7451bd2d3bc235aeb30015e64b9c222640d82a99a14b236198ef90
|
7
|
+
data.tar.gz: 9d6c89117a2cbbb43f1538fbf27222629ebcd7679f3ff62367fc04b2ae27412a48fd6a64f58cd7347a2545054f63dc3a8fbb62adb4ef8cbd37e4fd82095e22af
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,93 +1,176 @@
|
|
1
1
|
# Changelog
|
2
|
+
|
2
3
|
All notable changes to this project will be documented in this file.
|
3
4
|
|
4
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
|
-
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [1.1.1] - 2021-03-05
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
- Some tests had incorrect VCR cassettes that were erroneously causing our build to fail.
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
|
16
|
+
- Loosened various dependencies, including on activesupport. Activesupport now can use either version 5 or 6. Many thanks to @sandbergja for help on that.
|
17
|
+
- Added an attribute read option for smarttext_failover on EBSCO::EDS::Results. If this is true, it's an indication that the search results come from a failed-over smarttext search; if it's false, no smarttext failover occurred.
|
18
|
+
|
19
|
+
## [1.1.0] - 2020-09-04
|
20
|
+
|
21
|
+
### Added
|
22
|
+
|
23
|
+
- Added an option to the session intializer to accept a smarttext_failover parameter. Setting this to true will instruct the gem to issue a SECOND search with mode=smarttext if the original search had zero results. This mirrors behavior available in the native EDS interface.
|
24
|
+
|
25
|
+
## [1.0.9] - 2019-08-12
|
26
|
+
|
27
|
+
### Fixed
|
28
|
+
|
29
|
+
- Throws error when query fails with a 200 status code and html error message (query = `the meaning of life or 4=2`), see #90.
|
30
|
+
- Raises a specific "record not found" error instead of a generic "bad request" error when a record cannot be retrieved, see #88.
|
31
|
+
|
32
|
+
## [1.0.8] - 2019-08-12
|
6
33
|
|
7
|
-
## [1.0.6] - 2018-14-02
|
8
34
|
### Fixed
|
35
|
+
|
36
|
+
- Access issues for EBSCO contributors fixed.
|
37
|
+
|
38
|
+
## [1.0.7] - 2018-12-05
|
39
|
+
|
40
|
+
### Changed
|
41
|
+
|
42
|
+
- logger dependency removed since it's been part of the standard library.
|
43
|
+
|
44
|
+
## [1.0.6] - 2018-11-14
|
45
|
+
|
46
|
+
### Fixed
|
47
|
+
|
9
48
|
- Fixed a bug where the cached auth key isn't deleted if it expires before its cache expiration. This should only occur in rare cases where the auth token cache expiration exceeds 30 minutes.
|
49
|
+
|
10
50
|
### Added
|
51
|
+
|
11
52
|
- Cache expiration is configurable for individual EDS API calls (time unit = seconds).
|
53
|
+
|
12
54
|
### Changed
|
55
|
+
|
13
56
|
- Default cache expiration for auth keys is now 25 minutes instead of 30 to make sure they are always refreshed before their 30 minute expiration. If an expiration is configured longer than 25 minutes, it is reset to 25 minutes automatically.
|
14
57
|
|
15
58
|
## [1.0.5] - 2018-11-02
|
59
|
+
|
16
60
|
### Fixed
|
17
|
-
|
61
|
+
|
62
|
+
- Fixed a bug where fulltext html becomes nil after sanitizing. [#85](https://github.com/ebsco/edsapi-ruby/issues/85)
|
18
63
|
- Fixed a bug where the url protocol is missing from fulltext custom links. [#86](https://github.com/ebsco/edsapi-ruby/issues/86)
|
19
64
|
|
20
65
|
## [1.0.4] - 2018-10-29
|
66
|
+
|
21
67
|
### Fixed
|
22
|
-
|
68
|
+
|
69
|
+
- List retrieval returns a repeating list of just the first record.
|
23
70
|
- List retrieval fails to increment the EDS result id.
|
24
71
|
|
25
72
|
## [1.0.3] - 2018-10-18
|
73
|
+
|
26
74
|
### Changed
|
75
|
+
|
27
76
|
- Citation style and export links can now be removed entirely or replaced by specifying regular expressions in several configuration options that can include ruby erb variable expressions for an item's `dbid` and `an`. This was added to address situations where customer proxy urls are returned. See: [Citation link replacement](https://github.com/ebsco/edsapi-ruby/wiki/Citation-link-replacement)
|
28
77
|
|
29
78
|
## [1.0.2] - 2018-10-15
|
79
|
+
|
30
80
|
### Added
|
81
|
+
|
31
82
|
- EBSCOhost links are removed from citation styles and exports by default
|
32
83
|
|
33
84
|
## [1.0.1] - 2018-10-10
|
85
|
+
|
34
86
|
### Added
|
87
|
+
|
35
88
|
- Citation styles/exports are added to Records
|
36
89
|
- Retrieve citation styles/exports for a Record ID or list of Record IDs
|
37
90
|
- Retrieve a list of available citation styles/exports from Info
|
38
91
|
- Citation styles/exports available in guest mode
|
92
|
+
|
39
93
|
### Fixed
|
94
|
+
|
40
95
|
- Double-unescapes data with an ephtml section (sul-dlss/SearchWorks #1504)
|
41
96
|
- Adds searchlinks to subject items when they don't exist #80 (sul-dlss/SearchWorks #1791)
|
97
|
+
|
42
98
|
### Changed
|
99
|
+
|
43
100
|
- Updates test cassettes with new citation styles/exports API calls
|
44
101
|
|
45
102
|
## [1.0.0] - 2018-03-05
|
103
|
+
|
46
104
|
### Changed
|
105
|
+
|
47
106
|
- Increments version to reflect production ready status
|
48
107
|
|
49
108
|
## [0.3.19.pre] - 2018-03-05
|
109
|
+
|
50
110
|
### Added
|
111
|
+
|
51
112
|
- Optionally (default=off) include quick view images with Records
|
113
|
+
|
52
114
|
### Changed
|
115
|
+
|
53
116
|
- Reorganizes VCR tests
|
54
117
|
|
55
118
|
## [0.3.18.pre] - 2017-10-10
|
119
|
+
|
56
120
|
### Fixed
|
121
|
+
|
57
122
|
- Fixes session config bug #84
|
58
123
|
|
59
124
|
## [0.3.17.pre] - 2017-09-27
|
125
|
+
|
60
126
|
### Changed
|
127
|
+
|
61
128
|
- Optionally (default=off) titleize facets via `titleize_facets` in config
|
62
129
|
|
63
130
|
## [0.3.16.pre] - 2017-09-20
|
131
|
+
|
64
132
|
### Added
|
133
|
+
|
65
134
|
- Titleize facets
|
66
135
|
- Autocorrect feature
|
67
136
|
|
68
137
|
## [0.3.15.pre] - 2017-09-18
|
138
|
+
|
69
139
|
### Added
|
140
|
+
|
70
141
|
- Optionally (default=off) converts all searchLink field codes to DE via `all_subjects_search_links` in config
|
71
142
|
- Optionally (default=off) decodes/sanitizes html in item data and fulltext html via `decode_sanitize_html` in config
|
72
143
|
|
73
144
|
## [0.3.14.pre] - 2017-09-14
|
145
|
+
|
74
146
|
### Fixed
|
147
|
+
|
75
148
|
- Fixes 250+ pagination issues with SourceType and ContentProvider facets
|
76
149
|
|
77
150
|
## [0.3.13.pre] - 2017-09-13
|
151
|
+
|
78
152
|
### Fixed
|
153
|
+
|
79
154
|
- Includes additional Subject and Geographic Subject metadata
|
80
155
|
|
81
156
|
## [0.3.12.pre] - 2017-09-11
|
157
|
+
|
82
158
|
### Fixed
|
159
|
+
|
83
160
|
- Fixes some 250+ pagination issues
|
161
|
+
|
84
162
|
### Changed
|
163
|
+
|
85
164
|
- Updates tests
|
86
165
|
|
87
166
|
## [0.3.11.pre] - 2017-09-06
|
167
|
+
|
88
168
|
### Added
|
169
|
+
|
89
170
|
- Adds KW (keywords) and SH (subject heading) to solr search fields
|
90
171
|
|
172
|
+
[1.0.8]: https://github.com/ebsco/edsapi-ruby/compare/1.0.7...1.0.8
|
173
|
+
[1.0.7]: https://github.com/ebsco/edsapi-ruby/compare/1.0.6...1.0.7
|
91
174
|
[1.0.6]: https://github.com/ebsco/edsapi-ruby/compare/1.0.5...1.0.6
|
92
175
|
[1.0.5]: https://github.com/ebsco/edsapi-ruby/compare/1.0.4...1.0.5
|
93
176
|
[1.0.4]: https://github.com/ebsco/edsapi-ruby/compare/1.0.3...1.0.4
|
data/README.md
CHANGED
data/ebsco-eds.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'ebsco/eds/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'ebsco-eds'
|
8
8
|
spec.version = EBSCO::EDS::VERSION
|
9
|
-
spec.authors = ['
|
10
|
-
spec.email = ['
|
9
|
+
spec.authors = ['Mike Abrahamson','Ellie Collier','Madeline Dale','Eric Frierson']
|
10
|
+
spec.email = ['mabrahamson@ebsco.com','ecollier@ebsco.com','mdale@ebsco.com, efrierson@ebsco.com']
|
11
11
|
spec.summary = 'Summary: EBSCO EDS API'
|
12
12
|
spec.description = 'Description: EBSCO EDS API'
|
13
13
|
spec.homepage = 'https://github.com/ebsco/edsapi-ruby'
|
@@ -29,31 +29,31 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.required_ruby_version = '>=
|
32
|
+
spec.required_ruby_version = '>= 2.4'
|
33
33
|
|
34
34
|
spec.add_dependency 'faraday', '~> 0'
|
35
35
|
spec.add_dependency 'faraday-detailed_logger', '~> 2.0'
|
36
36
|
spec.add_dependency 'faraday_middleware', '~> 0.11'
|
37
|
-
spec.add_dependency 'logger', '~> 1.2'
|
38
37
|
spec.add_dependency 'dotenv', '~> 2.2'
|
39
38
|
spec.add_dependency 'climate_control', '~> 0'
|
40
|
-
spec.add_dependency 'require_all', '~>
|
41
|
-
spec.add_dependency 'bibtex-ruby', '
|
39
|
+
spec.add_dependency 'require_all', '~> 2.0'
|
40
|
+
spec.add_dependency 'bibtex-ruby', '>= 5.1.0', '< 7.0'
|
42
41
|
spec.add_dependency 'citeproc', '>= 1.0.4', '< 2.0'
|
43
|
-
spec.add_dependency 'csl', '
|
42
|
+
spec.add_dependency 'csl', '>= 1.4.0', '< 1.6'
|
44
43
|
spec.add_dependency 'citeproc-ruby', '~> 1.0', '>= 1.0.2'
|
45
44
|
spec.add_dependency 'csl-styles', '~> 1.0', '>= 1.0.1.5'
|
46
|
-
spec.add_dependency 'activesupport', '
|
47
|
-
spec.add_dependency 'net-http-persistent', '~>
|
48
|
-
spec.add_dependency 'sanitize', '~>
|
45
|
+
spec.add_dependency 'activesupport', '>= 5.2', '< 6.1'
|
46
|
+
spec.add_dependency 'net-http-persistent', '~> 3.1'
|
47
|
+
spec.add_dependency 'sanitize', '~> 5.0'
|
48
|
+
spec.add_dependency 'public_suffix', '~>4.0'
|
49
49
|
|
50
|
-
spec.add_development_dependency 'bundler'
|
51
|
-
spec.add_development_dependency 'rake', '~> 12.
|
50
|
+
spec.add_development_dependency 'bundler'
|
51
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
52
52
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
53
|
-
spec.add_development_dependency 'simplecov', '~> 0'
|
53
|
+
spec.add_development_dependency 'simplecov', '~> 0.17.0'
|
54
54
|
spec.add_development_dependency 'codecov', '~> 0.1'
|
55
|
-
spec.add_development_dependency 'vcr', '~>
|
56
|
-
spec.add_development_dependency 'minitest-vcr', '~>
|
57
|
-
spec.add_development_dependency 'webmock', '~>
|
55
|
+
spec.add_development_dependency 'vcr', '~> 5.0', '>= 5.0.0'
|
56
|
+
spec.add_development_dependency 'minitest-vcr', '~> 1.4', '>= 1.4.0'
|
57
|
+
spec.add_development_dependency 'webmock', '~> 3.6'
|
58
58
|
|
59
59
|
end
|
data/lib/ebsco/eds/record.rb
CHANGED
@@ -961,7 +961,12 @@ module EBSCO
|
|
961
961
|
html = html.gsub(/\\n /, '')
|
962
962
|
end
|
963
963
|
|
964
|
-
Sanitize.fragment(html, sanitize_config)
|
964
|
+
sanitized_html = Sanitize.fragment(html, sanitize_config)
|
965
|
+
# sanitize 5.0 fails to restore element case after doing lowercase
|
966
|
+
sanitized_html = sanitized_html.gsub(/<searchlink/, '<searchLink')
|
967
|
+
sanitized_html = sanitized_html.gsub(/<\/searchlink>/, '</searchLink>')
|
968
|
+
sanitized_html
|
969
|
+
|
965
970
|
end
|
966
971
|
|
967
972
|
# dynamically add item metadata as 'eds_extra_ItemNameOrLabel'
|
data/lib/ebsco/eds/results.rb
CHANGED
@@ -17,6 +17,8 @@ module EBSCO
|
|
17
17
|
attr_accessor :records
|
18
18
|
# Array of EBSCO::EDS::Record Research Starters
|
19
19
|
attr_reader :research_starters
|
20
|
+
# Bool
|
21
|
+
attr_reader :smarttext_failover
|
20
22
|
# Array of EBSCO::EDS::Record Exact Publication Matches
|
21
23
|
attr_reader :publication_match
|
22
24
|
|
@@ -29,76 +31,87 @@ module EBSCO
|
|
29
31
|
|
30
32
|
# Creates search results from the \EDS API search response. It includes information about the results and a list
|
31
33
|
# of Record items.
|
32
|
-
def initialize(search_results, eds_config = {}, additional_limiters = {}, options = {})
|
34
|
+
def initialize(search_results, eds_config = {}, additional_limiters = {}, options = {}, smarttext_failover = false)
|
33
35
|
|
34
36
|
@results = search_results
|
35
|
-
@limiters = additional_limiters
|
36
|
-
@raw_options = options
|
37
|
-
|
38
|
-
# titleize facets?
|
39
|
-
(ENV.has_key? 'EDS_TITLEIZE_FACETS') ?
|
40
|
-
if %w(y Y yes Yes true True).include?(ENV['EDS_TITLEIZE_FACETS'])
|
41
|
-
@titleize_facets_on = true
|
42
|
-
else
|
43
|
-
@titleize_facets_on = false
|
44
|
-
end :
|
45
|
-
@titleize_facets_on = eds_config[:titleize_facets]
|
46
|
-
|
47
|
-
# convert all results to a list of records
|
48
|
-
@records = []
|
49
|
-
if @results['SearchResult']['Data']['Records']
|
50
|
-
@results['SearchResult']['Data']['Records'].each { |record|
|
51
|
-
|
52
|
-
@records.push(EBSCO::EDS::Record.new(record, eds_config))
|
53
|
-
|
54
|
-
# # records hidden in guest mode
|
55
|
-
# if record['Header']['AccessLevel']
|
56
|
-
# if record['Header']['AccessLevel'].to_i > 1
|
57
|
-
# @records.push(EBSCO::EDS::Record.new(record))
|
58
|
-
# else
|
59
|
-
# @records.push(EBSCO::EDS::Record.new(record))
|
60
|
-
# end
|
61
|
-
# else
|
62
|
-
# @records.push(EBSCO::EDS::Record.new(record))
|
63
|
-
# end
|
64
37
|
|
65
|
-
|
66
|
-
|
38
|
+
if @results.is_a?(Hash)
|
39
|
+
|
40
|
+
@limiters = additional_limiters
|
41
|
+
@raw_options = options
|
42
|
+
|
43
|
+
# titleize facets?
|
44
|
+
(ENV.has_key? 'EDS_TITLEIZE_FACETS') ?
|
45
|
+
if %w(y Y yes Yes true True).include?(ENV['EDS_TITLEIZE_FACETS'])
|
46
|
+
@titleize_facets_on = true
|
47
|
+
else
|
48
|
+
@titleize_facets_on = false
|
49
|
+
end :
|
50
|
+
@titleize_facets_on = eds_config[:titleize_facets]
|
51
|
+
|
52
|
+
# convert all results to a list of records
|
53
|
+
@records = []
|
54
|
+
if @results['SearchResult']['Data']['Records']
|
55
|
+
@results['SearchResult']['Data']['Records'].each { |record|
|
56
|
+
|
57
|
+
@records.push(EBSCO::EDS::Record.new(record, eds_config))
|
58
|
+
|
59
|
+
# # records hidden in guest mode
|
60
|
+
# if record['Header']['AccessLevel']
|
61
|
+
# if record['Header']['AccessLevel'].to_i > 1
|
62
|
+
# @records.push(EBSCO::EDS::Record.new(record))
|
63
|
+
# else
|
64
|
+
# @records.push(EBSCO::EDS::Record.new(record))
|
65
|
+
# end
|
66
|
+
# else
|
67
|
+
# @records.push(EBSCO::EDS::Record.new(record))
|
68
|
+
# end
|
69
|
+
|
70
|
+
}
|
71
|
+
end
|
67
72
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
73
|
+
# create a special list of research starter records
|
74
|
+
@research_starters = []
|
75
|
+
_related_records = @results.fetch('SearchResult',{}).fetch('RelatedContent',{}).fetch('RelatedRecords',{})
|
76
|
+
if _related_records.count > 0
|
77
|
+
_related_records.each do |related_item|
|
78
|
+
if related_item['Type'] == 'rs'
|
79
|
+
rs_entries = related_item.fetch('Records',{})
|
80
|
+
if rs_entries.count > 0
|
81
|
+
rs_entries.each do |rs_record|
|
82
|
+
@research_starters.push(EBSCO::EDS::Record.new(rs_record, eds_config))
|
83
|
+
end
|
78
84
|
end
|
79
85
|
end
|
80
86
|
end
|
81
87
|
end
|
82
|
-
end
|
83
88
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
# create a special list of exact match publications
|
90
|
+
@publication_match = []
|
91
|
+
_related_publications = @results.fetch('SearchResult',{}).fetch('RelatedContent',{}).fetch('RelatedPublications',{})
|
92
|
+
if _related_publications.count > 0
|
93
|
+
_related_publications.each do |related_item|
|
94
|
+
if related_item['Type'] == 'emp'
|
95
|
+
_publication_matches = related_item.fetch('PublicationRecords',{})
|
96
|
+
if _publication_matches.count > 0
|
97
|
+
_publication_matches.each do |publication_record|
|
98
|
+
@publication_match.push(EBSCO::EDS::Record.new(publication_record, eds_config))
|
99
|
+
end
|
94
100
|
end
|
95
101
|
end
|
96
102
|
end
|
97
103
|
end
|
98
|
-
end
|
99
104
|
|
100
|
-
|
101
|
-
|
105
|
+
# titleize facets
|
106
|
+
@titleize_facets = %w[Language Journal SubjectEDS SubjectGeographic Publisher]
|
107
|
+
|
108
|
+
# set flag that query was rerun with smarttext after no results were found
|
109
|
+
@smarttext_failover = smarttext_failover
|
110
|
+
|
111
|
+
else
|
112
|
+
# response isn't a hash (eg, html error page)
|
113
|
+
raise EBSCO::EDS::ApiError, 'EBSCO API error: Query failed.'
|
114
|
+
end
|
102
115
|
|
103
116
|
end
|
104
117
|
|
data/lib/ebsco/eds/session.rb
CHANGED
@@ -243,11 +243,15 @@ module EBSCO
|
|
243
243
|
if @search_options.nil? || !add_actions
|
244
244
|
@search_options = EBSCO::EDS::Options.new(options, @info)
|
245
245
|
end
|
246
|
-
|
247
246
|
_response = do_request(:post, path: '/edsapi/rest/Search', payload: @search_options)
|
248
247
|
@search_results = EBSCO::EDS::Results.new(_response, @config,
|
249
248
|
@info.available_limiters, options)
|
250
|
-
|
249
|
+
if @search_results.stat_total_hits.to_i == 0 && @config[:smarttext_failover] == true
|
250
|
+
@search_options.add_actions('SetSearchMode(smart)', @info)
|
251
|
+
_response = do_request(:post, path: '/edsapi/rest/Search', payload: @search_options)
|
252
|
+
@search_results = EBSCO::EDS::Results.new(_response, @config,
|
253
|
+
@info.available_limiters, options, true)
|
254
|
+
end
|
251
255
|
# create temp format facet results if needed
|
252
256
|
if options['f']
|
253
257
|
if options['f'].key?('eds_publication_type_facet')
|
@@ -340,21 +344,24 @@ module EBSCO
|
|
340
344
|
citation_exports_params = "?an=#{an}&dbid=#{dbid}&format=#{format}"
|
341
345
|
citation_exports_response = do_request(:get, path: @config[:citation_exports_url] + citation_exports_params)
|
342
346
|
EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: citation_exports_response, eds_config: @config)
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
347
|
+
rescue EBSCO::EDS::NotFound => e
|
348
|
+
custom_error_message = JSON.parse e.message.gsub('=>', ':')
|
349
|
+
# ErrorNumber 132 - Record not found
|
350
|
+
if custom_error_message['ErrorNumber'] == '132'
|
351
|
+
record_not_found = {"Format"=>format, "Label"=>"", "Data"=>"", "Error"=>"Record not found"}
|
352
|
+
EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: record_not_found, eds_config: @config)
|
353
|
+
end
|
354
|
+
rescue EBSCO::EDS::BadRequest => e
|
355
|
+
custom_error_message = JSON.parse e.message.gsub('=>', ':')
|
356
|
+
# ErrorNumber 112 - Invalid Argument Value
|
357
|
+
if custom_error_message['ErrorNumber'] == '112'
|
358
|
+
unknown_export_format = {"Format"=>format, "Label"=>"", "Data"=>"", "Error"=>"Invalid citation export format"}
|
359
|
+
EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: unknown_export_format, eds_config: @config)
|
360
|
+
else
|
361
|
+
unknown_error = {"Format"=>format, "Label"=>"", "Data"=>"", "Error"=>custom_error_message['ErrorDescription']}
|
362
|
+
EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: unknown_error, eds_config: @config)
|
363
|
+
end
|
356
364
|
end
|
357
|
-
end
|
358
365
|
end
|
359
366
|
|
360
367
|
# fetch the citation from the citation rest endpoint
|
@@ -363,6 +370,13 @@ module EBSCO
|
|
363
370
|
citation_styles_params = "?an=#{an}&dbid=#{dbid}&styles=#{format}"
|
364
371
|
citation_styles_response = do_request(:get, path: @config[:citation_styles_url] + citation_styles_params)
|
365
372
|
EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: citation_styles_response, eds_config: @config)
|
373
|
+
rescue EBSCO::EDS::NotFound => e
|
374
|
+
custom_error_message = JSON.parse e.message.gsub('=>', ':')
|
375
|
+
# ErrorNumber 132 - Record not found
|
376
|
+
if custom_error_message['ErrorNumber'] == '132'
|
377
|
+
record_not_found = {"Format"=>format, "Label"=>"", "Data"=>"", "Error"=>"Record not found"}
|
378
|
+
EBSCO::EDS::Citations.new(dbid: dbid, an: an, citation_result: record_not_found, eds_config: @config)
|
379
|
+
end
|
366
380
|
rescue EBSCO::EDS::BadRequest => e
|
367
381
|
custom_error_message = JSON.parse e.message.gsub('=>', ':')
|
368
382
|
unknown_error = {"Id"=>format, "Label"=>"", "Data"=>"", "Error"=>custom_error_message['ErrorDescription']}
|
@@ -470,9 +484,13 @@ module EBSCO
|
|
470
484
|
list.each.with_index(1) { |id, index|
|
471
485
|
dbid = id.split('__',2).first
|
472
486
|
accession = id.split('__',2).last
|
473
|
-
|
474
|
-
|
475
|
-
|
487
|
+
begin
|
488
|
+
current_rec = retrieve(dbid: dbid, an: accession, highlight: highlight, ebook: @config[:ebook_preferred_format])
|
489
|
+
current_rec.eds_result_id = index
|
490
|
+
records.push current_rec
|
491
|
+
rescue EBSCO::EDS::BadRequest, EBSCO::EDS::NotFound => e
|
492
|
+
puts "Request for #{id} in #{self.class.name}#solr_retrieve_list failed with #{e}" if @debug
|
493
|
+
end
|
476
494
|
}
|
477
495
|
end
|
478
496
|
r = empty_results(records.length)
|
@@ -1251,4 +1269,4 @@ module EBSCO
|
|
1251
1269
|
|
1252
1270
|
end
|
1253
1271
|
end
|
1254
|
-
end
|
1272
|
+
end
|
data/lib/ebsco/eds/version.rb
CHANGED
@@ -14,15 +14,19 @@ module Faraday
|
|
14
14
|
case response.status
|
15
15
|
when 200
|
16
16
|
when 400
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
if response.body['ErrorNumber'] == '132'
|
18
|
+
raise EBSCO::EDS::NotFound.new(error_message(response))
|
19
|
+
else
|
20
|
+
raise EBSCO::EDS::BadRequest.new(error_message(response))
|
21
|
+
end
|
22
|
+
# when 401
|
23
|
+
# raise EBSCO::EDS::Unauthorized.new
|
24
|
+
# when 403
|
25
|
+
# raise EBSCO::EDS::Forbidden.new
|
26
|
+
# when 404
|
27
|
+
# raise EBSCO::EDS::NotFound.new
|
28
|
+
# when 429
|
29
|
+
# raise EBSCO::EDS::TooManyRequests.new
|
26
30
|
when 500
|
27
31
|
raise EBSCO::EDS::InternalServerError.new
|
28
32
|
when 503
|
metadata
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebsco-eds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Mike Abrahamson
|
8
|
+
- Ellie Collier
|
9
|
+
- Madeline Dale
|
8
10
|
- Eric Frierson
|
9
11
|
autorequire:
|
10
12
|
bindir: exe
|
11
13
|
cert_chain: []
|
12
|
-
date:
|
14
|
+
date: 2021-03-05 00:00:00.000000000 Z
|
13
15
|
dependencies:
|
14
16
|
- !ruby/object:Gem::Dependency
|
15
17
|
name: faraday
|
@@ -53,20 +55,6 @@ dependencies:
|
|
53
55
|
- - "~>"
|
54
56
|
- !ruby/object:Gem::Version
|
55
57
|
version: '0.11'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: logger
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '1.2'
|
63
|
-
type: :runtime
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '1.2'
|
70
58
|
- !ruby/object:Gem::Dependency
|
71
59
|
name: dotenv
|
72
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,28 +89,34 @@ dependencies:
|
|
101
89
|
requirements:
|
102
90
|
- - "~>"
|
103
91
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
92
|
+
version: '2.0'
|
105
93
|
type: :runtime
|
106
94
|
prerelease: false
|
107
95
|
version_requirements: !ruby/object:Gem::Requirement
|
108
96
|
requirements:
|
109
97
|
- - "~>"
|
110
98
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
99
|
+
version: '2.0'
|
112
100
|
- !ruby/object:Gem::Dependency
|
113
101
|
name: bibtex-ruby
|
114
102
|
requirement: !ruby/object:Gem::Requirement
|
115
103
|
requirements:
|
116
|
-
- - "
|
104
|
+
- - ">="
|
117
105
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
106
|
+
version: 5.1.0
|
107
|
+
- - "<"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '7.0'
|
119
110
|
type: :runtime
|
120
111
|
prerelease: false
|
121
112
|
version_requirements: !ruby/object:Gem::Requirement
|
122
113
|
requirements:
|
123
|
-
- - "
|
114
|
+
- - ">="
|
124
115
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
116
|
+
version: 5.1.0
|
117
|
+
- - "<"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '7.0'
|
126
120
|
- !ruby/object:Gem::Dependency
|
127
121
|
name: citeproc
|
128
122
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,16 +141,22 @@ dependencies:
|
|
147
141
|
name: csl
|
148
142
|
requirement: !ruby/object:Gem::Requirement
|
149
143
|
requirements:
|
150
|
-
- - "
|
144
|
+
- - ">="
|
151
145
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
146
|
+
version: 1.4.0
|
147
|
+
- - "<"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.6'
|
153
150
|
type: :runtime
|
154
151
|
prerelease: false
|
155
152
|
version_requirements: !ruby/object:Gem::Requirement
|
156
153
|
requirements:
|
157
|
-
- - "
|
154
|
+
- - ">="
|
158
155
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
156
|
+
version: 1.4.0
|
157
|
+
- - "<"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.6'
|
160
160
|
- !ruby/object:Gem::Dependency
|
161
161
|
name: citeproc-ruby
|
162
162
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,78 +201,92 @@ dependencies:
|
|
201
201
|
name: activesupport
|
202
202
|
requirement: !ruby/object:Gem::Requirement
|
203
203
|
requirements:
|
204
|
-
- - "
|
204
|
+
- - ">="
|
205
205
|
- !ruby/object:Gem::Version
|
206
|
-
version: '5.
|
206
|
+
version: '5.2'
|
207
|
+
- - "<"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '6.1'
|
207
210
|
type: :runtime
|
208
211
|
prerelease: false
|
209
212
|
version_requirements: !ruby/object:Gem::Requirement
|
210
213
|
requirements:
|
211
|
-
- - "
|
214
|
+
- - ">="
|
212
215
|
- !ruby/object:Gem::Version
|
213
|
-
version: '5.
|
216
|
+
version: '5.2'
|
217
|
+
- - "<"
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '6.1'
|
214
220
|
- !ruby/object:Gem::Dependency
|
215
221
|
name: net-http-persistent
|
216
222
|
requirement: !ruby/object:Gem::Requirement
|
217
223
|
requirements:
|
218
224
|
- - "~>"
|
219
225
|
- !ruby/object:Gem::Version
|
220
|
-
version: '
|
226
|
+
version: '3.1'
|
221
227
|
type: :runtime
|
222
228
|
prerelease: false
|
223
229
|
version_requirements: !ruby/object:Gem::Requirement
|
224
230
|
requirements:
|
225
231
|
- - "~>"
|
226
232
|
- !ruby/object:Gem::Version
|
227
|
-
version: '
|
233
|
+
version: '3.1'
|
228
234
|
- !ruby/object:Gem::Dependency
|
229
235
|
name: sanitize
|
230
236
|
requirement: !ruby/object:Gem::Requirement
|
231
237
|
requirements:
|
232
238
|
- - "~>"
|
233
239
|
- !ruby/object:Gem::Version
|
234
|
-
version: '
|
235
|
-
- - ">="
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
version: 4.5.0
|
240
|
+
version: '5.0'
|
238
241
|
type: :runtime
|
239
242
|
prerelease: false
|
240
243
|
version_requirements: !ruby/object:Gem::Requirement
|
241
244
|
requirements:
|
242
245
|
- - "~>"
|
243
246
|
- !ruby/object:Gem::Version
|
244
|
-
version: '
|
245
|
-
|
247
|
+
version: '5.0'
|
248
|
+
- !ruby/object:Gem::Dependency
|
249
|
+
name: public_suffix
|
250
|
+
requirement: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - "~>"
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '4.0'
|
255
|
+
type: :runtime
|
256
|
+
prerelease: false
|
257
|
+
version_requirements: !ruby/object:Gem::Requirement
|
258
|
+
requirements:
|
259
|
+
- - "~>"
|
246
260
|
- !ruby/object:Gem::Version
|
247
|
-
version: 4.
|
261
|
+
version: '4.0'
|
248
262
|
- !ruby/object:Gem::Dependency
|
249
263
|
name: bundler
|
250
264
|
requirement: !ruby/object:Gem::Requirement
|
251
265
|
requirements:
|
252
|
-
- - "
|
266
|
+
- - ">="
|
253
267
|
- !ruby/object:Gem::Version
|
254
|
-
version: '
|
268
|
+
version: '0'
|
255
269
|
type: :development
|
256
270
|
prerelease: false
|
257
271
|
version_requirements: !ruby/object:Gem::Requirement
|
258
272
|
requirements:
|
259
|
-
- - "
|
273
|
+
- - ">="
|
260
274
|
- !ruby/object:Gem::Version
|
261
|
-
version: '
|
275
|
+
version: '0'
|
262
276
|
- !ruby/object:Gem::Dependency
|
263
277
|
name: rake
|
264
278
|
requirement: !ruby/object:Gem::Requirement
|
265
279
|
requirements:
|
266
280
|
- - "~>"
|
267
281
|
- !ruby/object:Gem::Version
|
268
|
-
version: '12.
|
282
|
+
version: '12.3'
|
269
283
|
type: :development
|
270
284
|
prerelease: false
|
271
285
|
version_requirements: !ruby/object:Gem::Requirement
|
272
286
|
requirements:
|
273
287
|
- - "~>"
|
274
288
|
- !ruby/object:Gem::Version
|
275
|
-
version: '12.
|
289
|
+
version: '12.3'
|
276
290
|
- !ruby/object:Gem::Dependency
|
277
291
|
name: minitest
|
278
292
|
requirement: !ruby/object:Gem::Requirement
|
@@ -293,14 +307,14 @@ dependencies:
|
|
293
307
|
requirements:
|
294
308
|
- - "~>"
|
295
309
|
- !ruby/object:Gem::Version
|
296
|
-
version:
|
310
|
+
version: 0.17.0
|
297
311
|
type: :development
|
298
312
|
prerelease: false
|
299
313
|
version_requirements: !ruby/object:Gem::Requirement
|
300
314
|
requirements:
|
301
315
|
- - "~>"
|
302
316
|
- !ruby/object:Gem::Version
|
303
|
-
version:
|
317
|
+
version: 0.17.0
|
304
318
|
- !ruby/object:Gem::Dependency
|
305
319
|
name: codecov
|
306
320
|
requirement: !ruby/object:Gem::Requirement
|
@@ -319,47 +333,61 @@ dependencies:
|
|
319
333
|
name: vcr
|
320
334
|
requirement: !ruby/object:Gem::Requirement
|
321
335
|
requirements:
|
336
|
+
- - ">="
|
337
|
+
- !ruby/object:Gem::Version
|
338
|
+
version: 5.0.0
|
322
339
|
- - "~>"
|
323
340
|
- !ruby/object:Gem::Version
|
324
|
-
version: '
|
341
|
+
version: '5.0'
|
325
342
|
type: :development
|
326
343
|
prerelease: false
|
327
344
|
version_requirements: !ruby/object:Gem::Requirement
|
328
345
|
requirements:
|
346
|
+
- - ">="
|
347
|
+
- !ruby/object:Gem::Version
|
348
|
+
version: 5.0.0
|
329
349
|
- - "~>"
|
330
350
|
- !ruby/object:Gem::Version
|
331
|
-
version: '
|
351
|
+
version: '5.0'
|
332
352
|
- !ruby/object:Gem::Dependency
|
333
353
|
name: minitest-vcr
|
334
354
|
requirement: !ruby/object:Gem::Requirement
|
335
355
|
requirements:
|
356
|
+
- - ">="
|
357
|
+
- !ruby/object:Gem::Version
|
358
|
+
version: 1.4.0
|
336
359
|
- - "~>"
|
337
360
|
- !ruby/object:Gem::Version
|
338
|
-
version:
|
361
|
+
version: '1.4'
|
339
362
|
type: :development
|
340
363
|
prerelease: false
|
341
364
|
version_requirements: !ruby/object:Gem::Requirement
|
342
365
|
requirements:
|
366
|
+
- - ">="
|
367
|
+
- !ruby/object:Gem::Version
|
368
|
+
version: 1.4.0
|
343
369
|
- - "~>"
|
344
370
|
- !ruby/object:Gem::Version
|
345
|
-
version:
|
371
|
+
version: '1.4'
|
346
372
|
- !ruby/object:Gem::Dependency
|
347
373
|
name: webmock
|
348
374
|
requirement: !ruby/object:Gem::Requirement
|
349
375
|
requirements:
|
350
376
|
- - "~>"
|
351
377
|
- !ruby/object:Gem::Version
|
352
|
-
version: '
|
378
|
+
version: '3.6'
|
353
379
|
type: :development
|
354
380
|
prerelease: false
|
355
381
|
version_requirements: !ruby/object:Gem::Requirement
|
356
382
|
requirements:
|
357
383
|
- - "~>"
|
358
384
|
- !ruby/object:Gem::Version
|
359
|
-
version: '
|
385
|
+
version: '3.6'
|
360
386
|
description: 'Description: EBSCO EDS API'
|
361
387
|
email:
|
362
|
-
-
|
388
|
+
- mabrahamson@ebsco.com
|
389
|
+
- ecollier@ebsco.com
|
390
|
+
- mdale@ebsco.com, efrierson@ebsco.com
|
363
391
|
executables: []
|
364
392
|
extensions: []
|
365
393
|
extra_rdoc_files: []
|
@@ -406,15 +434,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
406
434
|
requirements:
|
407
435
|
- - ">="
|
408
436
|
- !ruby/object:Gem::Version
|
409
|
-
version:
|
437
|
+
version: '2.4'
|
410
438
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
411
439
|
requirements:
|
412
440
|
- - ">="
|
413
441
|
- !ruby/object:Gem::Version
|
414
442
|
version: '0'
|
415
443
|
requirements: []
|
416
|
-
|
417
|
-
rubygems_version: 2.5.2.3
|
444
|
+
rubygems_version: 3.0.6
|
418
445
|
signing_key:
|
419
446
|
specification_version: 4
|
420
447
|
summary: 'Summary: EBSCO EDS API'
|