briard 2.4.2 → 2.6.0

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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +72 -0
  3. data/.github/workflows/rubocop.yml +50 -0
  4. data/.rubocop.yml +144 -620
  5. data/.rubocop_todo.yml +76 -0
  6. data/CHANGELOG.md +18 -0
  7. data/Gemfile +2 -0
  8. data/Gemfile.lock +40 -6
  9. data/Rakefile +1 -1
  10. data/{bolognese.gemspec → briard.gemspec} +46 -39
  11. data/lib/briard/array.rb +2 -2
  12. data/lib/briard/author_utils.rb +79 -71
  13. data/lib/briard/cli.rb +12 -13
  14. data/lib/briard/crossref_utils.rb +73 -61
  15. data/lib/briard/datacite_utils.rb +132 -106
  16. data/lib/briard/doi_utils.rb +10 -10
  17. data/lib/briard/metadata.rb +96 -106
  18. data/lib/briard/metadata_utils.rb +87 -78
  19. data/lib/briard/readers/bibtex_reader.rb +65 -65
  20. data/lib/briard/readers/cff_reader.rb +88 -70
  21. data/lib/briard/readers/citeproc_reader.rb +90 -84
  22. data/lib/briard/readers/codemeta_reader.rb +68 -50
  23. data/lib/briard/readers/crosscite_reader.rb +2 -2
  24. data/lib/briard/readers/crossref_reader.rb +249 -210
  25. data/lib/briard/readers/datacite_json_reader.rb +3 -3
  26. data/lib/briard/readers/datacite_reader.rb +225 -189
  27. data/lib/briard/readers/npm_reader.rb +49 -42
  28. data/lib/briard/readers/ris_reader.rb +82 -80
  29. data/lib/briard/readers/schema_org_reader.rb +182 -159
  30. data/lib/briard/string.rb +1 -1
  31. data/lib/briard/utils.rb +4 -4
  32. data/lib/briard/version.rb +3 -1
  33. data/lib/briard/whitelist_scrubber.rb +11 -4
  34. data/lib/briard/writers/bibtex_writer.rb +14 -8
  35. data/lib/briard/writers/cff_writer.rb +33 -26
  36. data/lib/briard/writers/codemeta_writer.rb +19 -15
  37. data/lib/briard/writers/csv_writer.rb +6 -4
  38. data/lib/briard/writers/datacite_json_writer.rb +8 -2
  39. data/lib/briard/writers/jats_writer.rb +33 -28
  40. data/lib/briard/writers/rdf_xml_writer.rb +1 -1
  41. data/lib/briard/writers/ris_writer.rb +30 -18
  42. data/lib/briard/writers/turtle_writer.rb +1 -1
  43. data/lib/briard.rb +6 -6
  44. data/rubocop.sarif +0 -0
  45. data/spec/array_spec.rb +5 -5
  46. data/spec/author_utils_spec.rb +151 -132
  47. data/spec/datacite_utils_spec.rb +135 -83
  48. data/spec/doi_utils_spec.rb +168 -164
  49. data/spec/find_from_format_spec.rb +69 -69
  50. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/onlies_keep_specific_tags.yml +65 -0
  51. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/removes_a_tags.yml +65 -0
  52. data/spec/metadata_spec.rb +91 -90
  53. data/spec/readers/bibtex_reader_spec.rb +43 -38
  54. data/spec/readers/cff_reader_spec.rb +165 -153
  55. data/spec/readers/citeproc_reader_spec.rb +45 -40
  56. data/spec/readers/codemeta_reader_spec.rb +128 -115
  57. data/spec/readers/crosscite_reader_spec.rb +34 -24
  58. data/spec/readers/crossref_reader_spec.rb +1098 -939
  59. data/spec/readers/datacite_json_reader_spec.rb +53 -40
  60. data/spec/readers/datacite_reader_spec.rb +1541 -1337
  61. data/spec/readers/npm_reader_spec.rb +48 -43
  62. data/spec/readers/ris_reader_spec.rb +53 -47
  63. data/spec/readers/schema_org_reader_spec.rb +329 -267
  64. data/spec/spec_helper.rb +6 -5
  65. data/spec/utils_spec.rb +371 -347
  66. data/spec/writers/bibtex_writer_spec.rb +143 -143
  67. data/spec/writers/cff_writer_spec.rb +96 -90
  68. data/spec/writers/citation_writer_spec.rb +34 -33
  69. data/spec/writers/citeproc_writer_spec.rb +226 -224
  70. data/spec/writers/codemeta_writer_spec.rb +18 -16
  71. data/spec/writers/crosscite_writer_spec.rb +91 -73
  72. data/spec/writers/crossref_writer_spec.rb +99 -91
  73. data/spec/writers/csv_writer_spec.rb +70 -70
  74. data/spec/writers/datacite_json_writer_spec.rb +78 -68
  75. data/spec/writers/datacite_writer_spec.rb +417 -322
  76. data/spec/writers/jats_writer_spec.rb +177 -161
  77. data/spec/writers/rdf_xml_writer_spec.rb +68 -63
  78. data/spec/writers/ris_writer_spec.rb +162 -162
  79. data/spec/writers/turtle_writer_spec.rb +47 -47
  80. metadata +242 -166
  81. data/.github/workflows/release.yml +0 -47
@@ -3,294 +3,296 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Briard::Metadata, vcr: true do
6
- context "write metadata as citeproc" do
7
- it "Dataset" do
8
- input = "https://doi.org/10.5061/DRYAD.8515"
9
- subject = Briard::Metadata.new(input: input, from: "datacite")
6
+ context 'write metadata as citeproc' do
7
+ it 'Dataset' do
8
+ input = 'https://doi.org/10.5061/DRYAD.8515'
9
+ subject = described_class.new(input: input, from: 'datacite')
10
10
  expect(subject.valid?).to be true
11
11
  json = JSON.parse(subject.citeproc)
12
- expect(json["type"]).to eq("dataset")
13
- expect(json["id"]).to eq("https://doi.org/10.5061/dryad.8515")
14
- expect(json["DOI"]).to eq("10.5061/dryad.8515")
15
- expect(json["title"]).to eq("Data from: A new malaria agent in African hominids.")
16
- expect(json["author"]).to eq([{"family"=>"Ollomo", "given"=>"Benjamin"},
17
- {"family"=>"Durand", "given"=>"Patrick"},
18
- {"family"=>"Prugnolle", "given"=>"Franck"},
19
- {"family"=>"Douzery", "given"=>"Emmanuel J. P."},
20
- {"family"=>"Arnathau", "given"=>"Céline"},
21
- {"family"=>"Nkoghe", "given"=>"Dieudonné"},
22
- {"family"=>"Leroy", "given"=>"Eric"},
23
- {"family"=>"Renaud", "given"=>"François"}])
24
- expect(json["publisher"]).to eq("Dryad")
25
- expect(json["issued"]).to eq("date-parts" => [[2011]])
26
- expect(json["submitted"]).to be_nil
27
- expect(json["copyright"]).to eq("Creative Commons Zero v1.0 Universal")
12
+ expect(json['type']).to eq('dataset')
13
+ expect(json['id']).to eq('https://doi.org/10.5061/dryad.8515')
14
+ expect(json['DOI']).to eq('10.5061/dryad.8515')
15
+ expect(json['title']).to eq('Data from: A new malaria agent in African hominids.')
16
+ expect(json['author']).to eq([{ 'family' => 'Ollomo', 'given' => 'Benjamin' },
17
+ { 'family' => 'Durand', 'given' => 'Patrick' },
18
+ { 'family' => 'Prugnolle', 'given' => 'Franck' },
19
+ { 'family' => 'Douzery', 'given' => 'Emmanuel J. P.' },
20
+ { 'family' => 'Arnathau', 'given' => 'Céline' },
21
+ { 'family' => 'Nkoghe', 'given' => 'Dieudonné' },
22
+ { 'family' => 'Leroy', 'given' => 'Eric' },
23
+ { 'family' => 'Renaud', 'given' => 'François' }])
24
+ expect(json['publisher']).to eq('Dryad')
25
+ expect(json['issued']).to eq('date-parts' => [[2011]])
26
+ expect(json['submitted'].nil?).to be(true)
27
+ expect(json['copyright']).to eq('Creative Commons Zero v1.0 Universal')
28
28
  end
29
29
 
30
- it "BlogPosting" do
31
- input = "https://doi.org/10.5438/4K3M-NYVG"
32
- subject = Briard::Metadata.new(input: input, from: "datacite")
30
+ it 'BlogPosting' do
31
+ input = 'https://doi.org/10.5438/4K3M-NYVG'
32
+ subject = described_class.new(input: input, from: 'datacite')
33
33
  expect(subject.valid?).to be true
34
34
  json = JSON.parse(subject.citeproc)
35
- expect(json["type"]).to eq("article-journal")
36
- expect(json["id"]).to eq("https://doi.org/10.5438/4k3m-nyvg")
37
- expect(json["DOI"]).to eq("10.5438/4k3m-nyvg")
38
- expect(json["title"]).to eq("Eating your own Dog Food")
39
- expect(json["author"]).to eq([{"family"=>"Fenner", "given"=>"Martin"}])
40
- expect(json["publisher"]).to eq("DataCite")
41
- expect(json["issued"]).to eq("date-parts"=>[[2016, 12, 20]])
35
+ expect(json['type']).to eq('article-journal')
36
+ expect(json['id']).to eq('https://doi.org/10.5438/4k3m-nyvg')
37
+ expect(json['DOI']).to eq('10.5438/4k3m-nyvg')
38
+ expect(json['title']).to eq('Eating your own Dog Food')
39
+ expect(json['author']).to eq([{ 'family' => 'Fenner', 'given' => 'Martin' }])
40
+ expect(json['publisher']).to eq('DataCite')
41
+ expect(json['issued']).to eq('date-parts' => [[2016, 12, 20]])
42
42
  end
43
43
 
44
- it "BlogPosting DataCite JSON" do
45
- input = fixture_path + "datacite.json"
46
- subject = Briard::Metadata.new(input: input, from: "datacite_json")
44
+ it 'BlogPosting DataCite JSON' do
45
+ input = "#{fixture_path}datacite.json"
46
+ subject = described_class.new(input: input, from: 'datacite_json')
47
47
  json = JSON.parse(subject.citeproc)
48
- expect(json["type"]).to eq("article-journal")
49
- expect(json["id"]).to eq("https://doi.org/10.5438/4k3m-nyvg")
50
- expect(json["DOI"]).to eq("10.5438/4k3m-nyvg")
51
- expect(json["title"]).to eq("Eating your own Dog Food")
52
- expect(json["author"]).to eq([{"family"=>"Fenner", "given"=>"Martin"}])
53
- expect(json["publisher"]).to eq("DataCite")
54
- expect(json["issued"]).to eq("date-parts" => [[2016, 12, 20]])
48
+ expect(json['type']).to eq('article-journal')
49
+ expect(json['id']).to eq('https://doi.org/10.5438/4k3m-nyvg')
50
+ expect(json['DOI']).to eq('10.5438/4k3m-nyvg')
51
+ expect(json['title']).to eq('Eating your own Dog Food')
52
+ expect(json['author']).to eq([{ 'family' => 'Fenner', 'given' => 'Martin' }])
53
+ expect(json['publisher']).to eq('DataCite')
54
+ expect(json['issued']).to eq('date-parts' => [[2016, 12, 20]])
55
55
  end
56
56
 
57
- it "BlogPosting schema.org" do
58
- input = "https://blog.front-matter.io/posts/eating-your-own-dog-food/"
59
- subject = Briard::Metadata.new(input: input, from: "schema_org")
57
+ it 'BlogPosting schema.org' do
58
+ input = 'https://blog.front-matter.io/posts/eating-your-own-dog-food/'
59
+ subject = described_class.new(input: input, from: 'schema_org')
60
60
  json = JSON.parse(subject.citeproc)
61
- expect(json["type"]).to eq("article-newspaper")
62
- expect(json["id"]).to eq("https://doi.org/10.53731/r79vxn1-97aq74v-ag58n")
63
- expect(json["DOI"]).to eq("10.53731/r79vxn1-97aq74v-ag58n")
64
- expect(json["title"]).to eq("Eating your own Dog Food")
65
- expect(json["author"]).to eq([{"family"=>"Fenner", "given"=>"Martin"}])
66
- expect(json["publisher"]).to eq("Front Matter")
67
- expect(json["issued"]).to eq("date-parts" => [[2016, 12, 20]])
61
+ expect(json['type']).to eq('article-newspaper')
62
+ expect(json['id']).to eq('https://doi.org/10.53731/r79vxn1-97aq74v-ag58n')
63
+ expect(json['DOI']).to eq('10.53731/r79vxn1-97aq74v-ag58n')
64
+ expect(json['title']).to eq('Eating your own Dog Food')
65
+ expect(json['author']).to eq([{ 'family' => 'Fenner', 'given' => 'Martin' }])
66
+ expect(json['publisher']).to eq('Front Matter')
67
+ expect(json['issued']).to eq('date-parts' => [[2016, 12, 20]])
68
68
  end
69
69
 
70
- it "Another dataset" do
71
- input = "10.26301/qdpd-2250"
72
- subject = Briard::Metadata.new(input: input, from: "datacite")
70
+ it 'Another dataset' do
71
+ input = '10.26301/qdpd-2250'
72
+ subject = described_class.new(input: input, from: 'datacite')
73
73
  json = JSON.parse(subject.citeproc)
74
- expect(json["type"]).to eq("dataset")
75
- expect(json["id"]).to eq("https://doi.org/10.26301/qdpd-2250")
76
- expect(json["DOI"]).to eq("10.26301/qdpd-2250")
77
- expect(json["title"]).to eq("USS Pampanito Submarine")
78
- expect(json["author"]).to eq([{"literal"=>"USS Pampanito"},
79
- {"literal"=>"Autodesk"},
80
- {"literal"=>"Topcon"},
81
- {"literal"=>"3D Robotics"},
82
- {"literal"=>"CyArk"},
83
- {"literal"=>"San Francisco Maritime National Park Association"}])
84
- expect(json["publisher"]).to eq("OpenHeritage3D")
85
- expect(json["issued"]).to eq("date-parts"=>[[2020]])
74
+ expect(json['type']).to eq('dataset')
75
+ expect(json['id']).to eq('https://doi.org/10.26301/qdpd-2250')
76
+ expect(json['DOI']).to eq('10.26301/qdpd-2250')
77
+ expect(json['title']).to eq('USS Pampanito Submarine')
78
+ expect(json['author']).to eq([{ 'literal' => 'USS Pampanito' },
79
+ { 'literal' => 'Autodesk' },
80
+ { 'literal' => 'Topcon' },
81
+ { 'literal' => '3D Robotics' },
82
+ { 'literal' => 'CyArk' },
83
+ { 'literal' => 'San Francisco Maritime National Park Association' }])
84
+ expect(json['publisher']).to eq('OpenHeritage3D')
85
+ expect(json['issued']).to eq('date-parts' => [[2020]])
86
86
  end
87
87
 
88
- it "journal article" do
89
- input = "10.7554/eLife.01567"
90
- subject = Briard::Metadata.new(input: input, from: "crossref")
88
+ it 'journal article' do
89
+ input = '10.7554/eLife.01567'
90
+ subject = described_class.new(input: input, from: 'crossref')
91
91
  expect(subject.valid?).to be true
92
92
  json = JSON.parse(subject.citeproc)
93
- expect(json["type"]).to eq("article-journal")
94
- expect(json["id"]).to eq("https://doi.org/10.7554/elife.01567")
95
- expect(json["DOI"]).to eq("10.7554/elife.01567")
96
- expect(json["title"]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
97
- expect(json["author"]).to eq([{"family"=>"Sankar", "given"=>"Martial"},
98
- {"family"=>"Nieminen", "given"=>"Kaisa"},
99
- {"family"=>"Ragni", "given"=>"Laura"},
100
- {"family"=>"Xenarios", "given"=>"Ioannis"},
101
- {"family"=>"Hardtke", "given"=>"Christian S"}])
102
- expect(json["container-title"]).to eq("eLife")
103
- expect(json["volume"]).to eq("3")
104
- expect(json["issued"]).to eq("date-parts" => [[2014, 2, 11]])
105
- expect(json["copyright"]).to eq("Creative Commons Attribution 3.0 Unported")
93
+ expect(json['type']).to eq('article-journal')
94
+ expect(json['id']).to eq('https://doi.org/10.7554/elife.01567')
95
+ expect(json['DOI']).to eq('10.7554/elife.01567')
96
+ expect(json['title']).to eq('Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth')
97
+ expect(json['author']).to eq([{ 'family' => 'Sankar', 'given' => 'Martial' },
98
+ { 'family' => 'Nieminen', 'given' => 'Kaisa' },
99
+ { 'family' => 'Ragni', 'given' => 'Laura' },
100
+ { 'family' => 'Xenarios', 'given' => 'Ioannis' },
101
+ { 'family' => 'Hardtke', 'given' => 'Christian S' }])
102
+ expect(json['container-title']).to eq('eLife')
103
+ expect(json['volume']).to eq('3')
104
+ expect(json['issued']).to eq('date-parts' => [[2014, 2, 11]])
105
+ expect(json['copyright']).to eq('Creative Commons Attribution 3.0 Unported')
106
106
  end
107
107
 
108
- it "software" do
109
- input = "https://doi.org/10.6084/m9.figshare.4906367.v1"
110
- subject = Briard::Metadata.new(input: input, from: "datacite")
108
+ it 'software' do
109
+ input = 'https://doi.org/10.6084/m9.figshare.4906367.v1'
110
+ subject = described_class.new(input: input, from: 'datacite')
111
111
  json = JSON.parse(subject.citeproc)
112
- expect(json["type"]).to eq("article")
113
- expect(json["DOI"]).to eq("10.6084/m9.figshare.4906367.v1")
114
- expect(json["title"]).to eq("Scimag catalogue of LibGen as of January 1st, 2014")
115
- expect(json["copyright"]).to eq("Creative Commons Zero v1.0 Universal")
112
+ expect(json['type']).to eq('article')
113
+ expect(json['DOI']).to eq('10.6084/m9.figshare.4906367.v1')
114
+ expect(json['title']).to eq('Scimag catalogue of LibGen as of January 1st, 2014')
115
+ expect(json['copyright']).to eq('Creative Commons Zero v1.0 Universal')
116
116
  end
117
117
 
118
- it "software w/version" do
119
- input = "https://doi.org/10.5281/zenodo.2598836"
120
- subject = Briard::Metadata.new(input: input, from: "datacite")
118
+ it 'software w/version' do
119
+ input = 'https://doi.org/10.5281/zenodo.2598836'
120
+ subject = described_class.new(input: input, from: 'datacite')
121
121
  json = JSON.parse(subject.citeproc)
122
- expect(json["type"]).to eq("book")
123
- expect(json["DOI"]).to eq("10.5281/zenodo.2598836")
124
- expect(json["version"]).to eq("1.0.0")
125
- expect(json["copyright"]).to eq("Open Access")
122
+ expect(json['type']).to eq('book')
123
+ expect(json['DOI']).to eq('10.5281/zenodo.2598836')
124
+ expect(json['version']).to eq('1.0.0')
125
+ expect(json['copyright']).to eq('Open Access')
126
126
  end
127
127
 
128
- it "software w/version from datacite_json" do
129
- input = fixture_path + "datacite_software_version.json"
130
- subject = Briard::Metadata.new(input: input, from: "datacite_json")
128
+ it 'software w/version from datacite_json' do
129
+ input = "#{fixture_path}datacite_software_version.json"
130
+ subject = described_class.new(input: input, from: 'datacite_json')
131
131
  json = JSON.parse(subject.citeproc)
132
- expect(json["type"]).to eq("book")
133
- expect(json["DOI"]).to eq("10.5281/ZENODO.2598836")
134
- expect(json["version"]).to eq("1.0.0")
135
- expect(json["copyright"]).to eq("Open Access")
132
+ expect(json['type']).to eq('book')
133
+ expect(json['DOI']).to eq('10.5281/ZENODO.2598836')
134
+ expect(json['version']).to eq('1.0.0')
135
+ expect(json['copyright']).to eq('Open Access')
136
136
  end
137
137
 
138
- it "multiple abstracts" do
139
- input = "https://doi.org/10.12763/ona1045"
140
- subject = Briard::Metadata.new(input: input, from: "datacite")
138
+ it 'multiple abstracts' do
139
+ input = 'https://doi.org/10.12763/ona1045'
140
+ subject = described_class.new(input: input, from: 'datacite')
141
141
  json = JSON.parse(subject.citeproc)
142
- expect(json["type"]).to eq("article-journal")
143
- expect(json["DOI"]).to eq("10.12763/ona1045")
144
- expect(json["abstract"]).to eq("Le code est accompagné de commentaires de F. A. Vogel, qui signe l'épitre dédicatoire")
142
+ expect(json['type']).to eq('article-journal')
143
+ expect(json['DOI']).to eq('10.12763/ona1045')
144
+ expect(json['abstract']).to eq("Le code est accompagné de commentaires de F. A. Vogel, qui signe l'épitre dédicatoire")
145
145
  end
146
146
 
147
- it "with pages" do
148
- input = "https://doi.org/10.1155/2012/291294"
149
- subject = Briard::Metadata.new(input: input, from: "crossref")
147
+ it 'with pages' do
148
+ input = 'https://doi.org/10.1155/2012/291294'
149
+ subject = described_class.new(input: input, from: 'crossref')
150
150
  expect(subject.valid?).to be true
151
151
  json = JSON.parse(subject.citeproc)
152
- expect(json["type"]).to eq("article-journal")
153
- expect(json["id"]).to eq("https://doi.org/10.1155/2012/291294")
154
- expect(json["DOI"]).to eq("10.1155/2012/291294")
155
- expect(json["title"]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
156
- expect(json["author"]).to eq([{"family"=>"Thanassi", "given"=>"Wendy"},
157
- {"family"=>"Noda", "given"=>"Art"},
158
- {"family"=>"Hernandez", "given"=>"Beatriz"},
159
- {"family"=>"Newell", "given"=>"Jeffery"},
160
- {"family"=>"Terpeluk", "given"=>"Paul"},
161
- {"family"=>"Marder", "given"=>"David"},
162
- {"family"=>"Yesavage", "given"=>"Jerome A."}])
163
- expect(json["container-title"]).to eq("Pulmonary Medicine")
164
- expect(json["volume"]).to eq("2012")
165
- expect(json["page"]).to eq("1-7")
166
- expect(json["issued"]).to eq("date-parts"=>[[2012]])
167
- expect(json["copyright"]).to eq("Creative Commons Attribution 3.0 Unported")
152
+ expect(json['type']).to eq('article-journal')
153
+ expect(json['id']).to eq('https://doi.org/10.1155/2012/291294')
154
+ expect(json['DOI']).to eq('10.1155/2012/291294')
155
+ expect(json['title']).to eq('Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers')
156
+ expect(json['author']).to eq([{ 'family' => 'Thanassi', 'given' => 'Wendy' },
157
+ { 'family' => 'Noda', 'given' => 'Art' },
158
+ { 'family' => 'Hernandez', 'given' => 'Beatriz' },
159
+ { 'family' => 'Newell', 'given' => 'Jeffery' },
160
+ { 'family' => 'Terpeluk', 'given' => 'Paul' },
161
+ { 'family' => 'Marder', 'given' => 'David' },
162
+ { 'family' => 'Yesavage', 'given' => 'Jerome A.' }])
163
+ expect(json['container-title']).to eq('Pulmonary Medicine')
164
+ expect(json['volume']).to eq('2012')
165
+ expect(json['page']).to eq('1-7')
166
+ expect(json['issued']).to eq('date-parts' => [[2012]])
167
+ expect(json['copyright']).to eq('Creative Commons Attribution 3.0 Unported')
168
168
  end
169
169
 
170
- it "with only first page" do
171
- input = "https://doi.org/10.1371/journal.pone.0214986"
172
- subject = Briard::Metadata.new(input: input, from: "crossref")
170
+ it 'with only first page' do
171
+ input = 'https://doi.org/10.1371/journal.pone.0214986'
172
+ subject = described_class.new(input: input, from: 'crossref')
173
173
  expect(subject.valid?).to be true
174
174
  json = JSON.parse(subject.citeproc)
175
- expect(json["type"]).to eq("article-journal")
176
- expect(json["id"]).to eq("https://doi.org/10.1371/journal.pone.0214986")
177
- expect(json["DOI"]).to eq("10.1371/journal.pone.0214986")
178
- expect(json["title"]).to eq("River metrics by the public, for the public")
179
- expect(json["author"]).to eq([{"family"=>"Weber", "given"=>"Matthew A."}, {"family"=>"Ringold", "given"=>"Paul L."}])
180
- expect(json["container-title"]).to eq("PLOS ONE")
181
- expect(json["volume"]).to eq("14")
182
- expect(json["page"]).to eq("e0214986")
183
- expect(json["issued"]).to eq("date-parts"=>[[2019, 5, 8]])
184
- expect(json["copyright"]).to eq("Creative Commons Zero v1.0 Universal")
175
+ expect(json['type']).to eq('article-journal')
176
+ expect(json['id']).to eq('https://doi.org/10.1371/journal.pone.0214986')
177
+ expect(json['DOI']).to eq('10.1371/journal.pone.0214986')
178
+ expect(json['title']).to eq('River metrics by the public, for the public')
179
+ expect(json['author']).to eq([{ 'family' => 'Weber', 'given' => 'Matthew A.' },
180
+ { 'family' => 'Ringold', 'given' => 'Paul L.' }])
181
+ expect(json['container-title']).to eq('PLOS ONE')
182
+ expect(json['volume']).to eq('14')
183
+ expect(json['page']).to eq('e0214986')
184
+ expect(json['issued']).to eq('date-parts' => [[2019, 5, 8]])
185
+ expect(json['copyright']).to eq('Creative Commons Zero v1.0 Universal')
185
186
  end
186
187
 
187
- it "missing creator" do
188
- input = "https://doi.org/10.3390/publications6020015"
189
- subject = Briard::Metadata.new(input: input, from: "crossref")
188
+ it 'missing creator' do
189
+ input = 'https://doi.org/10.3390/publications6020015'
190
+ subject = described_class.new(input: input, from: 'crossref')
190
191
  expect(subject.valid?).to be true
191
192
  json = JSON.parse(subject.citeproc)
192
- expect(json["type"]).to eq("article-journal")
193
- expect(json["id"]).to eq("https://doi.org/10.3390/publications6020015")
194
- expect(json["DOI"]).to eq("10.3390/publications6020015")
195
- expect(json["title"]).to eq("Converting the Literature of a Scientific Field to Open Access through Global Collaboration: The Experience of SCOAP3 in Particle Physics")
196
- expect(json["author"]).to eq([{"family"=>"Kohls", "given"=>"Alexander"},
197
- {"family"=>"Mele", "given"=>"Salvatore"}])
198
- expect(json["container-title"]).to eq("Publications")
199
- expect(json["publisher"]).to eq("MDPI AG")
200
- expect(json["page"]).to eq("15")
201
- expect(json["issued"]).to eq("date-parts"=>[[2018, 4, 9]])
202
- expect(json["copyright"]).to eq("Creative Commons Attribution 4.0 International")
193
+ expect(json['type']).to eq('article-journal')
194
+ expect(json['id']).to eq('https://doi.org/10.3390/publications6020015')
195
+ expect(json['DOI']).to eq('10.3390/publications6020015')
196
+ expect(json['title']).to eq('Converting the Literature of a Scientific Field to Open Access through Global Collaboration: The Experience of SCOAP3 in Particle Physics')
197
+ expect(json['author']).to eq([{ 'family' => 'Kohls', 'given' => 'Alexander' },
198
+ { 'family' => 'Mele', 'given' => 'Salvatore' }])
199
+ expect(json['container-title']).to eq('Publications')
200
+ expect(json['publisher']).to eq('MDPI AG')
201
+ expect(json['page']).to eq('15')
202
+ expect(json['issued']).to eq('date-parts' => [[2018, 4, 9]])
203
+ expect(json['copyright']).to eq('Creative Commons Attribution 4.0 International')
203
204
  end
204
205
 
205
- it "container title" do
206
- input = "https://doi.org/10.6102/ZIS146"
207
- subject = Briard::Metadata.new(input: input, from: "datacite")
206
+ it 'container title' do
207
+ input = 'https://doi.org/10.6102/ZIS146'
208
+ subject = described_class.new(input: input, from: 'datacite')
208
209
  json = JSON.parse(subject.citeproc)
209
- expect(json["type"]).to eq("article-journal")
210
- expect(json["id"]).to eq("https://doi.org/10.6102/zis146")
211
- expect(json["DOI"]).to eq("10.6102/zis146")
212
- expect(json["title"]).to eq("Deutsche Version der Positive and Negative Affect Schedule (PANAS)")
213
- expect(json["author"]).to eq([{"family"=>"Janke", "given"=>"S."},
214
- {"family"=>"Glöckner-Rist", "given"=>"A."}])
215
- expect(json["container-title"]).to eq("Zusammenstellung sozialwissenschaftlicher Items und Skalen (ZIS)")
216
- expect(json["issued"]).to eq("date-parts" => [[2012]])
210
+ expect(json['type']).to eq('article-journal')
211
+ expect(json['id']).to eq('https://doi.org/10.6102/zis146')
212
+ expect(json['DOI']).to eq('10.6102/zis146')
213
+ expect(json['title']).to eq('Deutsche Version der Positive and Negative Affect Schedule (PANAS)')
214
+ expect(json['author']).to eq([{ 'family' => 'Janke', 'given' => 'S.' },
215
+ { 'family' => 'Glöckner-Rist', 'given' => 'A.' }])
216
+ expect(json['container-title']).to eq('Zusammenstellung sozialwissenschaftlicher Items und Skalen (ZIS)')
217
+ expect(json['issued']).to eq('date-parts' => [[2012]])
217
218
  end
218
219
 
219
- it "Crossref DOI" do
220
- input = fixture_path + "crossref.bib"
221
- subject = Briard::Metadata.new(input: input, from: "bibtex")
220
+ it 'Crossref DOI' do
221
+ input = "#{fixture_path}crossref.bib"
222
+ subject = described_class.new(input: input, from: 'bibtex')
222
223
  json = JSON.parse(subject.citeproc)
223
- expect(json["type"]).to eq("article-journal")
224
- expect(json["id"]).to eq("https://doi.org/10.7554/elife.01567")
225
- expect(json["DOI"]).to eq("10.7554/elife.01567")
226
- expect(json["URL"]).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
227
- expect(json["title"]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
228
- expect(json["author"]).to eq([{"family"=>"Sankar", "given"=>"Martial"},
229
- {"family"=>"Nieminen", "given"=>"Kaisa"},
230
- {"family"=>"Ragni", "given"=>"Laura"},
231
- {"family"=>"Xenarios", "given"=>"Ioannis"},
232
- {"family"=>"Hardtke", "given"=>"Christian S"}])
233
- expect(json["container-title"]).to eq("eLife")
234
- expect(json["issued"]).to eq("date-parts" => [[2014]])
224
+ expect(json['type']).to eq('article-journal')
225
+ expect(json['id']).to eq('https://doi.org/10.7554/elife.01567')
226
+ expect(json['DOI']).to eq('10.7554/elife.01567')
227
+ expect(json['URL']).to eq('http://elifesciences.org/lookup/doi/10.7554/eLife.01567')
228
+ expect(json['title']).to eq('Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth')
229
+ expect(json['author']).to eq([{ 'family' => 'Sankar', 'given' => 'Martial' },
230
+ { 'family' => 'Nieminen', 'given' => 'Kaisa' },
231
+ { 'family' => 'Ragni', 'given' => 'Laura' },
232
+ { 'family' => 'Xenarios', 'given' => 'Ioannis' },
233
+ { 'family' => 'Hardtke', 'given' => 'Christian S' }])
234
+ expect(json['container-title']).to eq('eLife')
235
+ expect(json['issued']).to eq('date-parts' => [[2014]])
235
236
  end
236
237
 
237
- it "author is organization" do
238
- input = fixture_path + 'gtex.xml'
239
- subject = Briard::Metadata.new(input: input, from: "datacite")
238
+ it 'author is organization' do
239
+ input = "#{fixture_path}gtex.xml"
240
+ subject = described_class.new(input: input, from: 'datacite')
240
241
  json = JSON.parse(subject.citeproc)
241
- expect(json["id"]).to eq("https://doi.org/10.25491/9hx8-ke93")
242
- expect(json["author"]).to eq([{"literal"=>"The GTEx Consortium"}])
242
+ expect(json['id']).to eq('https://doi.org/10.25491/9hx8-ke93')
243
+ expect(json['author']).to eq([{ 'literal' => 'The GTEx Consortium' }])
243
244
  end
244
245
 
245
- it "maremma" do
246
- input = "https://github.com/datacite/maremma"
247
- subject = Briard::Metadata.new(input: input, from: "codemeta")
246
+ it 'maremma' do
247
+ input = 'https://github.com/datacite/maremma'
248
+ subject = described_class.new(input: input, from: 'codemeta')
248
249
  json = JSON.parse(subject.citeproc)
249
- expect(json["type"]).to eq("article-journal")
250
- expect(json["id"]).to eq("https://doi.org/10.5438/qeg0-3gm3")
251
- expect(json["DOI"]).to eq("10.5438/qeg0-3gm3")
252
- expect(json["title"]).to eq("Maremma: a Ruby library for simplified network calls")
253
- expect(json["author"]).to eq([{"family"=>"Fenner", "given"=>"Martin"}])
254
- expect(json["publisher"]).to eq("DataCite")
255
- expect(json["issued"]).to eq("date-parts" => [[2017, 2, 24]])
256
- expect(json["copyright"]).to eq("MIT License")
250
+ expect(json['type']).to eq('article-journal')
251
+ expect(json['id']).to eq('https://doi.org/10.5438/qeg0-3gm3')
252
+ expect(json['DOI']).to eq('10.5438/qeg0-3gm3')
253
+ expect(json['title']).to eq('Maremma: a Ruby library for simplified network calls')
254
+ expect(json['author']).to eq([{ 'family' => 'Fenner', 'given' => 'Martin' }])
255
+ expect(json['publisher']).to eq('DataCite')
256
+ expect(json['issued']).to eq('date-parts' => [[2017, 2, 24]])
257
+ expect(json['copyright']).to eq('MIT License')
257
258
  end
258
259
 
259
- it "keywords subject scheme" do
260
- input = "https://doi.org/10.1594/pangaea.721193"
261
- subject = Briard::Metadata.new(input: input, from: "datacite")
260
+ it 'keywords subject scheme' do
261
+ input = 'https://doi.org/10.1594/pangaea.721193'
262
+ subject = described_class.new(input: input, from: 'datacite')
262
263
  json = JSON.parse(subject.citeproc)
263
- expect(json["type"]).to eq("dataset")
264
- expect(json["id"]).to eq("https://doi.org/10.1594/pangaea.721193")
265
- expect(json["DOI"]).to eq("10.1594/pangaea.721193")
266
- expect(json["categories"]).to include("animalia", "bottles or small containers/aquaria (<20 l)")
267
- expect(json["copyright"]).to eq("Creative Commons Attribution 3.0 Unported")
264
+ expect(json['type']).to eq('dataset')
265
+ expect(json['id']).to eq('https://doi.org/10.1594/pangaea.721193')
266
+ expect(json['DOI']).to eq('10.1594/pangaea.721193')
267
+ expect(json['categories']).to include('animalia',
268
+ 'bottles or small containers/aquaria (<20 l)')
269
+ expect(json['copyright']).to eq('Creative Commons Attribution 3.0 Unported')
268
270
  end
269
271
 
270
- it "organization author" do
271
- input = "https://doi.org/10.1186/s13742-015-0103-4"
272
- subject = Briard::Metadata.new(input: input, from: "crossref")
272
+ it 'organization author' do
273
+ input = 'https://doi.org/10.1186/s13742-015-0103-4'
274
+ subject = described_class.new(input: input, from: 'crossref')
273
275
  json = JSON.parse(subject.citeproc)
274
- expect(json["type"]).to eq("article-journal")
275
- expect(json["id"]).to eq("https://doi.org/10.1186/s13742-015-0103-4")
276
- expect(json["DOI"]).to eq("10.1186/s13742-015-0103-4")
277
- expect(json["author"]).to eq([{"family"=>"Liu", "given"=>"Siyang"},
278
- {"family"=>"Huang", "given"=>"Shujia"},
279
- {"family"=>"Rao", "given"=>"Junhua"},
280
- {"family"=>"Ye", "given"=>"Weijian"},
281
- {"family"=>"Krogh", "given"=>"Anders"},
282
- {"family"=>"Wang", "given"=>"Jun"},
283
- {"literal"=>"The Genome Denmark Consortium"}])
284
- expect(json["container-title"]).to eq("GigaScience")
276
+ expect(json['type']).to eq('article-journal')
277
+ expect(json['id']).to eq('https://doi.org/10.1186/s13742-015-0103-4')
278
+ expect(json['DOI']).to eq('10.1186/s13742-015-0103-4')
279
+ expect(json['author']).to eq([{ 'family' => 'Liu', 'given' => 'Siyang' },
280
+ { 'family' => 'Huang', 'given' => 'Shujia' },
281
+ { 'family' => 'Rao', 'given' => 'Junhua' },
282
+ { 'family' => 'Ye', 'given' => 'Weijian' },
283
+ { 'family' => 'Krogh', 'given' => 'Anders' },
284
+ { 'family' => 'Wang', 'given' => 'Jun' },
285
+ { 'literal' => 'The Genome Denmark Consortium' }])
286
+ expect(json['container-title']).to eq('GigaScience')
285
287
  end
286
288
 
287
- it "interactive resource without dates" do
288
- input = "https://doi.org/10.34747/g6yb-3412"
289
- subject = Briard::Metadata.new(input: input, from: "datacite")
289
+ it 'interactive resource without dates' do
290
+ input = 'https://doi.org/10.34747/g6yb-3412'
291
+ subject = described_class.new(input: input, from: 'datacite')
290
292
  json = JSON.parse(subject.citeproc)
291
- expect(json["type"]).to eq("article")
292
- expect(json["DOI"]).to eq("10.34747/g6yb-3412")
293
- expect(json["issued"]).to eq("date-parts"=>[[2019]])
293
+ expect(json['type']).to eq('article')
294
+ expect(json['DOI']).to eq('10.34747/g6yb-3412')
295
+ expect(json['issued']).to eq('date-parts' => [[2019]])
294
296
  end
295
297
  end
296
298
  end