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.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +72 -0
- data/.github/workflows/rubocop.yml +50 -0
- data/.rubocop.yml +144 -620
- data/.rubocop_todo.yml +76 -0
- data/CHANGELOG.md +18 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +40 -6
- data/Rakefile +1 -1
- data/{bolognese.gemspec → briard.gemspec} +46 -39
- data/lib/briard/array.rb +2 -2
- data/lib/briard/author_utils.rb +79 -71
- data/lib/briard/cli.rb +12 -13
- data/lib/briard/crossref_utils.rb +73 -61
- data/lib/briard/datacite_utils.rb +132 -106
- data/lib/briard/doi_utils.rb +10 -10
- data/lib/briard/metadata.rb +96 -106
- data/lib/briard/metadata_utils.rb +87 -78
- data/lib/briard/readers/bibtex_reader.rb +65 -65
- data/lib/briard/readers/cff_reader.rb +88 -70
- data/lib/briard/readers/citeproc_reader.rb +90 -84
- data/lib/briard/readers/codemeta_reader.rb +68 -50
- data/lib/briard/readers/crosscite_reader.rb +2 -2
- data/lib/briard/readers/crossref_reader.rb +249 -210
- data/lib/briard/readers/datacite_json_reader.rb +3 -3
- data/lib/briard/readers/datacite_reader.rb +225 -189
- data/lib/briard/readers/npm_reader.rb +49 -42
- data/lib/briard/readers/ris_reader.rb +82 -80
- data/lib/briard/readers/schema_org_reader.rb +182 -159
- data/lib/briard/string.rb +1 -1
- data/lib/briard/utils.rb +4 -4
- data/lib/briard/version.rb +3 -1
- data/lib/briard/whitelist_scrubber.rb +11 -4
- data/lib/briard/writers/bibtex_writer.rb +14 -8
- data/lib/briard/writers/cff_writer.rb +33 -26
- data/lib/briard/writers/codemeta_writer.rb +19 -15
- data/lib/briard/writers/csv_writer.rb +6 -4
- data/lib/briard/writers/datacite_json_writer.rb +8 -2
- data/lib/briard/writers/jats_writer.rb +33 -28
- data/lib/briard/writers/rdf_xml_writer.rb +1 -1
- data/lib/briard/writers/ris_writer.rb +30 -18
- data/lib/briard/writers/turtle_writer.rb +1 -1
- data/lib/briard.rb +6 -6
- data/rubocop.sarif +0 -0
- data/spec/array_spec.rb +5 -5
- data/spec/author_utils_spec.rb +151 -132
- data/spec/datacite_utils_spec.rb +135 -83
- data/spec/doi_utils_spec.rb +168 -164
- data/spec/find_from_format_spec.rb +69 -69
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/onlies_keep_specific_tags.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/removes_a_tags.yml +65 -0
- data/spec/metadata_spec.rb +91 -90
- data/spec/readers/bibtex_reader_spec.rb +43 -38
- data/spec/readers/cff_reader_spec.rb +165 -153
- data/spec/readers/citeproc_reader_spec.rb +45 -40
- data/spec/readers/codemeta_reader_spec.rb +128 -115
- data/spec/readers/crosscite_reader_spec.rb +34 -24
- data/spec/readers/crossref_reader_spec.rb +1098 -939
- data/spec/readers/datacite_json_reader_spec.rb +53 -40
- data/spec/readers/datacite_reader_spec.rb +1541 -1337
- data/spec/readers/npm_reader_spec.rb +48 -43
- data/spec/readers/ris_reader_spec.rb +53 -47
- data/spec/readers/schema_org_reader_spec.rb +329 -267
- data/spec/spec_helper.rb +6 -5
- data/spec/utils_spec.rb +371 -347
- data/spec/writers/bibtex_writer_spec.rb +143 -143
- data/spec/writers/cff_writer_spec.rb +96 -90
- data/spec/writers/citation_writer_spec.rb +34 -33
- data/spec/writers/citeproc_writer_spec.rb +226 -224
- data/spec/writers/codemeta_writer_spec.rb +18 -16
- data/spec/writers/crosscite_writer_spec.rb +91 -73
- data/spec/writers/crossref_writer_spec.rb +99 -91
- data/spec/writers/csv_writer_spec.rb +70 -70
- data/spec/writers/datacite_json_writer_spec.rb +78 -68
- data/spec/writers/datacite_writer_spec.rb +417 -322
- data/spec/writers/jats_writer_spec.rb +177 -161
- data/spec/writers/rdf_xml_writer_spec.rb +68 -63
- data/spec/writers/ris_writer_spec.rb +162 -162
- data/spec/writers/turtle_writer_spec.rb +47 -47
- metadata +242 -166
- 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  | 
| 7 | 
            -
                it  | 
| 8 | 
            -
                  input =  | 
| 9 | 
            -
                  subject =  | 
| 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[ | 
| 13 | 
            -
                  expect(json[ | 
| 14 | 
            -
                  expect(json[ | 
| 15 | 
            -
                  expect(json[ | 
| 16 | 
            -
                  expect(json[ | 
| 17 | 
            -
                                                { | 
| 18 | 
            -
                                                { | 
| 19 | 
            -
                                                { | 
| 20 | 
            -
                                                { | 
| 21 | 
            -
                                                { | 
| 22 | 
            -
                                                { | 
| 23 | 
            -
                                                { | 
| 24 | 
            -
                  expect(json[ | 
| 25 | 
            -
                  expect(json[ | 
| 26 | 
            -
                  expect(json[ | 
| 27 | 
            -
                  expect(json[ | 
| 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  | 
| 31 | 
            -
                  input =  | 
| 32 | 
            -
                  subject =  | 
| 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[ | 
| 36 | 
            -
                  expect(json[ | 
| 37 | 
            -
                  expect(json[ | 
| 38 | 
            -
                  expect(json[ | 
| 39 | 
            -
                  expect(json[ | 
| 40 | 
            -
                  expect(json[ | 
| 41 | 
            -
                  expect(json[ | 
| 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  | 
| 45 | 
            -
                  input = fixture_path | 
| 46 | 
            -
                  subject =  | 
| 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[ | 
| 49 | 
            -
                  expect(json[ | 
| 50 | 
            -
                  expect(json[ | 
| 51 | 
            -
                  expect(json[ | 
| 52 | 
            -
                  expect(json[ | 
| 53 | 
            -
                  expect(json[ | 
| 54 | 
            -
                  expect(json[ | 
| 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  | 
| 58 | 
            -
                  input =  | 
| 59 | 
            -
                  subject =  | 
| 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[ | 
| 62 | 
            -
                  expect(json[ | 
| 63 | 
            -
                  expect(json[ | 
| 64 | 
            -
                  expect(json[ | 
| 65 | 
            -
                  expect(json[ | 
| 66 | 
            -
                  expect(json[ | 
| 67 | 
            -
                  expect(json[ | 
| 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  | 
| 71 | 
            -
                  input =  | 
| 72 | 
            -
                  subject =  | 
| 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[ | 
| 75 | 
            -
                  expect(json[ | 
| 76 | 
            -
                  expect(json[ | 
| 77 | 
            -
                  expect(json[ | 
| 78 | 
            -
                  expect(json[ | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
                  expect(json[ | 
| 85 | 
            -
                  expect(json[ | 
| 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  | 
| 89 | 
            -
                  input =  | 
| 90 | 
            -
                  subject =  | 
| 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[ | 
| 94 | 
            -
                  expect(json[ | 
| 95 | 
            -
                  expect(json[ | 
| 96 | 
            -
                  expect(json[ | 
| 97 | 
            -
                  expect(json[ | 
| 98 | 
            -
                                                { | 
| 99 | 
            -
                                                { | 
| 100 | 
            -
                                                { | 
| 101 | 
            -
                                                { | 
| 102 | 
            -
                  expect(json[ | 
| 103 | 
            -
                  expect(json[ | 
| 104 | 
            -
                  expect(json[ | 
| 105 | 
            -
                  expect(json[ | 
| 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  | 
| 109 | 
            -
                  input =  | 
| 110 | 
            -
                  subject =  | 
| 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[ | 
| 113 | 
            -
                  expect(json[ | 
| 114 | 
            -
                  expect(json[ | 
| 115 | 
            -
                  expect(json[ | 
| 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  | 
| 119 | 
            -
                  input =  | 
| 120 | 
            -
                  subject =  | 
| 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[ | 
| 123 | 
            -
                  expect(json[ | 
| 124 | 
            -
                  expect(json[ | 
| 125 | 
            -
                  expect(json[ | 
| 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  | 
| 129 | 
            -
                  input = fixture_path | 
| 130 | 
            -
                  subject =  | 
| 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[ | 
| 133 | 
            -
                  expect(json[ | 
| 134 | 
            -
                  expect(json[ | 
| 135 | 
            -
                  expect(json[ | 
| 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  | 
| 139 | 
            -
                  input =  | 
| 140 | 
            -
                  subject =  | 
| 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[ | 
| 143 | 
            -
                  expect(json[ | 
| 144 | 
            -
                  expect(json[ | 
| 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  | 
| 148 | 
            -
                  input =  | 
| 149 | 
            -
                  subject =  | 
| 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[ | 
| 153 | 
            -
                  expect(json[ | 
| 154 | 
            -
                  expect(json[ | 
| 155 | 
            -
                  expect(json[ | 
| 156 | 
            -
                  expect(json[ | 
| 157 | 
            -
                                                { | 
| 158 | 
            -
                                                { | 
| 159 | 
            -
                                                { | 
| 160 | 
            -
                                                { | 
| 161 | 
            -
                                                { | 
| 162 | 
            -
                                                { | 
| 163 | 
            -
                  expect(json[ | 
| 164 | 
            -
                  expect(json[ | 
| 165 | 
            -
                  expect(json[ | 
| 166 | 
            -
                  expect(json[ | 
| 167 | 
            -
                  expect(json[ | 
| 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  | 
| 171 | 
            -
                  input =  | 
| 172 | 
            -
                  subject =  | 
| 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[ | 
| 176 | 
            -
                  expect(json[ | 
| 177 | 
            -
                  expect(json[ | 
| 178 | 
            -
                  expect(json[ | 
| 179 | 
            -
                  expect(json[ | 
| 180 | 
            -
             | 
| 181 | 
            -
                  expect(json[ | 
| 182 | 
            -
                  expect(json[ | 
| 183 | 
            -
                  expect(json[ | 
| 184 | 
            -
                  expect(json[ | 
| 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  | 
| 188 | 
            -
                  input =  | 
| 189 | 
            -
                  subject =  | 
| 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[ | 
| 193 | 
            -
                  expect(json[ | 
| 194 | 
            -
                  expect(json[ | 
| 195 | 
            -
                  expect(json[ | 
| 196 | 
            -
                  expect(json[ | 
| 197 | 
            -
             | 
| 198 | 
            -
                  expect(json[ | 
| 199 | 
            -
                  expect(json[ | 
| 200 | 
            -
                  expect(json[ | 
| 201 | 
            -
                  expect(json[ | 
| 202 | 
            -
                  expect(json[ | 
| 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  | 
| 206 | 
            -
                  input =  | 
| 207 | 
            -
                  subject =  | 
| 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[ | 
| 210 | 
            -
                  expect(json[ | 
| 211 | 
            -
                  expect(json[ | 
| 212 | 
            -
                  expect(json[ | 
| 213 | 
            -
                  expect(json[ | 
| 214 | 
            -
                                                { | 
| 215 | 
            -
                  expect(json[ | 
| 216 | 
            -
                  expect(json[ | 
| 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  | 
| 220 | 
            -
                  input = fixture_path | 
| 221 | 
            -
                  subject =  | 
| 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[ | 
| 224 | 
            -
                  expect(json[ | 
| 225 | 
            -
                  expect(json[ | 
| 226 | 
            -
                  expect(json[ | 
| 227 | 
            -
                  expect(json[ | 
| 228 | 
            -
                  expect(json[ | 
| 229 | 
            -
                                                { | 
| 230 | 
            -
                                                { | 
| 231 | 
            -
                                                { | 
| 232 | 
            -
                                                { | 
| 233 | 
            -
                  expect(json[ | 
| 234 | 
            -
                  expect(json[ | 
| 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  | 
| 238 | 
            -
                  input = fixture_path | 
| 239 | 
            -
                  subject =  | 
| 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[ | 
| 242 | 
            -
                  expect(json[ | 
| 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  | 
| 246 | 
            -
                  input =  | 
| 247 | 
            -
                  subject =  | 
| 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[ | 
| 250 | 
            -
                  expect(json[ | 
| 251 | 
            -
                  expect(json[ | 
| 252 | 
            -
                  expect(json[ | 
| 253 | 
            -
                  expect(json[ | 
| 254 | 
            -
                  expect(json[ | 
| 255 | 
            -
                  expect(json[ | 
| 256 | 
            -
                  expect(json[ | 
| 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  | 
| 260 | 
            -
                  input =  | 
| 261 | 
            -
                  subject =  | 
| 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[ | 
| 264 | 
            -
                  expect(json[ | 
| 265 | 
            -
                  expect(json[ | 
| 266 | 
            -
                  expect(json[ | 
| 267 | 
            -
             | 
| 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  | 
| 271 | 
            -
                  input =  | 
| 272 | 
            -
                  subject =  | 
| 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[ | 
| 275 | 
            -
                  expect(json[ | 
| 276 | 
            -
                  expect(json[ | 
| 277 | 
            -
                  expect(json[ | 
| 278 | 
            -
             | 
| 279 | 
            -
             | 
| 280 | 
            -
             | 
| 281 | 
            -
             | 
| 282 | 
            -
             | 
| 283 | 
            -
             | 
| 284 | 
            -
                  expect(json[ | 
| 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  | 
| 288 | 
            -
                  input =  | 
| 289 | 
            -
                  subject =  | 
| 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[ | 
| 292 | 
            -
                  expect(json[ | 
| 293 | 
            -
                  expect(json[ | 
| 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
         |