ebsco-eds 0.1.5.pre → 0.1.6.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: ec63c449b1c3d1612d06c0a0a73bd90432874f73
4
- data.tar.gz: 87603246bc6eb5626573ec2fb379226b499833ba
3
+ metadata.gz: 7b3dbb922292492bd576647444871ee036ab22f3
4
+ data.tar.gz: d3dd7ec0dfa262a0c0d57322c3f613c1ba88e9de
5
5
  SHA512:
6
- metadata.gz: 11986f47c3b40fb28fa8b8f48b3c425673806dd29aa403c3fdad859f4b6c65b82fb4ff77034160e9528b487751887f3380345b74b74e57915af25a412c52bf77
7
- data.tar.gz: 1cf9dd0fe39e19cef7d59c7cd1a90f3e8ccfff3a08594429b542f97ce2ef2945c63c3f43b0436e05c84aadbf609f8e0ef9eae639cff20b3f41cf8c9b63177bde
6
+ metadata.gz: 4a3aaa3574121dc01e2f17b4ad9bf21bbdc153eb4de4f806a34e047efc712172634a7a2f69588c509f88e85db49cc556800026f22334c627affeb200ebd32661
7
+ data.tar.gz: f6df3932a249f65bfbc8b94a25eebd97eed5b5ab9bf1d0b575659d8b9126976ce0cbf2043dde2ab4a413da7099bea0cca1d8af5d649d1699c6549aa01e50ad87
@@ -1,8 +1,5 @@
1
1
  require 'yaml'
2
2
  require 'json'
3
- require 'citeproc'
4
- require 'csl/styles'
5
- require 'bibtex'
6
3
  require 'cgi'
7
4
 
8
5
  module EBSCO
@@ -12,8 +9,64 @@ module EBSCO
12
9
  # A single search result
13
10
  class Record
14
11
 
12
+ ATTRIBUTES = [
13
+ :id,
14
+ :eds_accession_number,
15
+ :eds_database_id,
16
+ :eds_database_name,
17
+ :eds_access_level,
18
+ :eds_relevancy_score,
19
+ :eds_title,
20
+ :eds_source_title,
21
+ :eds_other_titles,
22
+ :eds_abstract,
23
+ :eds_authors,
24
+ :eds_author_affiliations,
25
+ :eds_subjects,
26
+ :eds_subjects_geographic,
27
+ :eds_subjects_person,
28
+ :eds_author_supplied_keywords,
29
+ :eds_notes,
30
+ :eds_languages,
31
+ :eds_page_count,
32
+ :eds_page_start,
33
+ :eds_physical_description,
34
+ :eds_publication_type,
35
+ :eds_publication_type_id,
36
+ :eds_publication_date,
37
+ :eds_publication_year,
38
+ :eds_publication_info,
39
+ :eds_document_type,
40
+ :eds_document_doi,
41
+ :eds_document_oclc,
42
+ :eds_issn_print,
43
+ :eds_issns,
44
+ :eds_isbn_print,
45
+ :eds_isbn_electronic,
46
+ :eds_isbns_related,
47
+ :eds_isbns,
48
+ :eds_series,
49
+ :eds_volume,
50
+ :eds_issue,
51
+ :eds_covers,
52
+ :eds_cover_thumb_url,
53
+ :eds_cover_medium_url,
54
+ :eds_fulltext_word_count,
55
+ :eds_result_id,
56
+ :eds_plink,
57
+ :eds_html_fulltext,
58
+ :eds_images,
59
+ :eds_all_links,
60
+ :eds_fulltext_links,
61
+ :eds_non_fulltext_links
62
+ ]
63
+
15
64
  # Raw record as returned by the \EDS API via search or retrieve
16
- attr_reader :record
65
+ attr_accessor(*ATTRIBUTES)
66
+
67
+ def attributes
68
+ ATTRIBUTES.map{|attribute| self.send(attribute) }
69
+ end
17
70
 
18
71
  # Creates a search or retrieval result record
19
72
  def initialize(results_record)
@@ -26,22 +79,74 @@ module EBSCO
26
79
 
27
80
  @items = @record.fetch('Items', {})
28
81
 
29
- @bib_entity = @record.fetch('RecordInfo', {})
30
- .fetch('BibRecord', {})
31
- .fetch('BibEntity', {})
82
+ @bib_entity = @record.fetch('RecordInfo', {}).fetch('BibRecord', {}).fetch('BibEntity', {})
32
83
 
33
- @bib_relationships = @record.fetch('RecordInfo', {})
34
- .fetch('BibRecord', {})
35
- .fetch('BibRelationships', {})
84
+ @bib_relationships = @record.fetch('RecordInfo', {}).fetch('BibRecord', {}).fetch('BibRelationships', {})
36
85
 
37
86
  @bib_part = @record.fetch('RecordInfo', {})
38
87
  .fetch('BibRecord', {})
39
88
  .fetch('BibRelationships', {})
40
89
  .fetch('IsPartOfRelationships', {})[0]
41
90
 
42
- @bibtex = BibTeX::Entry.new
91
+ # accessors:
92
+ @eds_accession_number = @record['Header']['An'].to_s
93
+ @eds_database_id = @record['Header']['DbId'].to_s
94
+ @eds_database_name = @record['Header']['DbLabel']
95
+ @eds_access_level = @record['Header']['AccessLevel']
96
+ @eds_relevancy_score = @record['Header']['RelevancyScore']
97
+ @eds_title = title
98
+ @eds_source_title = source_title
99
+ @eds_other_titles = other_titles
100
+ @eds_abstract = abstract
101
+ @eds_authors = bib_authors || get_item_data_by_name('Author')
102
+ @eds_author_affiliations = get_item_data_by_name('AffiliationAuthor')
103
+ @eds_subjects = bib_subjects || get_item_data_by_name('Subject')
104
+ @eds_subjects_geographic = get_item_data_by_name('SubjectGeographic')
105
+ @eds_subjects_person = get_item_data_by_name('SubjectPerson')
106
+ @eds_author_supplied_keywords = get_item_data_by_label('Author-Supplied Keywords')
107
+ @eds_notes = notes
108
+ @eds_languages = get_item_data_by_name('Language') || bib_languages
109
+ @eds_page_count = bib_page_count
110
+ @eds_page_start = bib_page_start
111
+ @eds_physical_description = get_item_data_by_name('PhysDesc')
112
+ @eds_publication_type = @record['Header']['PubType'] || get_item_data_by_name('TypePub')
113
+ @eds_publication_type_id = @record['Header']['PubTypeId']
114
+ @eds_publication_date = bib_publication_date || get_item_data_by_name('DatePub')
115
+ @eds_publication_year = bib_publication_year || get_item_data_by_name('DatePub')
116
+ @eds_publisher_info = get_item_data_by_label('Publication Information')
117
+ @eds_document_type = get_item_data_by_name('TypeDocument')
118
+ @eds_document_doi = get_item_data_by_name('DOI') || bib_doi
119
+ @eds_document_oclc = get_item_data_by_label('OCLC')
120
+ @eds_issn_print = get_item_data_by_name('ISSN') || bib_issn_print
121
+ @eds_issns = bib_issns
122
+ @eds_isbn_print = bib_isbn_print
123
+ @eds_isbns_related = item_related_isbns
124
+ @eds_isbn_electronic = bib_isbn_electronic
125
+ @eds_isbns = bib_isbns || item_related_isbns
126
+ @eds_series = get_item_data_by_name('SeriesInfo')
127
+ @eds_volume = bib_volume
128
+ @eds_issue = bib_issue
129
+ @eds_covers = images
130
+ @eds_cover_thumb_url = cover_thumb_url
131
+ @eds_cover_medium_url = cover_medium_url
132
+ @eds_fulltext_word_count = get_item_data_by_name('FullTextWordCount').to_i
133
+ @eds_result_id = @record['ResultId']
134
+ @eds_plink = @record['PLink']
135
+ @eds_html_fulltext = html_fulltext
136
+ @eds_images = images
137
+ @eds_all_links = all_links
138
+ @eds_fulltext_links = fulltext_links
139
+ @eds_non_fulltext_links = non_fulltext_links
140
+ @id = @eds_database_id + '__' + @eds_accession_number.gsub(/\./,'_')
141
+
43
142
  end
44
143
 
144
+ # --
145
+ # ====================================================================================
146
+ # MISC HELPERS
147
+ # ====================================================================================
148
+ # ++
149
+
45
150
  # \Options hash containing accession number and database ID. This can be passed to the retrieve method.
46
151
  def retrieve_options
47
152
  options = {}
@@ -50,31 +155,6 @@ module EBSCO
50
155
  options
51
156
  end
52
157
 
53
- # The accession number.
54
- def accession_number
55
- header_an
56
- end
57
-
58
- # The database ID.
59
- def database_id
60
- header_db_id
61
- end
62
-
63
- # The database name or label.
64
- def database_name
65
- header_db_label
66
- end
67
-
68
- # The access level.
69
- def access_level
70
- header_access_level
71
- end
72
-
73
- # The search relevancy score.
74
- def relevancy_score
75
- header_score
76
- end
77
-
78
158
  # The title.
79
159
  def title
80
160
  # _retval = get_item_data_by_name('Title') || bib_title
@@ -105,147 +185,12 @@ module EBSCO
105
185
  _retval.nil?? nil : CGI.unescapeHTML(_retval)
106
186
  end
107
187
 
108
- # The list of authors
109
- def authors
110
- bib_authors || get_item_data_by_name('Author')
111
- end
112
-
113
- # The author affiliations
114
- def author_affiliations
115
- get_item_data_by_name('AffiliationAuthor')
116
- end
117
-
118
- # The list of subject terms.
119
- def subjects
120
- bib_subjects || get_item_data_by_name('Subject')
121
- end
122
-
123
- # The list of geographic subjects
124
- def subjects_geographic
125
- get_item_data_by_name('SubjectGeographic')
126
- end
127
-
128
- # The list of person subjects
129
- def subjects_person
130
- get_item_data_by_name('SubjectPerson')
131
- end
132
-
133
- # Author supplied keywords
134
- def author_supplied_keywords
135
- get_item_data_by_label('Author-Supplied Keywords')
136
- end
137
-
138
188
  # Notes
139
189
  def notes
140
190
  _retval = get_item_data_by_name('Note')
141
191
  _retval.nil?? nil : CGI.unescapeHTML(_retval)
142
192
  end
143
193
 
144
- # Languages
145
- def languages
146
- get_item_data_by_name('Language') || bib_languages
147
- end
148
-
149
- # Total number of pages.
150
- def page_count
151
- bib_page_count
152
- end
153
-
154
- # Starting page number.
155
- def page_start
156
- bib_page_start
157
- end
158
-
159
- # Physical description.
160
- def physical_description
161
- get_item_data_by_name('PhysDesc')
162
- end
163
-
164
- # Publication type.
165
- def publication_type
166
- header_publication_type || get_item_data_by_name('TypePub')
167
- end
168
-
169
- # Publication type ID.
170
- def publication_type_id
171
- header_publication_type_id
172
- end
173
-
174
- # Publication date.
175
- def publication_date
176
- bib_publication_date || get_item_data_by_name('DatePub')
177
- end
178
-
179
- # Publication year.
180
- def publication_year
181
- bib_publication_year || get_item_data_by_name('DatePub')
182
- end
183
-
184
- # Publisher information.
185
- def publisher_info
186
- get_item_data_by_label('Publication Information')
187
- end
188
-
189
- # Document type.
190
- def document_type
191
- get_item_data_by_name('TypeDocument')
192
- end
193
-
194
- # DOI identifier.
195
- def doi
196
- get_item_data_by_name('DOI') || bib_doi
197
- end
198
-
199
- # OCLC identifier.
200
- def oclc
201
- get_item_data_by_label('OCLC')
202
- end
203
-
204
- # Prind ISSN
205
- def issn_print
206
- get_item_data_by_name('ISSN') || bib_issn_print
207
- end
208
-
209
- # List of ISSNs
210
- def issns
211
- bib_issns
212
- end
213
-
214
- # List of ISBNs
215
- def isbns
216
- bib_isbns || item_related_isbns
217
- end
218
-
219
- # Print ISBN
220
- def isbn_print
221
- bib_isbn_print
222
- end
223
-
224
- # Electronic ISBN
225
- def isbn_electronic
226
- bib_isbn_electronic
227
- end
228
-
229
- # Series information.
230
- def series
231
- get_item_data_by_name('SeriesInfo')
232
- end
233
-
234
- # Volume
235
- def volume
236
- bib_volume
237
- end
238
-
239
- # Issue
240
- def issue
241
- bib_issue
242
- end
243
-
244
- # Cover images
245
- def covers
246
- images
247
- end
248
-
249
194
  # Cover image - thumbnail size link
250
195
  def cover_thumb_url
251
196
  if images('thumb').any?
@@ -264,27 +209,6 @@ module EBSCO
264
209
  end
265
210
  end
266
211
 
267
- # Word count for fulltext.
268
- def fulltext_word_count
269
- get_item_data_by_name('FullTextWordCount').to_i
270
- end
271
-
272
- # --
273
- # ====================================================================================
274
- # GENERAL: ResultId, PLink, ImageInfo, CustomLinks, FullText
275
- # ====================================================================================
276
- # ++
277
-
278
- # Result ID.
279
- def result_id
280
- @record['ResultId']
281
- end
282
-
283
- # EBSCO's persistent link.
284
- def plink
285
- @record['PLink']
286
- end
287
-
288
212
  # Fulltext.
289
213
  def html_fulltext
290
214
  if @record.fetch('FullText',{}).fetch('Text',{}).fetch('Availability',0) == '1'
@@ -308,6 +232,16 @@ module EBSCO
308
232
  returned_images
309
233
  end
310
234
 
235
+ # related ISBNs
236
+ def item_related_isbns
237
+ isbns = get_item_data_by_label('Related ISBNs')
238
+ if isbns
239
+ isbns.split(' ').map!{|item| item.gsub(/\.$/, '')}
240
+ else
241
+ nil
242
+ end
243
+ end
244
+
311
245
  # --
312
246
  # ====================================================================================
313
247
  # LINK HELPERS
@@ -443,45 +377,8 @@ module EBSCO
443
377
  links
444
378
  end
445
379
 
446
- #:nodoc: all
447
- # No need to document methods below
448
-
449
- # ====================================================================================
450
- # HEADER: DbId, DbLabel, An, PubType, PubTypeId, AccessLevel
451
- # ====================================================================================
452
-
453
- def header_an
454
- @record['Header']['An'].to_s
455
- end
456
-
457
- def header_db_id
458
- @record['Header']['DbId'].to_s
459
- end
460
-
461
- # only available from search not retrieve
462
- def header_score
463
- @record['Header']['RelevancyScore']
464
- end
465
-
466
- def header_publication_type
467
- @record['Header']['PubType']
468
- end
469
-
470
- def header_publication_type_id
471
- @record['Header']['PubTypeId']
472
- end
473
-
474
- def header_db_label
475
- @record['Header']['DbLabel']
476
- end
477
-
478
- # not sure the rules for when this appears or not - RecordInfo.AccessInfo?
479
- def header_access_level
480
- @record['Header']['AccessLevel']
481
- end
482
-
483
380
  # ====================================================================================
484
- # ITEMS
381
+ # ITEM DATA HELPERS
485
382
  # ====================================================================================
486
383
 
487
384
  # look up by 'Name' and return 'Data'
@@ -512,22 +409,18 @@ module EBSCO
512
409
  end
513
410
  end
514
411
 
515
- def item_related_isbns
516
- isbns = get_item_data_by_label('Related ISBNs')
517
- if isbns
518
- isbns.split(' ').map!{|item| item.gsub(/\.$/, '')}
519
- else
520
- nil
521
- end
522
- end
523
-
524
412
  # ====================================================================================
525
413
  # BIB ENTITY
526
414
  # ====================================================================================
527
415
 
528
416
  def bib_title
529
417
  if @bib_entity && @bib_entity.fetch('Titles', {}).any?
530
- @bib_entity.fetch('Titles', {}).find{|item| item['Type'] == 'main'}['TitleFull']
418
+ item_bib_title = @bib_entity.fetch('Titles', {}).find{|item| item['Type'] == 'main'}
419
+ if item_bib_title
420
+ item_bib_title['TitleFull']
421
+ else
422
+ nil
423
+ end
531
424
  else
532
425
  nil
533
426
  end
@@ -587,7 +480,12 @@ module EBSCO
587
480
 
588
481
  def bib_doi
589
482
  if @bib_entity && @bib_entity.fetch('Identifiers',{}).any?
590
- @bib_entity.fetch('Identifiers',{}).find{|item| item['Type'] == 'doi'}['Value']
483
+ item_doi = @bib_entity.fetch('Identifiers',{}).find{|item| item['Type'] == 'doi'}
484
+ if item_doi
485
+ item_doi['Value']
486
+ else
487
+ nil
488
+ end
591
489
  else
592
490
  nil
593
491
  end
@@ -756,164 +654,92 @@ module EBSCO
756
654
  end
757
655
  end
758
656
 
759
-
760
- # Experimental bibtex support.
761
- def retrieve_bibtex
762
-
763
- @bibtex.key = accession_number
764
- @bibtex.title = title.gsub('<highlight>', '').gsub('</highlight>', '')
765
- if bib_authors_list.length > 0
766
- @bibtex.author = bib_authors_list.join(' and ').chomp
767
- end
768
- @bibtex.year = publication_year.to_i
769
-
770
- # bibtex type
771
- _type = publication_type
772
- case _type
773
- when 'Academic Journal', 'Reference'
774
- @bibtex.type = :article
775
- @bibtex.journal = source_title
776
- unless issue.nil?
777
- @bibtex.issue = issue
778
- end
779
- unless volume.nil?
780
- @bibtex.number = volume
781
- end
782
- if page_start && page_count
783
- @bibtex.pages = page_start + '-' + (page_start.to_i + page_count.to_i-1).to_s
784
- end
785
- if bib_publication_month
786
- @bibtex.month = bib_publication_month.to_i
787
- end
788
- if doi
789
- @bibtex.doi = doi
790
- @bibtex.url = 'https://doi.org/' + doi
791
- end
792
- when 'Conference'
793
- @bibtex.type = :conference
794
- @bibtex.booktitle = source_title
795
- if issue
796
- @bibtex.issue = issue
797
- end
798
- if volume
799
- @bibtex.number = volume
800
- end
801
- if page_start && page_count
802
- @bibtex.pages = page_start + '-' + (page_start.to_i + page_count.to_i-1).to_s
803
- end
804
- if bib_publication_month
805
- @bibtex.month = bib_publication_month.to_i
806
- end
807
- if publisher_info
808
- @bibtex.publisher = publisher_info
809
- end
810
- if series
811
- @bibtex.series = series
812
- end
813
- when 'Book', 'eBook'
814
- @bibtex.type = :book
815
- if publisher_info
816
- @bibtex.publisher = publisher_info
817
- end
818
- if series
819
- @bibtex.series = series
820
- end
821
- if bib_publication_month
822
- @bibtex.month = bib_publication_month.to_i
823
- end
824
- if isbns
825
- @bibtex.isbn = isbns.first
826
- end
827
- else
828
- @bibtex.type = :other
829
- end
830
- @bibtex
831
- end
832
-
833
- ##
834
- # wrap bibtex entry in a bibliography so that it can be transformed into citations using citeproc
835
- def bibtex_bibliography
836
- bib = BibTeX::Bibliography.new
837
- bib << @bibtex
838
- bib
839
- end
840
-
841
- # this is used to generate solr fields
842
- def to_hash(type = 'compact')
843
- hash = {}
844
-
845
- # information typically required by all views
846
- if database_id && accession_number
847
- safe_an = accession_number.gsub(/\./,'_')
848
- hash['id'] = database_id + '__' + safe_an
849
- end
850
- unless title.nil?
851
- hash['title_display'] = title.gsub('<highlight>', '').gsub('</highlight>', '')
852
- end
853
- if source_title
854
- hash['academic_journal'] = source_title
855
- end
856
- if publication_year
857
- hash['pub_date'] = publication_year
858
- end
859
- if authors
860
- hash['author_display'] = authors.to_s
861
- end
862
- if publication_type
863
- hash['format'] = publication_type.to_s
864
- end
865
- if languages
866
- if languages.kind_of?(Array)
867
- hash['language_facet'] = languages.join(', ')
868
- else
869
- hash['language_facet'] = languages.to_s
657
+ def to_attr_hash
658
+ hash = Hash.new
659
+ instance_variables.each do |var|
660
+ if var != :@record &&
661
+ var != :@items &&
662
+ var != :@bib_entity &&
663
+ var != :@bib_part &&
664
+ var != :@bib_relationships
665
+ hash[var.to_s.sub(/^@/, '')] = instance_variable_get(var)
870
666
  end
871
667
  end
872
- if publisher_info
873
- hash['pub_info'] = publisher_info
874
- end
875
- if abstract
876
- hash['abstract'] = abstract
877
- end
878
- if cover_thumb_url
879
- hash['cover_thumb_url'] = cover_thumb_url
880
- end
881
- if cover_medium_url
882
- hash['cover_medium_url'] = cover_medium_url
883
- end
884
668
  if all_links
885
- puts 'ALL LINKS: ' + all_links.inspect
886
- hash['fulltext_link'] = { 'id' => database_id + '__' + safe_an, 'links' => all_links}
887
- end
888
- # generate bibtex entry if it hasn't been done already
889
- if @bibtex.key == 'unknown-a'
890
- @bibtex = retrieve_bibtex
891
- end
892
- unless @bibtex.has_type?(:other)
893
- hash['citation_apa'] = citation('apa').first.to_s
894
- hash['citation_mla'] = citation('modern-language-association').first.to_s
895
- hash['citation_chicago'] = citation('chicago-author-date').first.to_s
896
- end
897
-
898
- # extra information typically required by detailed item views
899
- if type == 'verbose'
900
- if all_links
901
- hash['links'] = all_links
902
- end
903
- if doi
904
- hash['doi'] = doi
905
- end
906
- if html_fulltext
907
- hash['html_fulltext'] = html_fulltext
908
- end
669
+ hash['eds_fulltext_link'] = { 'id' => @eds_database_id + '__' + @eds_accession_number.gsub(/\./,'_'),
670
+ 'links' => all_links }
909
671
  end
910
672
 
911
673
  hash
912
674
  end
913
675
 
676
+ # this is used to generate solr fields
677
+ # def to_hash(type = 'compact')
678
+ # hash = {}
679
+ #
680
+ # # information typically required by all views
681
+ # if database_id && accession_number
682
+ # safe_an = accession_number.gsub(/\./,'_')
683
+ # hash['eds_id'] = database_id + '__' + safe_an
684
+ # end
685
+ # unless title.nil?
686
+ # hash['eds_title'] = title.gsub('<highlight>', '').gsub('</highlight>', '')
687
+ # end
688
+ # if source_title
689
+ # hash['eds_source_title'] = source_title
690
+ # end
691
+ # if publication_year
692
+ # hash['eds_publication_year'] = publication_year
693
+ # end
694
+ # if authors
695
+ # hash['eds_authors'] = authors.to_s
696
+ # end
697
+ # if publication_type
698
+ # hash['eds_publication_type'] = publication_type.to_s
699
+ # end
700
+ # if languages
701
+ # if languages.kind_of?(Array)
702
+ # hash['eds_language'] = languages.join(', ')
703
+ # else
704
+ # hash['eds_language'] = languages.to_s
705
+ # end
706
+ # end
707
+ # if publisher_info
708
+ # hash['eds_publisher_info'] = publisher_info
709
+ # end
710
+ # if abstract
711
+ # hash['eds_abstract'] = abstract
712
+ # end
713
+ # if cover_thumb_url
714
+ # hash['eds_cover_thumb_url'] = cover_thumb_url
715
+ # end
716
+ # if cover_medium_url
717
+ # hash['eds_cover_medium_url'] = cover_medium_url
718
+ # end
719
+ # if all_links
720
+ # hash['eds_fulltext_link'] = { 'id' => database_id + '__' + safe_an, 'links' => all_links}
721
+ # end
722
+ #
723
+ # # extra information typically required by detailed item views
724
+ # if type == 'verbose'
725
+ # if all_links
726
+ # hash['eds_links'] = all_links
727
+ # end
728
+ # if doi
729
+ # hash['eds_doi'] = doi
730
+ # end
731
+ # if html_fulltext
732
+ # hash['eds_html_fulltext'] = html_fulltext
733
+ # end
734
+ # end
735
+ #
736
+ # hash
737
+ # end
738
+
914
739
  def to_solr
915
740
  # solr response
916
- item_hash = to_hash 'verbose'
741
+ # item_hash = to_hash 'verbose'
742
+ item_hash = to_attr_hash
917
743
  solr_response =
918
744
  {
919
745
  'responseHeader' => {
@@ -929,19 +755,6 @@ module EBSCO
929
755
  solr_response
930
756
  end
931
757
 
932
- def citation(style = 'apa')
933
- # generate bibtex entry if it hasn't been done already
934
- if @bibtex.key == 'unknown-a'
935
- @bibtex = retrieve_bibtex
936
- end
937
- # TODO: catch CSL::ParseError when style can't be found
938
- CSL::Style.root = File.join(__dir__, 'csl/styles')
939
- cp = CiteProc::Processor.new style: style, format: 'text'
940
- bib_entry = @bibtex
941
- bib_entry_id = bib_entry.to_citeproc['id']
942
- cp.import bibtex_bibliography.to_citeproc
943
- cp.render :bibliography, id: bib_entry_id
944
- end
945
758
 
946
759
  end # Class Record
947
760
  end # Module EDS
@@ -94,11 +94,11 @@ module EBSCO
94
94
 
95
95
  # todo: add solr hl.tag.pre and hl.tag.post to retrieval criteria
96
96
  if retrieval_criteria && retrieval_criteria.fetch('Highlight',{}) == 'y'
97
- hl_title = record.title.gsub('<highlight>', '<em>').gsub('</highlight>', '</em>')
98
- hl_hash.update({ record.database_id + '__' + record.accession_number => { 'title_display' => [hl_title]} })
97
+ hl_title = record.eds_title.gsub('<highlight>', '<em>').gsub('</highlight>', '</em>')
98
+ hl_hash.update({ record.eds_database_id + '__' + record.eds_accession_number => { 'title_display' => [hl_title]} })
99
99
  #hl_hash.merge title_hl
100
100
  end
101
- solr_docs.push(record.to_hash)
101
+ solr_docs.push(record.to_attr_hash)
102
102
  }
103
103
  end
104
104
 
@@ -108,17 +108,19 @@ module EBSCO
108
108
  qterms = search_terms.join(' ')
109
109
  rows = results_per_page
110
110
  num_found = stat_total_hits.to_i
111
- search_limiters = solr_search_limiters
112
- format = solr_facets('SourceType')
113
- language_facet = solr_facets('Language')
114
- subject_topic_facet = solr_facets('SubjectEDS')
115
- publisher_facet = solr_facets('Publisher')
116
- journal_facet = solr_facets('Journal')
117
- geographic_facet = solr_facets('SubjectGeographic')
118
- category_facet = solr_facets('Category')
119
- content_provider_facet = solr_facets('ContentProvider')
120
- library_location_facet = solr_facets('LocationLibrary')
121
- pub_date_facet = solr_pub_date_facets
111
+ eds_search_limiters_facet = solr_search_limiters
112
+ eds_publication_type_facet = solr_facets('SourceType')
113
+ eds_language_facet = solr_facets('Language')
114
+ eds_subject_topic_facet = solr_facets('SubjectEDS')
115
+ eds_publisher_facet = solr_facets('Publisher')
116
+ eds_journal_facet = solr_facets('Journal')
117
+ eds_subjects_geographic_facet = solr_facets('SubjectGeographic')
118
+ eds_category_facet = solr_facets('Category')
119
+ eds_content_provider_facet = solr_facets('ContentProvider')
120
+ eds_library_location_facet = solr_facets('LocationLibrary')
121
+ eds_library_collection_facet = solr_facets('CollectionLibrary')
122
+ eds_author_university_facet = solr_facets('AuthorUniversity')
123
+ eds_publication_year_facet = solr_pub_date_facets
122
124
  facet = true
123
125
 
124
126
  # solr response
@@ -144,17 +146,19 @@ module EBSCO
144
146
  'facet_counts' =>
145
147
  {
146
148
  'facet_fields' => {
147
- 'search_limiters' => search_limiters,
148
- 'format' => format,
149
- 'language_facet' => language_facet,
150
- 'subject_topic_facet' => subject_topic_facet,
151
- 'pub_date_facet' => pub_date_facet,
152
- 'publisher_facet' => publisher_facet,
153
- 'journal_facet' => journal_facet,
154
- 'geographic_facet' => geographic_facet,
155
- 'category_facet' => category_facet,
156
- 'content_provider_facet' => content_provider_facet,
157
- 'library_location_facet' => library_location_facet
149
+ 'eds_search_limiters_facet' => eds_search_limiters_facet,
150
+ 'eds_publication_type_facet' => eds_publication_type_facet,
151
+ 'eds_language_facet' => eds_language_facet,
152
+ 'eds_subject_topic_facet' => eds_subject_topic_facet,
153
+ 'eds_publication_year_facet' => eds_publication_year_facet,
154
+ 'eds_publisher_facet' => eds_publisher_facet,
155
+ 'eds_journal_facet' => eds_journal_facet,
156
+ 'eds_subjects_geographic_facet' => eds_subjects_geographic_facet,
157
+ 'eds_category_facet' => eds_category_facet,
158
+ 'eds_content_provider_facet' => eds_content_provider_facet,
159
+ 'eds_library_location_facet' => eds_library_location_facet,
160
+ 'eds_library_collection_facet' => eds_library_collection_facet,
161
+ 'eds_author_university_facet' => eds_author_university_facet
158
162
  }
159
163
  }
160
164
  }
@@ -1,5 +1,5 @@
1
1
  module EBSCO
2
2
  module EDS
3
- VERSION = '0.1.5.pre'
3
+ VERSION = '0.1.6.pre'
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require 'faraday'
2
+ require 'uri'
2
3
 
3
4
  module Faraday
4
5
 
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.1.5.pre
4
+ version: 0.1.6.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-05-01 00:00:00.000000000 Z
12
+ date: 2017-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday