ebsco-eds 0.3.3.pre → 0.3.4.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe6bbef15a6166d55f9a93c2967de4b04860df76
4
- data.tar.gz: d1de971e6bb03fdb4069dac04045f1792447d207
3
+ metadata.gz: d5892ad55aa81cd0c31eafcc91a87de4b81483dc
4
+ data.tar.gz: 7fc2bd988dd215d75e37a9cf3e33b1b9089bb936
5
5
  SHA512:
6
- metadata.gz: b081a46c390b6354f04787259b29de23562d9c62852f088f0154608b1f8cc3cd142d525413936a92e803aa58d28b60e5f73454bb98ee376961bd523b2db39160
7
- data.tar.gz: cd9387a56052d7b962c6bd97bae1dbfddcdf386ef97adb2a1284efe1ba0e8f68a786ac92556ae14bacd5ee63993dc8aea0d3586ed6b79b2f68ce081745f68038
6
+ metadata.gz: d557e0ce5b0af80aaed93bb459d1ec14cea8d8bbf94af47db09f80b7321949c5f6842ac19541e1f5f2d04034d73db693ed9e6bc2a01c1f56a041a90f72a313d5
7
+ data.tar.gz: 6090a2e9243e7996ad50206902ff17bba0b634c4fa21ef421c9fa7e9f3320a7c9619e45f9650e52fcf5053d7596b7884224c50088238fd1b2b4cd745852231ec
data/.env.test CHANGED
@@ -1,7 +1,6 @@
1
1
  EDS_PROFILE=edsapi
2
- EDS_USER=stanford
3
- EDS_PASS=trial
2
+ EDS_USER=user
3
+ EDS_PASS=secret
4
4
  EDS_AUTH=user
5
5
  EDS_GUEST=n
6
- EDS_ORG=none
7
- EDS_DEBUG=false
6
+ EDS_ORG=none
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ faraday.log
18
18
  .env
19
19
  yaml-sample-records
20
20
  *.gem
21
+ .idea
@@ -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
@@ -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
- {mindate: mindate, maxdate: maxdate, minyear:minyear, maxyear:maxyear}
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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  module EBSCO
2
2
  module EDS
3
- VERSION = '0.3.3.pre'
3
+ VERSION = '0.3.4.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.3.pre
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-17 00:00:00.000000000 Z
12
+ date: 2017-08-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday