ebsco-eds 0.3.3.pre → 0.3.4.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/.env.test +3 -4
- data/.gitignore +1 -0
- data/lib/ebsco/eds/options.rb +7 -0
- data/lib/ebsco/eds/results.rb +10 -1
- data/lib/ebsco/eds/session.rb +23 -0
- 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: d5892ad55aa81cd0c31eafcc91a87de4b81483dc
|
4
|
+
data.tar.gz: 7fc2bd988dd215d75e37a9cf3e33b1b9089bb936
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d557e0ce5b0af80aaed93bb459d1ec14cea8d8bbf94af47db09f80b7321949c5f6842ac19541e1f5f2d04034d73db693ed9e6bc2a01c1f56a041a90f72a313d5
|
7
|
+
data.tar.gz: 6090a2e9243e7996ad50206902ff17bba0b634c4fa21ef421c9fa7e9f3320a7c9619e45f9650e52fcf5053d7596b7884224c50088238fd1b2b4cd745852231ec
|
data/.env.test
CHANGED
data/.gitignore
CHANGED
data/lib/ebsco/eds/options.rb
CHANGED
@@ -64,6 +64,7 @@ module EBSCO
|
|
64
64
|
if value.has_key?('eds_publication_type_facet')
|
65
65
|
format_list = value['eds_publication_type_facet']
|
66
66
|
format_list.each do |item|
|
67
|
+
item = eds_sanitize item
|
67
68
|
@Actions.push "addfacetfilter(SourceType:#{item})"
|
68
69
|
end
|
69
70
|
end
|
@@ -71,6 +72,7 @@ module EBSCO
|
|
71
72
|
if value.has_key?('eds_language_facet')
|
72
73
|
lang_list = value['eds_language_facet']
|
73
74
|
lang_list.each do |item|
|
75
|
+
item = eds_sanitize item
|
74
76
|
@Actions.push "addfacetfilter(Language:#{item})"
|
75
77
|
end
|
76
78
|
end
|
@@ -78,6 +80,7 @@ module EBSCO
|
|
78
80
|
if value.has_key?('eds_subject_topic_facet')
|
79
81
|
subj_list = value['eds_subject_topic_facet']
|
80
82
|
subj_list.each do |item|
|
83
|
+
item = eds_sanitize item
|
81
84
|
@Actions.push "addfacetfilter(SubjectEDS:#{item})"
|
82
85
|
end
|
83
86
|
end
|
@@ -85,6 +88,7 @@ module EBSCO
|
|
85
88
|
if value.has_key?('eds_subjects_geographic_facet')
|
86
89
|
subj_list = value['eds_subjects_geographic_facet']
|
87
90
|
subj_list.each do |item|
|
91
|
+
item = eds_sanitize item
|
88
92
|
@Actions.push "addfacetfilter(SubjectGeographic:#{item})"
|
89
93
|
end
|
90
94
|
end
|
@@ -92,6 +96,7 @@ module EBSCO
|
|
92
96
|
if value.has_key?('eds_publisher_facet')
|
93
97
|
subj_list = value['eds_publisher_facet']
|
94
98
|
subj_list.each do |item|
|
99
|
+
item = eds_sanitize item
|
95
100
|
@Actions.push "addfacetfilter(Publisher:#{item})"
|
96
101
|
end
|
97
102
|
end
|
@@ -99,6 +104,7 @@ module EBSCO
|
|
99
104
|
if value.has_key?('eds_journal_facet')
|
100
105
|
subj_list = value['eds_journal_facet']
|
101
106
|
subj_list.each do |item|
|
107
|
+
item = eds_sanitize item
|
102
108
|
@Actions.push "addfacetfilter(Journal:#{item})"
|
103
109
|
end
|
104
110
|
end
|
@@ -106,6 +112,7 @@ module EBSCO
|
|
106
112
|
if value.has_key?('eds_category_facet')
|
107
113
|
subj_list = value['eds_category_facet']
|
108
114
|
subj_list.each do |item|
|
115
|
+
item = eds_sanitize item
|
109
116
|
@Actions.push "addfacetfilter(Category:#{item})"
|
110
117
|
end
|
111
118
|
end
|
data/lib/ebsco/eds/results.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'ebsco/eds/record'
|
2
2
|
require 'yaml'
|
3
3
|
require 'cgi'
|
4
|
+
require 'date'
|
4
5
|
|
5
6
|
module EBSCO
|
6
7
|
|
@@ -512,7 +513,15 @@ module EBSCO
|
|
512
513
|
maxdate = @results['SearchResult']['AvailableCriteria']['DateRange']['MaxDate']
|
513
514
|
minyear = mindate[0..3]
|
514
515
|
maxyear = maxdate[0..3]
|
515
|
-
|
516
|
+
|
517
|
+
# cap maxdate/maxyear to current year + 1 (to filter any erroneous database metadata)
|
518
|
+
current_year = Time.new.year
|
519
|
+
if maxyear.to_i > current_year
|
520
|
+
maxyear = current_year + 1
|
521
|
+
maxdate = (current_year + 1).to_s + '-01'
|
522
|
+
end
|
523
|
+
|
524
|
+
{mindate: mindate.to_s, maxdate: maxdate.to_s, minyear:minyear.to_s, maxyear:maxyear.to_s}
|
516
525
|
end
|
517
526
|
|
518
527
|
# Provides alternative search terms to correct spelling, etc.
|
data/lib/ebsco/eds/session.rb
CHANGED
@@ -696,6 +696,29 @@ module EBSCO
|
|
696
696
|
@auth_token = nil
|
697
697
|
@auth_token = create_auth_token
|
698
698
|
do_request(method, path: path, payload: payload, attempt: attempt+1)
|
699
|
+
# invalid source type, attempt to recover gracefully
|
700
|
+
# when '130'
|
701
|
+
# bad_source_type = e.fault[:error_body]['DetailedErrorDescription']
|
702
|
+
# bad_source_type.gsub!(/Value Provided\s+/, '')
|
703
|
+
# bad_source_type.gsub!(/\.\s*$/, '')
|
704
|
+
# new_actions = []
|
705
|
+
# payload.Actions.each { |action|
|
706
|
+
# if action.start_with?('addfacetfilter(SourceType:')
|
707
|
+
# if bad_source_type.nil?
|
708
|
+
# # skip the source type since we don't know if it's bad or not
|
709
|
+
# else
|
710
|
+
# if !action.include?('SourceType:'+bad_source_type+')')
|
711
|
+
# # not a bad source type, keep it
|
712
|
+
# new_actions >> action
|
713
|
+
# end
|
714
|
+
# end
|
715
|
+
# else
|
716
|
+
# # not a source type action, add it
|
717
|
+
# new_actions << action
|
718
|
+
# end
|
719
|
+
# }
|
720
|
+
# payload.Actions = new_actions
|
721
|
+
# do_request(method, path: path, payload: payload, attempt: attempt+1)
|
699
722
|
else
|
700
723
|
raise e
|
701
724
|
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.4.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-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|