ebsco-eds 0.3.11.pre → 0.3.12.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 +4 -4
- data/ebsco-eds.gemspec +1 -1
- data/lib/ebsco/eds/options.rb +181 -159
- data/lib/ebsco/eds/record.rb +61 -0
- data/lib/ebsco/eds/session.rb +7 -4
- data/lib/ebsco/eds/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d4f34a2f1413eab073c1b0b2f2509338af1a5c3e
|
|
4
|
+
data.tar.gz: deff1b5f31a7da1d4004b369b943bcb8942fb32e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f960b731df8741229d42f13809a6ded2cde56d717eab644603ee5d9cd31025b01aad317bb99b311014df38edf4fb281c29d2bc8b82c66cffd55da4d2d57dc11
|
|
7
|
+
data.tar.gz: 687cb32c89a654aecbe0a73d7ef9afa08047a29bb8149dd6a24ade108ab70df7ad2b89129687ee5a0465b442f903a55ac5e1d91a95aacba80754e09c76ed50d1
|
data/ebsco-eds.gemspec
CHANGED
|
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
|
|
|
45
45
|
spec.add_dependency 'csl-styles', '~> 1.0', '>= 1.0.1.5'
|
|
46
46
|
spec.add_dependency 'activesupport', '~> 5.0'
|
|
47
47
|
spec.add_dependency 'net-http-persistent', '~> 2.9'
|
|
48
|
-
spec.add_dependency 'sanitize', '~> 4.5.0'
|
|
48
|
+
spec.add_dependency 'sanitize', '~> 4.5', '>= 4.5.0'
|
|
49
49
|
|
|
50
50
|
spec.add_development_dependency 'bundler', '~> 1.13'
|
|
51
51
|
spec.add_development_dependency 'rake', '~> 12.0'
|
data/lib/ebsco/eds/options.rb
CHANGED
|
@@ -24,25 +24,6 @@ module EBSCO
|
|
|
24
24
|
# end
|
|
25
25
|
# end
|
|
26
26
|
|
|
27
|
-
# blacklight year range slider input
|
|
28
|
-
# "range"=>{"pub_year_tisim"=>{"begin"=>"1970", "end"=>"1980"}}
|
|
29
|
-
if options.has_key?('range')
|
|
30
|
-
if options['range'].has_key?('pub_year_tisim')
|
|
31
|
-
begin_year = nil
|
|
32
|
-
end_year = nil
|
|
33
|
-
if options['range']['pub_year_tisim'].has_key?('begin')
|
|
34
|
-
begin_year = options['range']['pub_year_tisim']['begin']
|
|
35
|
-
end
|
|
36
|
-
if options['range']['pub_year_tisim'].has_key?('end')
|
|
37
|
-
end_year = options['range']['pub_year_tisim']['end']
|
|
38
|
-
end
|
|
39
|
-
unless begin_year.nil? or end_year.nil?
|
|
40
|
-
pub_year_tisim_range = begin_year + '-01/' + end_year + '-01'
|
|
41
|
-
@Actions.push "addlimiter(DT1:#{pub_year_tisim_range})"
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
27
|
# add page default of 1
|
|
47
28
|
unless options.has_key?('page') || options.has_key?('page_number')
|
|
48
29
|
options['page'] = 1
|
|
@@ -60,145 +41,6 @@ module EBSCO
|
|
|
60
41
|
when 'page', 'page_number'
|
|
61
42
|
@Actions.push "GoToPage(#{value.to_i})"
|
|
62
43
|
|
|
63
|
-
# solr facet translation
|
|
64
|
-
# "f"=>{"format"=>["eBooks"]}
|
|
65
|
-
when 'f'
|
|
66
|
-
if value.has_key?('eds_publication_type_facet')
|
|
67
|
-
format_list = value['eds_publication_type_facet']
|
|
68
|
-
format_list.each do |item|
|
|
69
|
-
item = eds_sanitize item
|
|
70
|
-
@Actions.push "addfacetfilter(SourceType:#{item})"
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
if value.has_key?('eds_language_facet')
|
|
75
|
-
lang_list = value['eds_language_facet']
|
|
76
|
-
lang_list.each do |item|
|
|
77
|
-
item = eds_sanitize item
|
|
78
|
-
@Actions.push "addfacetfilter(Language:#{item})"
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
if value.has_key?('eds_subject_topic_facet')
|
|
83
|
-
subj_list = value['eds_subject_topic_facet']
|
|
84
|
-
subj_list.each do |item|
|
|
85
|
-
item = eds_sanitize item
|
|
86
|
-
@Actions.push "addfacetfilter(SubjectEDS:#{item})"
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
if value.has_key?('eds_subjects_geographic_facet')
|
|
91
|
-
subj_list = value['eds_subjects_geographic_facet']
|
|
92
|
-
subj_list.each do |item|
|
|
93
|
-
item = eds_sanitize item
|
|
94
|
-
@Actions.push "addfacetfilter(SubjectGeographic:#{item})"
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
if value.has_key?('eds_publisher_facet')
|
|
99
|
-
subj_list = value['eds_publisher_facet']
|
|
100
|
-
subj_list.each do |item|
|
|
101
|
-
item = eds_sanitize item
|
|
102
|
-
@Actions.push "addfacetfilter(Publisher:#{item})"
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
if value.has_key?('eds_journal_facet')
|
|
107
|
-
subj_list = value['eds_journal_facet']
|
|
108
|
-
subj_list.each do |item|
|
|
109
|
-
item = eds_sanitize item
|
|
110
|
-
@Actions.push "addfacetfilter(Journal:#{item})"
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
if value.has_key?('eds_category_facet')
|
|
115
|
-
subj_list = value['eds_category_facet']
|
|
116
|
-
subj_list.each do |item|
|
|
117
|
-
item = eds_sanitize item
|
|
118
|
-
@Actions.push "addfacetfilter(Category:#{item})"
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
if value.has_key?('eds_content_provider_facet')
|
|
123
|
-
subj_list = value['eds_content_provider_facet']
|
|
124
|
-
subj_list.each do |item|
|
|
125
|
-
item = eds_sanitize item
|
|
126
|
-
@Actions.push "addfacetfilter(ContentProvider:#{item})"
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
if value.has_key?('eds_library_location_facet')
|
|
131
|
-
subj_list = value['eds_library_location_facet']
|
|
132
|
-
subj_list.each do |item|
|
|
133
|
-
item = eds_sanitize item
|
|
134
|
-
@Actions.push "addfacetfilter(LocationLibrary:#{item})"
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
if value.has_key?('eds_library_collection_facet')
|
|
139
|
-
subj_list = value['eds_library_collection_facet']
|
|
140
|
-
subj_list.each do |item|
|
|
141
|
-
item = eds_sanitize item
|
|
142
|
-
@Actions.push "addfacetfilter(CollectionLibrary:#{item})"
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
if value.has_key?('eds_author_university_facet')
|
|
147
|
-
subj_list = value['eds_author_university_facet']
|
|
148
|
-
subj_list.each do |item|
|
|
149
|
-
item = eds_sanitize item
|
|
150
|
-
@Actions.push "addfacetfilter(AuthorUniversity:#{item})"
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# translate solr search limiters into EDS API addLimiter calls
|
|
155
|
-
# matches are determined by the limiter labels passed in by solr
|
|
156
|
-
_search_limiter_list = []
|
|
157
|
-
if value.has_key?('eds_search_limiters_facet')
|
|
158
|
-
_search_limiter_list = value['eds_search_limiters_facet']
|
|
159
|
-
end
|
|
160
|
-
info.available_limiters.each do |limiter|
|
|
161
|
-
# only handle 'select' limiters (ones with values of 'y' or 'n')
|
|
162
|
-
if ( _search_limiter_list.include? limiter['Label'] or _search_limiter_list.include? limiter['Id']) and limiter['Type'] == 'select'
|
|
163
|
-
@Actions.push "addLimiter(#{limiter['Id']}:y)"
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
if value.has_key?('eds_publication_year_range_facet')
|
|
168
|
-
_list = value['eds_publication_year_range_facet']
|
|
169
|
-
_this_year = Date.today.year
|
|
170
|
-
_this_month = Date.today.month
|
|
171
|
-
_list.each do |item|
|
|
172
|
-
if item == 'This year'
|
|
173
|
-
_range = _this_year.to_s + '-01/' + _this_year.to_s + '-' + _this_month.to_s
|
|
174
|
-
@Actions.push "addlimiter(DT1:#{_range})"
|
|
175
|
-
end
|
|
176
|
-
if item == 'Last 3 years'
|
|
177
|
-
_range = (_this_year-3).to_s + '-' + _this_month.to_s + '/' + _this_year.to_s + '-' + _this_month.to_s
|
|
178
|
-
@Actions.push "addlimiter(DT1:#{_range})"
|
|
179
|
-
end
|
|
180
|
-
if item == 'Last 10 years'
|
|
181
|
-
_range = (_this_year-10).to_s + '-' + _this_month.to_s + '/' + _this_year.to_s + '-' + _this_month.to_s
|
|
182
|
-
@Actions.push "addlimiter(DT1:#{_range})"
|
|
183
|
-
end
|
|
184
|
-
if item == 'Last 50 years'
|
|
185
|
-
_range = (_this_year-50).to_s + '-' + _this_month.to_s + '/' + _this_year.to_s + '-' + _this_month.to_s
|
|
186
|
-
@Actions.push "addlimiter(DT1:#{_range})"
|
|
187
|
-
end
|
|
188
|
-
if item == 'More than 50 years ago'
|
|
189
|
-
_range = '0000-01/' + (_this_year-50).to_s + '-12'
|
|
190
|
-
@Actions.push "addlimiter(DT1:#{_range})"
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
if value.has_key?('eds_publication_year_facet')
|
|
196
|
-
year_list = value['eds_publication_year_facet']
|
|
197
|
-
year_list.each do |item|
|
|
198
|
-
@Actions.push "addfacetfilter(PublicationYear:#{item})"
|
|
199
|
-
end
|
|
200
|
-
end
|
|
201
|
-
|
|
202
44
|
end
|
|
203
45
|
end
|
|
204
46
|
|
|
@@ -334,13 +176,35 @@ module EBSCO
|
|
|
334
176
|
_my_expanders = []
|
|
335
177
|
_available_expander_ids = info.available_expander_ids
|
|
336
178
|
|
|
337
|
-
@
|
|
179
|
+
@Limiters = nil
|
|
338
180
|
_my_limiters = []
|
|
339
181
|
|
|
182
|
+
@FacetFilters = []
|
|
183
|
+
_my_filters = {'FilterId' => 1, 'FacetValues' => []}
|
|
184
|
+
|
|
340
185
|
@RelatedContent = info.default_related_content_types
|
|
341
186
|
_my_related_content = []
|
|
342
187
|
_available_related_content_types = info.available_related_content_types
|
|
343
188
|
|
|
189
|
+
# blacklight year range slider input
|
|
190
|
+
# "range"=>{"pub_year_tisim"=>{"begin"=>"1970", "end"=>"1980"}}
|
|
191
|
+
if options.has_key?('range')
|
|
192
|
+
if options['range'].has_key?('pub_year_tisim')
|
|
193
|
+
begin_year = nil
|
|
194
|
+
end_year = nil
|
|
195
|
+
if options['range']['pub_year_tisim'].has_key?('begin')
|
|
196
|
+
begin_year = options['range']['pub_year_tisim']['begin']
|
|
197
|
+
end
|
|
198
|
+
if options['range']['pub_year_tisim'].has_key?('end')
|
|
199
|
+
end_year = options['range']['pub_year_tisim']['end']
|
|
200
|
+
end
|
|
201
|
+
unless begin_year.nil? or end_year.nil?
|
|
202
|
+
pub_year_tisim_range = begin_year + '-01/' + end_year + '-01'
|
|
203
|
+
_my_limiters.push({:Id => 'DT1', :Values => [pub_year_tisim_range]})
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
344
208
|
options.each do |key, value|
|
|
345
209
|
|
|
346
210
|
case key
|
|
@@ -463,9 +327,152 @@ module EBSCO
|
|
|
463
327
|
end
|
|
464
328
|
@Expanders = _my_expanders
|
|
465
329
|
|
|
330
|
+
# ====================================================================================
|
|
331
|
+
# solr limiters & facets
|
|
332
|
+
# ====================================================================================
|
|
333
|
+
|
|
334
|
+
when 'f'
|
|
335
|
+
_search_limiter_list = []
|
|
336
|
+
if value.has_key?('eds_search_limiters_facet')
|
|
337
|
+
_search_limiter_list = value['eds_search_limiters_facet']
|
|
338
|
+
end
|
|
339
|
+
info.available_limiters.each do |limiter|
|
|
340
|
+
# only handle 'select' limiters (ones with values of 'y' or 'n')
|
|
341
|
+
if ( _search_limiter_list.include? limiter['Label'] or _search_limiter_list.include? limiter['Id']) and limiter['Type'] == 'select'
|
|
342
|
+
_my_limiters.push({:Id => limiter['Id'], :Values => ['y']})
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# date limiters
|
|
347
|
+
if value.has_key?('eds_publication_year_range_facet')
|
|
348
|
+
_list = value['eds_publication_year_range_facet']
|
|
349
|
+
_this_year = Date.today.year
|
|
350
|
+
_this_month = Date.today.month
|
|
351
|
+
_list.each do |item|
|
|
352
|
+
if item == 'This year'
|
|
353
|
+
_range = _this_year.to_s + '-01/' + _this_year.to_s + '-' + _this_month.to_s
|
|
354
|
+
_my_limiters.push({:Id => 'DT1', :Values => [_range]})
|
|
355
|
+
end
|
|
356
|
+
if item == 'Last 3 years'
|
|
357
|
+
_range = (_this_year-3).to_s + '-' + _this_month.to_s + '/' + _this_year.to_s + '-' + _this_month.to_s
|
|
358
|
+
_my_limiters.push({:Id => 'DT1', :Values => [_range]})
|
|
359
|
+
end
|
|
360
|
+
if item == 'Last 10 years'
|
|
361
|
+
_range = (_this_year-10).to_s + '-' + _this_month.to_s + '/' + _this_year.to_s + '-' + _this_month.to_s
|
|
362
|
+
_my_limiters.push({:Id => 'DT1', :Values => [_range]})
|
|
363
|
+
end
|
|
364
|
+
if item == 'Last 50 years'
|
|
365
|
+
_range = (_this_year-50).to_s + '-' + _this_month.to_s + '/' + _this_year.to_s + '-' + _this_month.to_s
|
|
366
|
+
_my_limiters.push({:Id => 'DT1', :Values => [_range]})
|
|
367
|
+
end
|
|
368
|
+
if item == 'More than 50 years ago'
|
|
369
|
+
_range = '0000-01/' + (_this_year-50).to_s + '-12'
|
|
370
|
+
_my_limiters.push({:Id => 'DT1', :Values => [_range]})
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# SourceType
|
|
376
|
+
if value.has_key?('eds_publication_type_facet')
|
|
377
|
+
f_list = value['eds_publication_type_facet']
|
|
378
|
+
f_list.each do |item|
|
|
379
|
+
item = eds_sanitize item
|
|
380
|
+
_my_filters['FacetValues'].push({'Id' => 'SourceType', 'Value' => item})
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
# Language
|
|
384
|
+
if value.has_key?('eds_language_facet')
|
|
385
|
+
lang_list = value['eds_language_facet']
|
|
386
|
+
lang_list.each do |item|
|
|
387
|
+
item = eds_sanitize item
|
|
388
|
+
_my_filters['FacetValues'].push({'Id' => 'Language', 'Value' => item})
|
|
389
|
+
end
|
|
390
|
+
end
|
|
391
|
+
# SubjectEDS
|
|
392
|
+
if value.has_key?('eds_subject_topic_facet')
|
|
393
|
+
subj_list = value['eds_subject_topic_facet']
|
|
394
|
+
subj_list.each do |item|
|
|
395
|
+
item = eds_sanitize item
|
|
396
|
+
_my_filters['FacetValues'].push({'Id' => 'SubjectEDS', 'Value' => item})
|
|
397
|
+
end
|
|
398
|
+
end
|
|
399
|
+
# SubjectGeographic
|
|
400
|
+
if value.has_key?('eds_subjects_geographic_facet')
|
|
401
|
+
subj_list = value['eds_subjects_geographic_facet']
|
|
402
|
+
subj_list.each do |item|
|
|
403
|
+
item = eds_sanitize item
|
|
404
|
+
_my_filters['FacetValues'].push({'Id' => 'SubjectGeographic', 'Value' => item})
|
|
405
|
+
end
|
|
406
|
+
end
|
|
407
|
+
# Publisher
|
|
408
|
+
if value.has_key?('eds_publisher_facet')
|
|
409
|
+
subj_list = value['eds_publisher_facet']
|
|
410
|
+
subj_list.each do |item|
|
|
411
|
+
item = eds_sanitize item
|
|
412
|
+
_my_filters['FacetValues'].push({'Id' => 'Publisher', 'Value' => item})
|
|
413
|
+
end
|
|
414
|
+
end
|
|
415
|
+
# Journal
|
|
416
|
+
if value.has_key?('eds_journal_facet')
|
|
417
|
+
subj_list = value['eds_journal_facet']
|
|
418
|
+
subj_list.each do |item|
|
|
419
|
+
item = eds_sanitize item
|
|
420
|
+
_my_filters['FacetValues'].push({'Id' => 'Journal', 'Value' => item})
|
|
421
|
+
end
|
|
422
|
+
end
|
|
423
|
+
# Category
|
|
424
|
+
if value.has_key?('eds_category_facet')
|
|
425
|
+
subj_list = value['eds_category_facet']
|
|
426
|
+
subj_list.each do |item|
|
|
427
|
+
item = eds_sanitize item
|
|
428
|
+
_my_filters['FacetValues'].push({'Id' => 'Category', 'Value' => item})
|
|
429
|
+
end
|
|
430
|
+
end
|
|
431
|
+
# ContentProvider
|
|
432
|
+
if value.has_key?('eds_content_provider_facet')
|
|
433
|
+
subj_list = value['eds_content_provider_facet']
|
|
434
|
+
subj_list.each do |item|
|
|
435
|
+
item = eds_sanitize item
|
|
436
|
+
_my_filters['FacetValues'].push({'Id' => 'ContentProvider', 'Value' => item})
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
# LocationLibrary
|
|
440
|
+
if value.has_key?('eds_library_location_facet')
|
|
441
|
+
subj_list = value['eds_library_location_facet']
|
|
442
|
+
subj_list.each do |item|
|
|
443
|
+
item = eds_sanitize item
|
|
444
|
+
_my_filters['FacetValues'].push({'Id' => 'LocationLibrary', 'Value' => item})
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
# CollectionLibrary
|
|
448
|
+
if value.has_key?('eds_library_collection_facet')
|
|
449
|
+
subj_list = value['eds_library_collection_facet']
|
|
450
|
+
subj_list.each do |item|
|
|
451
|
+
item = eds_sanitize item
|
|
452
|
+
_my_filters['FacetValues'].push({'Id' => 'CollectionLibrary', 'Value' => item})
|
|
453
|
+
end
|
|
454
|
+
end
|
|
455
|
+
# AuthorUniversity
|
|
456
|
+
if value.has_key?('eds_author_university_facet')
|
|
457
|
+
subj_list = value['eds_author_university_facet']
|
|
458
|
+
subj_list.each do |item|
|
|
459
|
+
item = eds_sanitize item
|
|
460
|
+
_my_filters['FacetValues'].push({'Id' => 'AuthorUniversity', 'Value' => item})
|
|
461
|
+
end
|
|
462
|
+
end
|
|
463
|
+
# PublicationYear
|
|
464
|
+
if value.has_key?('eds_publication_year_facet')
|
|
465
|
+
year_list = value['eds_publication_year_facet']
|
|
466
|
+
year_list.each do |item|
|
|
467
|
+
_my_filters['FacetValues'].push({'Id' => 'PublicationYear', 'Value' => item})
|
|
468
|
+
end
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
|
|
466
472
|
# ====================================================================================
|
|
467
473
|
# limiters
|
|
468
474
|
# ====================================================================================
|
|
475
|
+
|
|
469
476
|
when :limiters
|
|
470
477
|
value.each do |item|
|
|
471
478
|
_key = item.split(':',2).first.upcase
|
|
@@ -520,9 +527,24 @@ module EBSCO
|
|
|
520
527
|
|
|
521
528
|
end
|
|
522
529
|
|
|
530
|
+
end # end options parsing
|
|
531
|
+
|
|
532
|
+
# set solr facet filters, if any
|
|
533
|
+
if _my_filters['FacetValues'].length > 0
|
|
534
|
+
@FacetFilters = [_my_filters]
|
|
523
535
|
end
|
|
524
536
|
|
|
537
|
+
# set solr limiters, if any
|
|
538
|
+
@Limiters = _my_limiters
|
|
539
|
+
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
def eds_sanitize(str)
|
|
543
|
+
pattern = /([)(:,])/
|
|
544
|
+
str = str.gsub(pattern){ |match| '\\' + match }
|
|
545
|
+
str
|
|
525
546
|
end
|
|
547
|
+
|
|
526
548
|
end
|
|
527
549
|
|
|
528
550
|
class RetrievalCriteria
|
data/lib/ebsco/eds/record.rb
CHANGED
|
@@ -770,6 +770,67 @@ module EBSCO
|
|
|
770
770
|
end
|
|
771
771
|
end
|
|
772
772
|
|
|
773
|
+
def get_item_data(options)
|
|
774
|
+
|
|
775
|
+
if @items.empty?
|
|
776
|
+
nil
|
|
777
|
+
else
|
|
778
|
+
|
|
779
|
+
if options[:name] and options[:label] and options[:group]
|
|
780
|
+
|
|
781
|
+
@items.each do |item|
|
|
782
|
+
if item['Name'] == options[:name] && item['Label'] == options[:label] && item['Group'] == options[:group]
|
|
783
|
+
return sanitize_data(item['Data'])
|
|
784
|
+
end
|
|
785
|
+
end
|
|
786
|
+
|
|
787
|
+
elsif options[:name] and options[:label]
|
|
788
|
+
|
|
789
|
+
@items.each do |item|
|
|
790
|
+
if item['Name'] == options[:name] && item['Label'] == options[:label]
|
|
791
|
+
return sanitize_data(item['Data'])
|
|
792
|
+
end
|
|
793
|
+
end
|
|
794
|
+
|
|
795
|
+
elsif options[:name] and options[:group]
|
|
796
|
+
|
|
797
|
+
@items.each do |item|
|
|
798
|
+
if item['Name'] == options[:name] && item['Group'] == options[:group]
|
|
799
|
+
return sanitize_data(item['Data'])
|
|
800
|
+
end
|
|
801
|
+
end
|
|
802
|
+
|
|
803
|
+
elsif options[:label] and options[:group]
|
|
804
|
+
|
|
805
|
+
@items.each do |item|
|
|
806
|
+
if item['Label'] == options[:label] && item['Group'] == options[:group]
|
|
807
|
+
return sanitize_data(item['Data'])
|
|
808
|
+
end
|
|
809
|
+
end
|
|
810
|
+
|
|
811
|
+
elsif options[:label]
|
|
812
|
+
|
|
813
|
+
@items.each do |item|
|
|
814
|
+
if item['Label'] == options[:label]
|
|
815
|
+
return sanitize_data(item['Data'])
|
|
816
|
+
end
|
|
817
|
+
end
|
|
818
|
+
|
|
819
|
+
elsif options[:name]
|
|
820
|
+
|
|
821
|
+
@items.each do |item|
|
|
822
|
+
if item['Name'] == options[:name]
|
|
823
|
+
return sanitize_data(item['Data'])
|
|
824
|
+
end
|
|
825
|
+
end
|
|
826
|
+
|
|
827
|
+
else
|
|
828
|
+
nil
|
|
829
|
+
end
|
|
830
|
+
|
|
831
|
+
end
|
|
832
|
+
end
|
|
833
|
+
|
|
773
834
|
# sanitize html, allow custom links
|
|
774
835
|
def sanitize_data(data)
|
|
775
836
|
html = CGI.unescapeHTML(data.to_s)
|
data/lib/ebsco/eds/session.rb
CHANGED
|
@@ -106,6 +106,7 @@ module EBSCO
|
|
|
106
106
|
@auth_type = (ENV.has_key? 'EDS_AUTH') ? ENV['EDS_AUTH'] : @config[:auth]
|
|
107
107
|
@org = (ENV.has_key? 'EDS_ORG') ? ENV['EDS_ORG'] : @config[:org]
|
|
108
108
|
@cache_dir = (ENV.has_key? 'EDS_CACHE_DIR') ? ENV['EDS_CACHE_DIR'] : @config[:eds_cache_dir]
|
|
109
|
+
@log_level = (ENV.has_key? 'EDS_LOG_LEVEL') ? ENV['EDS_LOG_LEVEL'] : @config[:log_level]
|
|
109
110
|
|
|
110
111
|
(ENV.has_key? 'EDS_GUEST') ?
|
|
111
112
|
if %w(n N no No false False).include?(ENV['EDS_GUEST'])
|
|
@@ -230,9 +231,10 @@ module EBSCO
|
|
|
230
231
|
# create temp format facet results if needed
|
|
231
232
|
if options['f']
|
|
232
233
|
if options['f'].key?('eds_publication_type_facet')
|
|
233
|
-
format_options = options
|
|
234
|
+
format_options = options.dup
|
|
234
235
|
format_options['f'] = options['f'].except('eds_publication_type_facet')
|
|
235
236
|
format_search_options = EBSCO::EDS::Options.new(format_options, @info)
|
|
237
|
+
format_search_options.Comment = 'temp source type facets'
|
|
236
238
|
_format_response = do_request(:post, path: '/edsapi/rest/Search', payload: format_search_options)
|
|
237
239
|
@search_results.temp_format_facet_results = EBSCO::EDS::Results.new(_format_response, @info.available_limiters, format_options)
|
|
238
240
|
end
|
|
@@ -241,9 +243,10 @@ module EBSCO
|
|
|
241
243
|
# create temp content provider facet results if needed
|
|
242
244
|
if options['f']
|
|
243
245
|
if options['f'].key?('eds_content_provider_facet')
|
|
244
|
-
content_options = options
|
|
246
|
+
content_options = options.dup
|
|
245
247
|
content_options['f'] = options['f'].except('eds_content_provider_facet')
|
|
246
248
|
content_search_options = EBSCO::EDS::Options.new(content_options, @info)
|
|
249
|
+
content_search_options.Comment = 'temp content provider facet'
|
|
247
250
|
_content_response = do_request(:post, path: '/edsapi/rest/Search', payload: content_search_options)
|
|
248
251
|
@search_results.temp_content_provider_facet_results = EBSCO::EDS::Results.new(_content_response, @info.available_limiters, content_options)
|
|
249
252
|
end
|
|
@@ -928,7 +931,7 @@ module EBSCO
|
|
|
928
931
|
|
|
929
932
|
def connection
|
|
930
933
|
logger = Logger.new(@config[:log])
|
|
931
|
-
logger.level = Logger.const_get(@
|
|
934
|
+
logger.level = Logger.const_get(@log_level)
|
|
932
935
|
Faraday.new(url: 'https://' + @api_hosts_list[@api_host_index]) do |conn|
|
|
933
936
|
conn.headers['Content-Type'] = 'application/json;charset=UTF-8'
|
|
934
937
|
conn.headers['Accept'] = 'application/json'
|
|
@@ -949,7 +952,7 @@ module EBSCO
|
|
|
949
952
|
# same as above but no caching
|
|
950
953
|
def jump_connection
|
|
951
954
|
logger = Logger.new(@config[:log])
|
|
952
|
-
logger.level = Logger.const_get(@
|
|
955
|
+
logger.level = Logger.const_get(@log_level)
|
|
953
956
|
Faraday.new(url: 'https://' + @api_hosts_list[@api_host_index]) do |conn|
|
|
954
957
|
conn.headers['Content-Type'] = 'application/json;charset=UTF-8'
|
|
955
958
|
conn.headers['Accept'] = 'application/json'
|
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.12.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-09-
|
|
12
|
+
date: 2017-09-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: faraday
|
|
@@ -230,6 +230,9 @@ dependencies:
|
|
|
230
230
|
requirement: !ruby/object:Gem::Requirement
|
|
231
231
|
requirements:
|
|
232
232
|
- - "~>"
|
|
233
|
+
- !ruby/object:Gem::Version
|
|
234
|
+
version: '4.5'
|
|
235
|
+
- - ">="
|
|
233
236
|
- !ruby/object:Gem::Version
|
|
234
237
|
version: 4.5.0
|
|
235
238
|
type: :runtime
|
|
@@ -237,6 +240,9 @@ dependencies:
|
|
|
237
240
|
version_requirements: !ruby/object:Gem::Requirement
|
|
238
241
|
requirements:
|
|
239
242
|
- - "~>"
|
|
243
|
+
- !ruby/object:Gem::Version
|
|
244
|
+
version: '4.5'
|
|
245
|
+
- - ">="
|
|
240
246
|
- !ruby/object:Gem::Version
|
|
241
247
|
version: 4.5.0
|
|
242
248
|
- !ruby/object:Gem::Dependency
|