commonmeta-ruby 3.4.5 → 3.5.1

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -8
  3. data/csl-data.json +538 -0
  4. data/lib/commonmeta/author_utils.rb +103 -71
  5. data/lib/commonmeta/crossref_utils.rb +31 -25
  6. data/lib/commonmeta/metadata.rb +8 -14
  7. data/lib/commonmeta/metadata_utils.rb +4 -3
  8. data/lib/commonmeta/readers/bibtex_reader.rb +3 -3
  9. data/lib/commonmeta/readers/cff_reader.rb +7 -6
  10. data/lib/commonmeta/readers/codemeta_reader.rb +3 -3
  11. data/lib/commonmeta/readers/crossref_reader.rb +131 -124
  12. data/lib/commonmeta/readers/crossref_xml_reader.rb +7 -6
  13. data/lib/commonmeta/readers/csl_reader.rb +3 -4
  14. data/lib/commonmeta/readers/datacite_reader.rb +5 -5
  15. data/lib/commonmeta/readers/json_feed_reader.rb +8 -4
  16. data/lib/commonmeta/readers/npm_reader.rb +2 -2
  17. data/lib/commonmeta/readers/ris_reader.rb +1 -1
  18. data/lib/commonmeta/readers/schema_org_reader.rb +6 -4
  19. data/lib/commonmeta/schema_utils.rb +1 -1
  20. data/lib/commonmeta/utils.rb +4 -2
  21. data/lib/commonmeta/version.rb +1 -1
  22. data/lib/commonmeta/writers/bibtex_writer.rb +1 -1
  23. data/lib/commonmeta/writers/cff_writer.rb +5 -4
  24. data/lib/commonmeta/writers/codemeta_writer.rb +4 -2
  25. data/lib/commonmeta/writers/csv_writer.rb +4 -2
  26. data/lib/commonmeta/writers/datacite_writer.rb +1 -1
  27. data/lib/commonmeta/writers/jats_writer.rb +9 -5
  28. data/lib/commonmeta/writers/ris_writer.rb +2 -1
  29. data/lib/commonmeta/writers/schema_org_writer.rb +7 -4
  30. data/resources/{commonmeta_v0.9.3.json → commonmeta_v0.10.3.json} +138 -55
  31. data/resources/csl-citation.json +99 -0
  32. data/spec/author_utils_spec.rb +16 -16
  33. data/spec/cli_spec.rb +1 -1
  34. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/missing_contributor.yml +307 -0
  35. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/SoftwareSourceCode.yml +76 -0
  36. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/archived_wordpress_post.yml +119 -0
  37. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/book_oup.yml +107 -0
  38. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_plos.yml +407 -0
  39. data/spec/metadata_spec.rb +2 -2
  40. data/spec/readers/bibtex_reader_spec.rb +5 -5
  41. data/spec/readers/cff_reader_spec.rb +127 -127
  42. data/spec/readers/codemeta_reader_spec.rb +11 -11
  43. data/spec/readers/crossref_reader_spec.rb +844 -835
  44. data/spec/readers/crossref_xml_reader_spec.rb +899 -901
  45. data/spec/readers/csl_reader_spec.rb +33 -33
  46. data/spec/readers/datacite_reader_spec.rb +106 -103
  47. data/spec/readers/json_feed_reader_spec.rb +68 -40
  48. data/spec/readers/npm_reader_spec.rb +32 -33
  49. data/spec/readers/ris_reader_spec.rb +36 -36
  50. data/spec/readers/schema_org_reader_spec.rb +289 -288
  51. data/spec/writers/codemeta_writer_spec.rb +19 -20
  52. data/spec/writers/crossref_xml_writer_spec.rb +73 -37
  53. data/spec/writers/datacite_writer_spec.rb +2 -1
  54. metadata +10 -3
@@ -1,919 +1,928 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe Commonmeta::Metadata, vcr: true do
6
6
  subject { described_class.new(input: input) }
7
7
 
8
8
  let(:input) { "#{fixture_path}crossref.json" }
9
9
 
10
- context 'get crossref raw' do
11
- it 'journal article' do
10
+ context "get crossref raw" do
11
+ it "journal article" do
12
12
  expect(subject.raw).to eq(File.read(input).strip)
13
13
  end
14
14
  end
15
15
 
16
- context 'get crossref metadata' do
17
- it 'DOI with data citation' do
18
- expect(subject.valid?).to be true
19
- expect(subject.id).to eq('https://doi.org/10.7554/elife.01567')
20
- expect(subject.type).to eq('JournalArticle')
21
- expect(subject.url).to eq('https://elifesciences.org/articles/01567')
22
- expect(subject.creators.length).to eq(5)
23
- expect(subject.creators.first).to eq('type' => 'Person',
24
- 'givenName' => 'Martial', 'familyName' => 'Sankar', 'affiliation' => [{ 'name' => 'Department of Plant Molecular Biology, University of Lausanne, Lausanne, Switzerland' }])
25
- expect(subject.license).to eq('id' => 'CC-BY-3.0',
26
- 'url' => 'https://creativecommons.org/licenses/by/3.0/legalcode')
27
- expect(subject.titles).to eq([{ 'title' => 'Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth' }])
28
- expect(subject.date).to eq('published' => '2014-02-11', 'updated' => '2022-03-26')
29
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/4374',
30
- 'name' => 'eLife Sciences Publications, Ltd')
31
- expect(subject.container).to eq('identifier' => '2050-084X',
32
- 'identifierType' => 'ISSN', 'title' => 'eLife', 'type' => 'Journal', 'volume' => '3')
16
+ context "get crossref metadata" do
17
+ it "DOI with data citation" do
18
+ expect(subject.valid?).to be true
19
+ expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
20
+ expect(subject.type).to eq("JournalArticle")
21
+ expect(subject.url).to eq("https://elifesciences.org/articles/01567")
22
+ expect(subject.contributors.length).to eq(5)
23
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"],
24
+ "givenName" => "Martial", "familyName" => "Sankar", "affiliation" => [{ "name" => "Department of Plant Molecular Biology, University of Lausanne, Lausanne, Switzerland" }])
25
+ expect(subject.license).to eq("id" => "CC-BY-3.0",
26
+ "url" => "https://creativecommons.org/licenses/by/3.0/legalcode")
27
+ expect(subject.titles).to eq([{ "title" => "Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth" }])
28
+ expect(subject.date).to eq("published" => "2014-02-11", "updated" => "2022-03-26")
29
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/4374",
30
+ "name" => "eLife Sciences Publications, Ltd")
31
+ expect(subject.container).to eq("identifier" => "2050-084X",
32
+ "identifierType" => "ISSN", "title" => "eLife", "type" => "Journal", "volume" => "3")
33
33
  expect(subject.references.length).to eq(27)
34
- expect(subject.references.last).to eq('containerTitle' => 'Nature Cell Biology',
35
- 'creator' => 'Yin',
36
- 'doi' => 'https://doi.org/10.1038/ncb2764',
37
- 'firstPage' => '860',
38
- 'key' => 'bib27',
39
- 'publicationYear' => '2013',
40
- 'title' => 'A screen for morphological complexity identifies regulators of switch-like transitions between discrete cell shapes',
41
- 'volume' => '15')
42
- expect(subject.funding_references).to eq([{ 'funderName' => 'SystemsX' },
43
- { 'funderName' => 'EMBO longterm post-doctoral fellowships' },
44
- { 'funderName' => 'Marie Heim-Voegtlin' },
45
- { 'funderIdentifier' => 'https://doi.org/10.13039/501100006390',
46
- 'funderIdentifierType' => 'Crossref Funder ID',
47
- 'funderName' => 'University of Lausanne' },
48
- { 'funderName' => 'SystemsX' },
49
- { 'funderIdentifier' => 'https://doi.org/10.13039/501100003043',
50
- 'funderIdentifierType' => 'Crossref Funder ID',
51
- 'funderName' => 'EMBO' },
52
- { 'funderIdentifier' => 'https://doi.org/10.13039/501100001711',
53
- 'funderIdentifierType' => 'Crossref Funder ID',
54
- 'funderName' => 'Swiss National Science Foundation' },
55
- { 'funderIdentifier' => 'https://doi.org/10.13039/501100006390',
56
- 'funderIdentifierType' => 'Crossref Funder ID',
57
- 'funderName' => 'University of Lausanne' }])
58
- expect(subject.provider).to eq('Crossref')
59
- end
60
-
61
- it 'journal article' do
62
- input = 'https://doi.org/10.1371/journal.pone.0000030'
63
- subject = described_class.new(input: input)
64
- expect(subject.valid?).to be true
65
- expect(subject.id).to eq('https://doi.org/10.1371/journal.pone.0000030')
66
- expect(subject.url).to eq('https://dx.plos.org/10.1371/journal.pone.0000030')
67
- expect(subject.type).to eq('JournalArticle')
68
- expect(subject.creators.length).to eq(5)
69
- expect(subject.creators.first).to eq('type' => 'Person',
70
- 'givenName' => 'Markus', 'familyName' => 'Ralser')
71
- expect(subject.contributors).to eq([{ 'contributorType' => 'Editor', 'familyName' => 'Janbon',
72
- 'givenName' => 'Guilhem', 'type' => 'Person' }])
73
- expect(subject.titles).to eq([{ 'title' => 'Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes' }])
74
- expect(subject.license).to eq('id' => 'CC-BY-4.0',
75
- 'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode')
76
- expect(subject.date).to eq('published' => '2006-12-20', 'updated' => '2021-08-06')
77
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/340',
78
- 'name' => 'Public Library of Science (PLoS)')
34
+ expect(subject.references.last).to eq("containerTitle" => "Nature Cell Biology",
35
+ "contributor" => "Yin",
36
+ "doi" => "https://doi.org/10.1038/ncb2764",
37
+ "firstPage" => "860",
38
+ "key" => "bib27",
39
+ "publicationYear" => "2013",
40
+ "title" => "A screen for morphological complexity identifies regulators of switch-like transitions between discrete cell shapes",
41
+ "volume" => "15")
42
+ expect(subject.funding_references).to eq([{ "funderName" => "SystemsX" },
43
+ { "funderName" => "EMBO longterm post-doctoral fellowships" },
44
+ { "funderName" => "Marie Heim-Voegtlin" },
45
+ { "funderIdentifier" => "https://doi.org/10.13039/501100006390",
46
+ "funderIdentifierType" => "Crossref Funder ID",
47
+ "funderName" => "University of Lausanne" },
48
+ { "funderName" => "SystemsX" },
49
+ { "funderIdentifier" => "https://doi.org/10.13039/501100003043",
50
+ "funderIdentifierType" => "Crossref Funder ID",
51
+ "funderName" => "EMBO" },
52
+ { "funderIdentifier" => "https://doi.org/10.13039/501100001711",
53
+ "funderIdentifierType" => "Crossref Funder ID",
54
+ "funderName" => "Swiss National Science Foundation" },
55
+ { "funderIdentifier" => "https://doi.org/10.13039/501100006390",
56
+ "funderIdentifierType" => "Crossref Funder ID",
57
+ "funderName" => "University of Lausanne" }])
58
+ expect(subject.provider).to eq("Crossref")
59
+ end
60
+
61
+ it "journal article" do
62
+ input = "https://doi.org/10.1371/journal.pone.0000030"
63
+ subject = described_class.new(input: input)
64
+ expect(subject.valid?).to be true
65
+ expect(subject.id).to eq("https://doi.org/10.1371/journal.pone.0000030")
66
+ expect(subject.url).to eq("https://dx.plos.org/10.1371/journal.pone.0000030")
67
+ expect(subject.type).to eq("JournalArticle")
68
+ expect(subject.contributors.length).to eq(6)
69
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"],
70
+ "givenName" => "Markus", "familyName" => "Ralser")
71
+ expect(subject.contributors.last).to eq({ "familyName" => "Janbon",
72
+ "givenName" => "Guilhem", "type" => "Person", "contributorRoles" => ["Editor"] })
73
+ expect(subject.titles).to eq([{ "title" => "Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes" }])
74
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
75
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
76
+ expect(subject.date).to eq("published" => "2006-12-20", "updated" => "2021-08-06")
77
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/340",
78
+ "name" => "Public Library of Science (PLoS)")
79
79
  expect(subject.references.length).to eq(73)
80
- expect(subject.references.last).to eq('containerTitle' => 'N Engl J Med', 'creator' => 'KB Hammond',
81
- 'doi' => 'https://doi.org/10.1056/nejm199109123251104',
82
- 'firstPage' => '769',
83
- 'key' => 'ref73',
84
- 'publicationYear' => '1991',
85
- 'title' => 'Efficacy of statewide neonatal screening for cystic fibrosis by assay of trypsinogen concentrations.', 'volume' => '325')
86
- expect(subject.container).to eq('firstPage' => 'e30', 'identifier' => '1932-6203',
87
- 'identifierType' => 'ISSN', 'issue' => '1', 'title' => 'PLoS ONE', 'type' => 'Journal', 'volume' => '1')
88
- expect(subject.provider).to eq('Crossref')
89
- end
90
-
91
- it 'journal article with funding' do
92
- input = '10.3389/fpls.2019.00816'
93
- subject = described_class.new(input: input)
94
- expect(subject.valid?).to be true
95
- expect(subject.id).to eq('https://doi.org/10.3389/fpls.2019.00816')
96
- expect(subject.url).to eq('https://www.frontiersin.org/article/10.3389/fpls.2019.00816/full')
97
- expect(subject.type).to eq('JournalArticle')
98
- expect(subject.creators.length).to eq(4)
99
- expect(subject.creators.first).to eq('type' => 'Person', 'familyName' => 'Fortes',
100
- 'givenName' => 'Ana Margarida')
101
- expect(subject.titles).to eq([{ 'title' => 'Transcriptional Modulation of Polyamine Metabolism in Fruit Species Under Abiotic and Biotic Stress' }])
102
- expect(subject.license).to eq('id' => 'CC-BY-4.0',
103
- 'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode')
104
- expect(subject.date).to eq('published' => '2019-07-02', 'updated' => '2019-09-22')
105
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/1965',
106
- 'name' => 'Frontiers Media SA')
107
- expect(subject.funding_references).to eq([{ 'awardNumber' => 'CA17111',
108
- 'funderIdentifier' => 'https://doi.org/10.13039/501100000921', 'funderIdentifierType' => 'Crossref Funder ID', 'funderName' => 'COST (European Cooperation in Science and Technology)' }])
80
+ expect(subject.references.last).to eq("containerTitle" => "N Engl J Med", "contributor" => "KB Hammond",
81
+ "doi" => "https://doi.org/10.1056/nejm199109123251104",
82
+ "firstPage" => "769",
83
+ "key" => "ref73",
84
+ "publicationYear" => "1991",
85
+ "title" => "Efficacy of statewide neonatal screening for cystic fibrosis by assay of trypsinogen concentrations.", "volume" => "325")
86
+ expect(subject.container).to eq("firstPage" => "e30", "identifier" => "1932-6203",
87
+ "identifierType" => "ISSN", "issue" => "1", "title" => "PLoS ONE", "type" => "Journal", "volume" => "1")
88
+ expect(subject.provider).to eq("Crossref")
89
+ end
90
+
91
+ it "journal article with funding" do
92
+ input = "10.3389/fpls.2019.00816"
93
+ subject = described_class.new(input: input)
94
+ expect(subject.valid?).to be true
95
+ expect(subject.id).to eq("https://doi.org/10.3389/fpls.2019.00816")
96
+ expect(subject.url).to eq("https://www.frontiersin.org/article/10.3389/fpls.2019.00816/full")
97
+ expect(subject.type).to eq("JournalArticle")
98
+ expect(subject.contributors.length).to eq(4)
99
+ expect(subject.contributors.first).to eq("type" => "Person", "familyName" => "Fortes",
100
+ "givenName" => "Ana Margarida", "contributorRoles" => ["Author"])
101
+ expect(subject.titles).to eq([{ "title" => "Transcriptional Modulation of Polyamine Metabolism in Fruit Species Under Abiotic and Biotic Stress" }])
102
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
103
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
104
+ expect(subject.date).to eq("published" => "2019-07-02", "updated" => "2019-09-22")
105
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/1965",
106
+ "name" => "Frontiers Media SA")
107
+ expect(subject.funding_references).to eq([{ "awardNumber" => "CA17111",
108
+ "funderIdentifier" => "https://doi.org/10.13039/501100000921", "funderIdentifierType" => "Crossref Funder ID", "funderName" => "COST (European Cooperation in Science and Technology)" }])
109
109
  expect(subject.references.length).to eq(70)
110
- expect(subject.references.first).to eq('containerTitle' => 'Plant Physiol. Biochem.',
111
- 'creator' => 'Agudelo-Romero',
112
- 'doi' => 'https://doi.org/10.1016/j.plaphy.2013.11.002',
113
- 'firstPage' => '141',
114
- 'key' => 'ref1',
115
- 'publicationYear' => '2014',
116
- 'title' => 'Perturbation of polyamine catabolism affects grape ripening of Vitis vinifera cv. Trincadeira',
117
- 'volume' => '74')
118
- expect(subject.references.last).to eq('containerTitle' => 'Acta Hortic.',
119
- 'creator' => 'Zheng',
120
- 'doi' => 'https://doi.org/10.17660/actahortic.2004.632.41',
121
- 'firstPage' => '317',
122
- 'key' => 'ref70',
123
- 'publicationYear' => '2004',
124
- 'title' => 'Effects of polyamines and salicylic acid on postharvest storage of “Ponkan” mandarin',
125
- 'volume' => '632')
126
- expect(subject.container).to eq('identifier' => '1664-462X',
127
- 'identifierType' => 'ISSN', 'title' => 'Frontiers in Plant Science', 'type' => 'Journal', 'volume' => '10')
128
- expect(subject.provider).to eq('Crossref')
129
- end
130
-
131
- it 'journal article original language title' do
132
- input = 'https://doi.org/10.7600/jspfsm.56.60'
110
+ expect(subject.references.first).to eq("containerTitle" => "Plant Physiol. Biochem.",
111
+ "contributor" => "Agudelo-Romero",
112
+ "doi" => "https://doi.org/10.1016/j.plaphy.2013.11.002",
113
+ "firstPage" => "141",
114
+ "key" => "ref1",
115
+ "publicationYear" => "2014",
116
+ "title" => "Perturbation of polyamine catabolism affects grape ripening of Vitis vinifera cv. Trincadeira",
117
+ "volume" => "74")
118
+ expect(subject.references.last).to eq("containerTitle" => "Acta Hortic.",
119
+ "contributor" => "Zheng",
120
+ "doi" => "https://doi.org/10.17660/actahortic.2004.632.41",
121
+ "firstPage" => "317",
122
+ "key" => "ref70",
123
+ "publicationYear" => "2004",
124
+ "title" => "Effects of polyamines and salicylic acid on postharvest storage of “Ponkan” mandarin",
125
+ "volume" => "632")
126
+ expect(subject.container).to eq("identifier" => "1664-462X",
127
+ "identifierType" => "ISSN", "title" => "Frontiers in Plant Science", "type" => "Journal", "volume" => "10")
128
+ expect(subject.provider).to eq("Crossref")
129
+ end
130
+
131
+ it "journal article original language title" do
132
+ input = "https://doi.org/10.7600/jspfsm.56.60"
133
133
  subject = described_class.new(input: input)
134
134
  expect(subject.valid?).to be false
135
- expect(subject.errors).to eq(["property '/creators' is invalid: error_type=minItems"])
136
- expect(subject.id).to eq('https://doi.org/10.7600/jspfsm.56.60')
137
- expect(subject.url).to eq('https://www.jstage.jst.go.jp/article/jspfsm/56/1/56_1_60/_article/-char/ja')
138
- expect(subject.type).to eq('JournalArticle')
139
- expect(subject.creators.empty?).to be true
140
- expect(subject.titles).to eq([{ 'title' => ':(unav)' }])
141
- expect(subject.date).to include('published' => '2007', 'updated' => '2021-05-20')
135
+ expect(subject.errors).to eq(["property '/contributors' is invalid: error_type=minItems"])
136
+ expect(subject.id).to eq("https://doi.org/10.7600/jspfsm.56.60")
137
+ expect(subject.url).to eq("https://www.jstage.jst.go.jp/article/jspfsm/56/1/56_1_60/_article/-char/ja")
138
+ expect(subject.type).to eq("JournalArticle")
139
+ expect(subject.contributors.empty?).to be true
140
+ expect(subject.titles).to eq([{ "title" => ":(unav)" }])
141
+ expect(subject.date).to include("published" => "2007", "updated" => "2021-05-20")
142
142
  expect(subject.references.length).to eq(7)
143
- expect(subject.references.first).to eq('doi' => 'https://doi.org/10.1111/j.1469-7793.2000.00407.x',
144
- 'key' => '1')
145
- expect(subject.container).to eq('firstPage' => '60', 'identifier' => '1881-4751',
146
- 'identifierType' => 'ISSN', 'issue' => '1', 'lastPage' => '60', 'title' => 'Japanese Journal of Physical Fitness and Sports Medicine', 'type' => 'Journal', 'volume' => '56')
147
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/4426',
148
- 'name' => 'The Japanese Society of Physical Fitness and Sports Medicine')
149
- expect(subject.provider).to eq('Crossref')
150
- end
151
-
152
- it 'journal article with RDF for container' do
153
- input = 'https://doi.org/10.1163/1937240X-00002096'
154
- subject = described_class.new(input: input)
155
- expect(subject.valid?).to be true
156
- expect(subject.id).to eq('https://doi.org/10.1163/1937240x-00002096')
157
- expect(subject.url).to eq('https://academic.oup.com/jcb/article-lookup/doi/10.1163/1937240X-00002096')
158
- expect(subject.type).to eq('JournalArticle')
159
- expect(subject.creators.length).to eq(8)
160
- expect(subject.creators.first).to eq('familyName' => 'Escrivà',
161
- 'givenName' => 'Andreu', 'type' => 'Person')
162
- expect(subject.titles).to eq([{ 'title' => 'Global distribution of Fabaeformiscandona subacuta: an exotic invasive Ostracoda on the Iberian Peninsula?' }])
163
- expect(subject.date).to include('published' => '2012-01-01')
164
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/286',
165
- 'name' => 'Oxford University Press (OUP)')
143
+ expect(subject.references.first).to eq("doi" => "https://doi.org/10.1111/j.1469-7793.2000.00407.x",
144
+ "key" => "1")
145
+ expect(subject.container).to eq("firstPage" => "60", "identifier" => "1881-4751",
146
+ "identifierType" => "ISSN", "issue" => "1", "lastPage" => "60", "title" => "Japanese Journal of Physical Fitness and Sports Medicine", "type" => "Journal", "volume" => "56")
147
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/4426",
148
+ "name" => "The Japanese Society of Physical Fitness and Sports Medicine")
149
+ expect(subject.provider).to eq("Crossref")
150
+ end
151
+
152
+ it "journal article with RDF for container" do
153
+ input = "https://doi.org/10.1163/1937240X-00002096"
154
+ subject = described_class.new(input: input)
155
+ expect(subject.valid?).to be true
156
+ expect(subject.id).to eq("https://doi.org/10.1163/1937240x-00002096")
157
+ expect(subject.url).to eq("https://academic.oup.com/jcb/article-lookup/doi/10.1163/1937240X-00002096")
158
+ expect(subject.type).to eq("JournalArticle")
159
+ expect(subject.contributors.length).to eq(8)
160
+ expect(subject.contributors.first).to eq("familyName" => "Escrivà",
161
+ "givenName" => "Andreu", "type" => "Person", "contributorRoles" => ["Author"])
162
+ expect(subject.titles).to eq([{ "title" => "Global distribution of Fabaeformiscandona subacuta: an exotic invasive Ostracoda on the Iberian Peninsula?" }])
163
+ expect(subject.date).to include("published" => "2012-01-01")
164
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/286",
165
+ "name" => "Oxford University Press (OUP)")
166
166
  expect(subject.references.length).to eq(111)
167
- expect(subject.references.first).to eq('containerTitle' => 'Rozpravy Ceskoslovenske Akademie Ved, Rada Matematickych A Prirodnich Ved',
168
- 'creator' => 'Absolon',
169
- 'firstPage' => '1',
170
- 'issue' => '5',
171
- 'key' => 'bibr1',
172
- 'publicationYear' => '1978',
173
- 'title' => 'Die Gattung Candonaim Quartar von Europa',
174
- 'volume' => '88')
175
- expect(subject.container).to eq('firstPage' => '949', 'identifier' => '1937-240X',
176
- 'identifierType' => 'ISSN', 'issue' => '6', 'lastPage' => '961', 'title' => 'Journal of Crustacean Biology', 'type' => 'Journal', 'volume' => '32')
177
- expect(subject.provider).to eq('Crossref')
178
- end
179
-
180
- it 'book chapter with RDF for container' do
181
- input = 'https://doi.org/10.1007/978-3-642-33191-6_49'
182
- subject = described_class.new(input: input)
183
- expect(subject.valid?).to be true
184
- expect(subject.id).to eq('https://doi.org/10.1007/978-3-642-33191-6_49')
185
- expect(subject.url).to eq('http://link.springer.com/10.1007/978-3-642-33191-6_49')
186
- expect(subject.type).to eq('BookChapter')
187
- expect(subject.creators.length).to eq(3)
188
- expect(subject.creators.first).to eq('familyName' => 'Chen', 'givenName' => 'Lili',
189
- 'type' => 'Person')
190
- expect(subject.titles).to eq([{ 'title' => 'Human Body Orientation Estimation in Multiview Scenarios' }])
191
- expect(subject.date).to eq('published' => '2012', 'updated' => '2020-11-24')
192
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/297',
193
- 'name' => 'Springer Science and Business Media LLC')
167
+ expect(subject.references.first).to eq("containerTitle" => "Rozpravy Ceskoslovenske Akademie Ved, Rada Matematickych A Prirodnich Ved",
168
+ "contributor" => "Absolon",
169
+ "firstPage" => "1",
170
+ "issue" => "5",
171
+ "key" => "bibr1",
172
+ "publicationYear" => "1978",
173
+ "title" => "Die Gattung Candonaim Quartar von Europa",
174
+ "volume" => "88")
175
+ expect(subject.container).to eq("firstPage" => "949", "identifier" => "1937-240X",
176
+ "identifierType" => "ISSN", "issue" => "6", "lastPage" => "961", "title" => "Journal of Crustacean Biology", "type" => "Journal", "volume" => "32")
177
+ expect(subject.provider).to eq("Crossref")
178
+ end
179
+
180
+ it "book chapter with RDF for container" do
181
+ input = "https://doi.org/10.1007/978-3-642-33191-6_49"
182
+ subject = described_class.new(input: input)
183
+ expect(subject.valid?).to be true
184
+ expect(subject.id).to eq("https://doi.org/10.1007/978-3-642-33191-6_49")
185
+ expect(subject.url).to eq("http://link.springer.com/10.1007/978-3-642-33191-6_49")
186
+ expect(subject.type).to eq("BookChapter")
187
+ expect(subject.contributors.length).to eq(3)
188
+ expect(subject.contributors.first).to eq("familyName" => "Chen", "givenName" => "Lili",
189
+ "type" => "Person", "contributorRoles" => ["Author"])
190
+ expect(subject.titles).to eq([{ "title" => "Human Body Orientation Estimation in Multiview Scenarios" }])
191
+ expect(subject.date).to eq("published" => "2012", "updated" => "2020-11-24")
192
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/297",
193
+ "name" => "Springer Science and Business Media LLC")
194
194
  expect(subject.references.length).to eq(11)
195
- expect(subject.references.first).to eq('key' => '49_CR1',
196
- 'unstructured' => 'Khan, S., Javed, O., Rasheed, Z., Shah, M.: Human tracking in multiple cameras. In: Proceedings of the 8th IEEE International Conference on Computer Vision, Vancouver, Canada, pp. 331–336 (2001)')
197
- expect(subject.container).to eq('identifier' => '1611-3349', 'identifierType' => 'ISSN',
198
- 'title' => 'Advances in Visual Computing', 'type' => 'Book', 'firstPage' => '499', 'lastPage' => '508')
199
- expect(subject.provider).to eq('Crossref')
200
- end
201
-
202
- it 'posted_content' do
203
- input = 'https://doi.org/10.1101/097196'
204
- subject = described_class.new(input: input)
205
- expect(subject.valid?).to be true
206
- expect(subject.url).to eq('http://biorxiv.org/lookup/doi/10.1101/097196')
207
- expect(subject.type).to eq('Article')
208
- expect(subject.creators.count).to eq(11)
209
- expect(subject.creators.last).to eq('id' => 'https://orcid.org/0000-0003-4060-7360',
210
- 'givenName' => 'Timothy', 'familyName' => 'Clark', 'type' => 'Person')
211
- expect(subject.titles).to eq([{ 'title' => 'A Data Citation Roadmap for Scholarly Data Repositories' }])
212
- expect(subject.id).to eq('https://doi.org/10.1101/097196')
213
- expect(subject.descriptions.first['description']).to start_with('AbstractThis article presents a practical roadmap')
214
- expect(subject.date).to eq('published' => '2016-12-28', 'updated' => '2020-01-18')
215
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/246',
216
- 'name' => 'Cold Spring Harbor Laboratory')
195
+ expect(subject.references.first).to eq("key" => "49_CR1",
196
+ "unstructured" => "Khan, S., Javed, O., Rasheed, Z., Shah, M.: Human tracking in multiple cameras. In: Proceedings of the 8th IEEE International Conference on Computer Vision, Vancouver, Canada, pp. 331–336 (2001)")
197
+ expect(subject.container).to eq("identifier" => "1611-3349", "identifierType" => "ISSN",
198
+ "title" => "Advances in Visual Computing", "type" => "Book", "firstPage" => "499", "lastPage" => "508")
199
+ expect(subject.provider).to eq("Crossref")
200
+ end
201
+
202
+ it "posted_content" do
203
+ input = "https://doi.org/10.1101/097196"
204
+ subject = described_class.new(input: input)
205
+ expect(subject.valid?).to be true
206
+ expect(subject.url).to eq("http://biorxiv.org/lookup/doi/10.1101/097196")
207
+ expect(subject.type).to eq("Article")
208
+ expect(subject.contributors.count).to eq(11)
209
+ expect(subject.contributors.last).to eq("id" => "https://orcid.org/0000-0003-4060-7360",
210
+ "givenName" => "Timothy", "familyName" => "Clark", "type" => "Person", "contributorRoles" => ["Author"])
211
+ expect(subject.titles).to eq([{ "title" => "A Data Citation Roadmap for Scholarly Data Repositories" }])
212
+ expect(subject.id).to eq("https://doi.org/10.1101/097196")
213
+ expect(subject.descriptions.first["description"]).to start_with("AbstractThis article presents a practical roadmap")
214
+ expect(subject.date).to eq("published" => "2016-12-28", "updated" => "2020-01-18")
215
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/246",
216
+ "name" => "Cold Spring Harbor Laboratory")
217
217
  expect(subject.container.empty?).to be(true)
218
- expect(subject.provider).to eq('Crossref')
218
+ expect(subject.provider).to eq("Crossref")
219
219
  end
220
220
 
221
- it 'peer review' do
222
- input = '10.7554/elife.55167.sa2'
221
+ it "peer review" do
222
+ input = "10.7554/elife.55167.sa2"
223
223
  subject = described_class.new(input: input)
224
224
  expect(subject.valid?).to be true
225
- expect(subject.url).to eq('https://elifesciences.org/articles/55167')
226
- expect(subject.type).to eq('PeerReview')
227
- expect(subject.creators.count).to eq(8)
228
- expect(subject.creators.last).to eq('type' => 'Person', 'affiliation' => [{ 'name' => 'Center for Computational Mathematics, Flatiron Institute, New York, United States' }],
229
- 'familyName' => 'Barnett',
230
- 'givenName' => 'Alex H')
231
- expect(subject.titles).to eq([{ 'title' => 'Author response: SpikeForest, reproducible web-facing ground-truth validation of automated neural spike sorters' }])
232
- expect(subject.id).to eq('https://doi.org/10.7554/elife.55167.sa2')
225
+ expect(subject.url).to eq("https://elifesciences.org/articles/55167")
226
+ expect(subject.type).to eq("PeerReview")
227
+ expect(subject.contributors.count).to eq(8)
228
+ expect(subject.contributors.last).to eq("type" => "Person", "contributorRoles" => ["Author"], "affiliation" => [{ "name" => "Center for Computational Mathematics, Flatiron Institute, New York, United States" }],
229
+ "familyName" => "Barnett",
230
+ "givenName" => "Alex H")
231
+ expect(subject.titles).to eq([{ "title" => "Author response: SpikeForest, reproducible web-facing ground-truth validation of automated neural spike sorters" }])
232
+ expect(subject.id).to eq("https://doi.org/10.7554/elife.55167.sa2")
233
233
  expect(subject.alternate_identifiers.empty?).to be(true)
234
234
  expect(subject.descriptions.empty?).to be(true)
235
- expect(subject.date).to eq('published' => '2020-04-29', 'updated' => '2020-05-19')
236
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/4374',
237
- 'name' => 'eLife Sciences Publications, Ltd')
238
- expect(subject.provider).to eq('Crossref')
235
+ expect(subject.date).to eq("published" => "2020-04-29", "updated" => "2020-05-19")
236
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/4374",
237
+ "name" => "eLife Sciences Publications, Ltd")
238
+ expect(subject.provider).to eq("Crossref")
239
239
  end
240
240
 
241
- it 'dissertation' do
242
- input = '10.14264/uql.2020.791'
241
+ it "dissertation" do
242
+ input = "10.14264/uql.2020.791"
243
243
  subject = described_class.new(input: input)
244
244
  expect(subject.valid?).to be true
245
- expect(subject.url).to eq('http://espace.library.uq.edu.au/view/UQ:23a1e74')
246
- expect(subject.type).to eq('Dissertation')
247
- expect(subject.creators).to eq([{ 'familyName' => 'Collingwood',
248
- 'givenName' => 'Patricia Maree',
249
- 'id' => 'https://orcid.org/0000-0003-3086-4443',
250
- 'type' => 'Person' }])
251
- expect(subject.titles).to eq([{ 'title' => 'School truancy and financial independence during emerging adulthood: a longitudinal analysis of receipt of and reliance on cash transfers' }])
252
- expect(subject.id).to eq('https://doi.org/10.14264/uql.2020.791')
245
+ expect(subject.url).to eq("http://espace.library.uq.edu.au/view/UQ:23a1e74")
246
+ expect(subject.type).to eq("Dissertation")
247
+ expect(subject.contributors).to eq([{ "familyName" => "Collingwood",
248
+ "givenName" => "Patricia Maree",
249
+ "id" => "https://orcid.org/0000-0003-3086-4443",
250
+ "type" => "Person", "contributorRoles" => ["Author"] }])
251
+ expect(subject.titles).to eq([{ "title" => "School truancy and financial independence during emerging adulthood: a longitudinal analysis of receipt of and reliance on cash transfers" }])
252
+ expect(subject.id).to eq("https://doi.org/10.14264/uql.2020.791")
253
253
  expect(subject.alternate_identifiers.empty?).to be(true)
254
254
  expect(subject.descriptions.empty?).to be(true)
255
- expect(subject.date).to eq('published' => '2020-06-08', 'updated' => '2020-06-08')
256
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/5387',
257
- 'name' => 'University of Queensland Library')
258
- expect(subject.provider).to eq('Crossref')
259
- end
260
-
261
- it 'DOI with SICI DOI' do
262
- input = '10.1890/0012-9658(2006)87[2832:tiopma]2.0.co;2'
263
- subject = described_class.new(input: input)
264
- expect(subject.valid?).to be true
265
- expect(subject.id).to eq('https://doi.org/10.1890/0012-9658(2006)87%255b2832:tiopma%255d2.0.co;2')
266
- expect(subject.url).to eq('http://doi.wiley.com/10.1890/0012-9658(2006)87%5B2832:TIOPMA%5D2.0.CO;2')
267
- expect(subject.type).to eq('JournalArticle')
268
- expect(subject.creators).to eq([
269
- { 'familyName' => 'Fenton', 'givenName' => 'A.',
270
- 'type' => 'Person' }, { 'familyName' => 'Rands', 'givenName' => 'S. A.', 'type' => 'Person' }
271
- ])
272
- expect(subject.license).to eq('url' => 'http://doi.wiley.com/10.1002/tdm_license_1.1')
273
- expect(subject.titles).to eq([{ 'title' => 'THE IMPACT OF PARASITE MANIPULATION AND PREDATOR FORAGING BEHAVIOR ON PREDATOR–PREY COMMUNITIES' }])
274
- expect(subject.date).to eq('published' => '2006-11', 'updated' => '2019-04-28')
275
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/311',
276
- 'name' => 'Wiley')
255
+ expect(subject.date).to eq("published" => "2020-06-08", "updated" => "2020-06-08")
256
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/5387",
257
+ "name" => "University of Queensland Library")
258
+ expect(subject.provider).to eq("Crossref")
259
+ end
260
+
261
+ it "DOI with SICI DOI" do
262
+ input = "10.1890/0012-9658(2006)87[2832:tiopma]2.0.co;2"
263
+ subject = described_class.new(input: input)
264
+ expect(subject.valid?).to be true
265
+ expect(subject.id).to eq("https://doi.org/10.1890/0012-9658(2006)87%255b2832:tiopma%255d2.0.co;2")
266
+ expect(subject.url).to eq("http://doi.wiley.com/10.1890/0012-9658(2006)87%5B2832:TIOPMA%5D2.0.CO;2")
267
+ expect(subject.type).to eq("JournalArticle")
268
+ expect(subject.contributors).to eq([
269
+ { "familyName" => "Fenton", "givenName" => "A.",
270
+ "type" => "Person", "contributorRoles" => ["Author"] }, { "familyName" => "Rands", "givenName" => "S. A.", "type" => "Person", "contributorRoles" => ["Author"] },
271
+ ])
272
+ expect(subject.license).to eq("url" => "http://doi.wiley.com/10.1002/tdm_license_1.1")
273
+ expect(subject.titles).to eq([{ "title" => "THE IMPACT OF PARASITE MANIPULATION AND PREDATOR FORAGING BEHAVIOR ON PREDATOR–PREY COMMUNITIES" }])
274
+ expect(subject.date).to eq("published" => "2006-11", "updated" => "2019-04-28")
275
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/311",
276
+ "name" => "Wiley")
277
277
  expect(subject.references.length).to eq(39)
278
- expect(subject.references.last).to eq('key' => 'i0012-9658-87-11-2832-ydenberg1',
279
- 'unstructured' => 'R. C. Ydenberg, 1998 .Behavioral decisions about foraging and predator avoidance .Pages343 -378inR. Dukas, editorCognitive ecology: the evolutionary ecology of information processing and decision making University of Chicago Press, Chicago, Illinois, USA.')
280
- expect(subject.container).to eq('firstPage' => '2832', 'identifier' => '0012-9658',
281
- 'identifierType' => 'ISSN', 'issue' => '11', 'lastPage' => '2841', 'title' => 'Ecology', 'type' => 'Journal', 'volume' => '87')
282
- expect(subject.provider).to eq('Crossref')
283
- end
284
-
285
- it 'DOI with ORCID ID' do
286
- input = 'https://doi.org/10.1155/2012/291294'
287
- subject = described_class.new(input: input)
288
- expect(subject.valid?).to be true
289
- expect(subject.id).to eq('https://doi.org/10.1155/2012/291294')
290
- expect(subject.url).to eq('http://www.hindawi.com/journals/pm/2012/291294')
291
- expect(subject.type).to eq('JournalArticle')
292
- expect(subject.creators.length).to eq(7)
293
- expect(subject.creators[2]).to eq('type' => 'Person',
294
- 'id' => 'https://orcid.org/0000-0003-2043-4925',
295
- 'givenName' => 'Beatriz', 'familyName' => 'Hernandez', 'affiliation' => [{ 'name' => 'War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA' }, { 'name' => 'Department of Psychiatry and Behavioral Sciences, Stanford University School of Medicine, Stanford, CA 94304, USA' }])
296
- expect(subject.license).to eq('id' => 'CC-BY-3.0',
297
- 'url' => 'https://creativecommons.org/licenses/by/3.0/legalcode')
298
- expect(subject.titles).to eq([{ 'title' => 'Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers' }])
299
- expect(subject.date).to include('published' => '2012')
300
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/98',
301
- 'name' => 'Hindawi Limited')
278
+ expect(subject.references.last).to eq("key" => "i0012-9658-87-11-2832-ydenberg1",
279
+ "unstructured" => "R. C. Ydenberg, 1998 .Behavioral decisions about foraging and predator avoidance .Pages343 -378inR. Dukas, editorCognitive ecology: the evolutionary ecology of information processing and decision making University of Chicago Press, Chicago, Illinois, USA.")
280
+ expect(subject.container).to eq("firstPage" => "2832", "identifier" => "0012-9658",
281
+ "identifierType" => "ISSN", "issue" => "11", "lastPage" => "2841", "title" => "Ecology", "type" => "Journal", "volume" => "87")
282
+ expect(subject.provider).to eq("Crossref")
283
+ end
284
+
285
+ it "DOI with ORCID ID" do
286
+ input = "https://doi.org/10.1155/2012/291294"
287
+ subject = described_class.new(input: input)
288
+ expect(subject.valid?).to be true
289
+ expect(subject.id).to eq("https://doi.org/10.1155/2012/291294")
290
+ expect(subject.url).to eq("http://www.hindawi.com/journals/pm/2012/291294")
291
+ expect(subject.type).to eq("JournalArticle")
292
+ expect(subject.contributors.length).to eq(7)
293
+ expect(subject.contributors[2]).to eq("type" => "Person",
294
+ "id" => "https://orcid.org/0000-0003-2043-4925", "contributorRoles" => ["Author"],
295
+ "givenName" => "Beatriz", "familyName" => "Hernandez", "affiliation" => [{ "name" => "War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA" }, { "name" => "Department of Psychiatry and Behavioral Sciences, Stanford University School of Medicine, Stanford, CA 94304, USA" }])
296
+ expect(subject.license).to eq("id" => "CC-BY-3.0",
297
+ "url" => "https://creativecommons.org/licenses/by/3.0/legalcode")
298
+ expect(subject.titles).to eq([{ "title" => "Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers" }])
299
+ expect(subject.date).to include("published" => "2012")
300
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/98",
301
+ "name" => "Hindawi Limited")
302
302
  expect(subject.references.length).to eq(27)
303
- expect(subject.references.last).to eq('doi' => 'https://doi.org/10.1378/chest.12-0045',
304
- 'key' => '30')
305
- expect(subject.container).to eq('firstPage' => '1', 'identifier' => '2090-1844',
306
- 'identifierType' => 'ISSN', 'lastPage' => '7', 'title' => 'Pulmonary Medicine', 'type' => 'Journal', 'volume' => '2012')
307
- expect(subject.provider).to eq('Crossref')
308
- end
309
-
310
- it 'date in future' do
311
- input = 'https://doi.org/10.1016/j.ejphar.2015.03.018'
312
- subject = described_class.new(input: input)
313
- expect(subject.valid?).to be true
314
- expect(subject.id).to eq('https://doi.org/10.1016/j.ejphar.2015.03.018')
315
- expect(subject.url).to eq('https://linkinghub.elsevier.com/retrieve/pii/S0014299915002332')
316
- expect(subject.type).to eq('JournalArticle')
317
- expect(subject.creators.length).to eq(10)
318
- expect(subject.creators.first).to eq('type' => 'Person',
319
- 'givenName' => 'Sarah E.', 'familyName' => 'Beck')
320
- expect(subject.titles).to eq([{ 'title' => 'Paving the path to HIV neurotherapy: Predicting SIV CNS disease' }])
321
- expect(subject.date).to include('published' => '2015-07')
322
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/78',
323
- 'name' => 'Elsevier BV')
303
+ expect(subject.references.last).to eq("doi" => "https://doi.org/10.1378/chest.12-0045",
304
+ "key" => "30")
305
+ expect(subject.files).to eq([{ "mimeType" => "application/pdf",
306
+ "url" => "http://downloads.hindawi.com/journals/pm/2012/291294.pdf" },
307
+ { "mimeType" => "application/xml",
308
+ "url" => "http://downloads.hindawi.com/journals/pm/2012/291294.xml" }])
309
+ expect(subject.container).to eq("firstPage" => "1", "identifier" => "2090-1844",
310
+ "identifierType" => "ISSN", "lastPage" => "7", "title" => "Pulmonary Medicine", "type" => "Journal", "volume" => "2012")
311
+ expect(subject.provider).to eq("Crossref")
312
+ end
313
+
314
+ it "date in future" do
315
+ input = "https://doi.org/10.1016/j.ejphar.2015.03.018"
316
+ subject = described_class.new(input: input)
317
+ expect(subject.valid?).to be true
318
+ expect(subject.id).to eq("https://doi.org/10.1016/j.ejphar.2015.03.018")
319
+ expect(subject.url).to eq("https://linkinghub.elsevier.com/retrieve/pii/S0014299915002332")
320
+ expect(subject.type).to eq("JournalArticle")
321
+ expect(subject.contributors.length).to eq(10)
322
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"],
323
+ "givenName" => "Sarah E.", "familyName" => "Beck")
324
+ expect(subject.titles).to eq([{ "title" => "Paving the path to HIV neurotherapy: Predicting SIV CNS disease" }])
325
+ expect(subject.date).to include("published" => "2015-07")
326
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/78",
327
+ "name" => "Elsevier BV")
324
328
  expect(subject.references.length).to eq(98)
325
- expect(subject.references.first).to eq('containerTitle' => 'J. Immunol',
326
- 'creator' => 'Allen',
327
- 'firstPage' => '6062',
328
- 'key' => '10.1016/j.ejphar.2015.03.018_bib1',
329
- 'publicationYear' => '1998',
330
- 'title' => 'Characterization of the peptide binding motif of a rhesus MHC class I molecule (Mamu-A*01) that binds an immunodominant CTL epitope from simianimmunodeficiency virus.',
331
- 'volume' => '160')
332
- expect(subject.container).to eq('firstPage' => '303', 'identifier' => '0014-2999',
333
- 'identifierType' => 'ISSN', 'lastPage' => '312', 'title' => 'European Journal of Pharmacology', 'type' => 'Journal', 'volume' => '759')
334
- expect(subject.provider).to eq('Crossref')
335
- end
336
-
337
- it 'vor with url' do
338
- input = 'https://doi.org/10.1038/hdy.2013.26'
339
- subject = described_class.new(input: input)
340
- expect(subject.valid?).to be true
341
- expect(subject.id).to eq('https://doi.org/10.1038/hdy.2013.26')
342
- expect(subject.url).to eq('https://www.nature.com/articles/hdy201326')
343
- expect(subject.type).to eq('JournalArticle')
344
- expect(subject.creators.length).to eq(2)
345
- expect(subject.creators.first).to eq('type' => 'Person', 'familyName' => 'Gross',
346
- 'givenName' => 'J B')
347
- expect(subject.titles).to eq([{ 'title' => 'Albinism in phylogenetically and geographically distinct populations of Astyanax cavefish arises through the same loss-of-function Oca2 allele' }])
348
- expect(subject.date).to include('published' => '2013-04-10')
349
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/297',
350
- 'name' => 'Springer Science and Business Media LLC')
329
+ expect(subject.references.first).to eq("containerTitle" => "J. Immunol",
330
+ "contributor" => "Allen",
331
+ "firstPage" => "6062",
332
+ "key" => "10.1016/j.ejphar.2015.03.018_bib1",
333
+ "publicationYear" => "1998",
334
+ "title" => "Characterization of the peptide binding motif of a rhesus MHC class I molecule (Mamu-A*01) that binds an immunodominant CTL epitope from simianimmunodeficiency virus.",
335
+ "volume" => "160")
336
+ expect(subject.files).to eq([{ "mimeType" => "text/xml",
337
+ "url" => "https://api.elsevier.com/content/article/PII:S0014299915002332?httpAccept=text/xml" },
338
+ { "mimeType" => "text/plain",
339
+ "url" => "https://api.elsevier.com/content/article/PII:S0014299915002332?httpAccept=text/plain" }])
340
+ expect(subject.container).to eq("firstPage" => "303", "identifier" => "0014-2999",
341
+ "identifierType" => "ISSN", "lastPage" => "312", "title" => "European Journal of Pharmacology", "type" => "Journal", "volume" => "759")
342
+ expect(subject.provider).to eq("Crossref")
343
+ end
344
+
345
+ it "vor with url" do
346
+ input = "https://doi.org/10.1038/hdy.2013.26"
347
+ subject = described_class.new(input: input)
348
+ expect(subject.valid?).to be true
349
+ expect(subject.id).to eq("https://doi.org/10.1038/hdy.2013.26")
350
+ expect(subject.url).to eq("https://www.nature.com/articles/hdy201326")
351
+ expect(subject.type).to eq("JournalArticle")
352
+ expect(subject.contributors.length).to eq(2)
353
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"], "familyName" => "Gross",
354
+ "givenName" => "J B")
355
+ expect(subject.titles).to eq([{ "title" => "Albinism in phylogenetically and geographically distinct populations of Astyanax cavefish arises through the same loss-of-function Oca2 allele" }])
356
+ expect(subject.date).to include("published" => "2013-04-10")
357
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/297",
358
+ "name" => "Springer Science and Business Media LLC")
351
359
  expect(subject.references.size).to eq(41)
352
- expect(subject.references.first).to eq('containerTitle' => 'An Esc Nac Cien Biol México',
353
- 'creator' => 'J Alvarez',
354
- 'firstPage' => '263',
355
- 'key' => 'BFhdy201326_CR1',
356
- 'publicationYear' => '1946',
357
- 'unstructured' => 'Alvarez J . (1946). Revisión del género Anoptichthys con descipción de una especie nueva (Pisces, Characidae). An Esc Nac Cien Biol México 4: 263–282.',
358
- 'volume' => '4')
359
- expect(subject.container).to eq('firstPage' => '122', 'identifier' => '1365-2540',
360
- 'identifierType' => 'ISSN', 'issue' => '2', 'lastPage' => '130', 'title' => 'Heredity', 'type' => 'Journal', 'volume' => '111')
361
- expect(subject.provider).to eq('Crossref')
362
- end
363
-
364
- it 'dataset' do
365
- input = 'https://doi.org/10.2210/pdb4hhb/pdb'
366
- subject = described_class.new(input: input)
367
- expect(subject.valid?).to be true
368
- expect(subject.id).to eq('https://doi.org/10.2210/pdb4hhb/pdb')
369
- expect(subject.url).to eq('https://www.wwpdb.org/pdb?id=pdb_00004hhb')
370
- expect(subject.type).to eq('Component')
371
- expect(subject.creators.length).to eq(2)
372
- expect(subject.creators.first).to eq('type' => 'Person', 'givenName' => 'G.',
373
- 'familyName' => 'Fermi')
374
- expect(subject.titles).to eq([{ 'title' => 'THE CRYSTAL STRUCTURE OF HUMAN DEOXYHAEMOGLOBIN AT 1.74 ANGSTROMS RESOLUTION' }])
360
+ expect(subject.references.first).to eq("containerTitle" => "An Esc Nac Cien Biol México",
361
+ "contributor" => "J Alvarez",
362
+ "firstPage" => "263",
363
+ "key" => "BFhdy201326_CR1",
364
+ "publicationYear" => "1946",
365
+ "unstructured" => "Alvarez J . (1946). Revisión del género Anoptichthys con descipción de una especie nueva (Pisces, Characidae). An Esc Nac Cien Biol México 4: 263–282.",
366
+ "volume" => "4")
367
+ expect(subject.files).to eq([{ "mimeType" => "application/pdf",
368
+ "url" => "http://www.nature.com/articles/hdy201326.pdf" },
369
+ { "mimeType" => "text/html", "url" => "http://www.nature.com/articles/hdy201326" },
370
+ { "mimeType" => "application/pdf",
371
+ "url" => "http://www.nature.com/articles/hdy201326.pdf" }])
372
+ expect(subject.container).to eq("firstPage" => "122", "identifier" => "1365-2540",
373
+ "identifierType" => "ISSN", "issue" => "2", "lastPage" => "130", "title" => "Heredity", "type" => "Journal", "volume" => "111")
374
+ expect(subject.provider).to eq("Crossref")
375
+ end
376
+
377
+ it "dataset" do
378
+ input = "https://doi.org/10.2210/pdb4hhb/pdb"
379
+ subject = described_class.new(input: input)
380
+ expect(subject.valid?).to be true
381
+ expect(subject.id).to eq("https://doi.org/10.2210/pdb4hhb/pdb")
382
+ expect(subject.url).to eq("https://www.wwpdb.org/pdb?id=pdb_00004hhb")
383
+ expect(subject.type).to eq("Component")
384
+ expect(subject.contributors.length).to eq(2)
385
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"], "givenName" => "G.",
386
+ "familyName" => "Fermi")
387
+ expect(subject.titles).to eq([{ "title" => "THE CRYSTAL STRUCTURE OF HUMAN DEOXYHAEMOGLOBIN AT 1.74 ANGSTROMS RESOLUTION" }])
375
388
  expect(subject.descriptions).to eq([])
376
- expect(subject.date).to include('published' => '1984-07-17')
377
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/7763',
378
- 'name' => 'Worldwide Protein Data Bank')
379
- expect(subject.provider).to eq('Crossref')
389
+ expect(subject.date).to include("published" => "1984-07-17")
390
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/7763",
391
+ "name" => "Worldwide Protein Data Bank")
392
+ expect(subject.provider).to eq("Crossref")
380
393
  end
381
394
 
382
- it 'component' do
383
- input = 'https://doi.org/10.1371/journal.pmed.0030277.g001'
395
+ it "component" do
396
+ input = "https://doi.org/10.1371/journal.pmed.0030277.g001"
384
397
  subject = described_class.new(input: input)
385
398
  expect(subject.valid?).to be false
386
- expect(subject.errors).to eq(["property '/creators' is invalid: error_type=minItems"])
387
- expect(subject.id).to eq('https://doi.org/10.1371/journal.pmed.0030277.g001')
388
- expect(subject.url).to eq('https://dx.plos.org/10.1371/journal.pmed.0030277.g001')
389
- expect(subject.type).to eq('Component')
390
- expect(subject.creators.empty?).to be true
391
- expect(subject.titles).to eq([{ 'title' => ':(unav)' }])
399
+ expect(subject.errors).to eq(["property '/contributors' is invalid: error_type=minItems"])
400
+ expect(subject.id).to eq("https://doi.org/10.1371/journal.pmed.0030277.g001")
401
+ expect(subject.url).to eq("https://dx.plos.org/10.1371/journal.pmed.0030277.g001")
402
+ expect(subject.type).to eq("Component")
403
+ expect(subject.contributors.empty?).to be true
404
+ expect(subject.titles).to eq([{ "title" => ":(unav)" }])
392
405
  expect(subject.descriptions.empty?).to be(true)
393
- expect(subject.date).to eq('published' => '2015-10-20', 'updated' => '2018-10-19')
394
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/340',
395
- 'name' => 'Public Library of Science (PLoS)')
396
- expect(subject.provider).to eq('Crossref')
406
+ expect(subject.date).to eq("published" => "2015-10-20", "updated" => "2018-10-19")
407
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/340",
408
+ "name" => "Public Library of Science (PLoS)")
409
+ expect(subject.provider).to eq("Crossref")
397
410
  end
398
411
 
399
- it 'dataset usda' do
400
- input = 'https://doi.org/10.2737/RDS-2018-0001'
412
+ it "dataset usda" do
413
+ input = "https://doi.org/10.2737/RDS-2018-0001"
401
414
  subject = described_class.new(input: input)
402
415
  expect(subject.valid?).to be true
403
- expect(subject.id).to eq('https://doi.org/10.2737/rds-2018-0001')
404
- expect(subject.url).to eq('https://www.fs.usda.gov/rds/archive/Catalog/RDS-2018-0001')
405
- expect(subject.type).to eq('Dataset')
406
- expect(subject.creators.length).to eq(4)
407
- expect(subject.creators.first).to eq('familyName' => 'Ribic', 'givenName' => 'Christine A.',
408
- 'affiliation' => [{ 'name' => 'U.S. Geological Survey' }],
409
- 'id' => 'https://orcid.org/0000-0003-2583-1778', 'type' => 'Person')
410
- expect(subject.titles).to eq([{ 'title' => 'Fledging times of grassland birds' }])
416
+ expect(subject.id).to eq("https://doi.org/10.2737/rds-2018-0001")
417
+ expect(subject.url).to eq("https://www.fs.usda.gov/rds/archive/Catalog/RDS-2018-0001")
418
+ expect(subject.type).to eq("Dataset")
419
+ expect(subject.contributors.length).to eq(4)
420
+ expect(subject.contributors.first).to eq("familyName" => "Ribic", "givenName" => "Christine A.",
421
+ "affiliation" => [{ "name" => "U.S. Geological Survey" }],
422
+ "id" => "https://orcid.org/0000-0003-2583-1778", "type" => "Person", "contributorRoles" => ["Author"])
423
+ expect(subject.titles).to eq([{ "title" => "Fledging times of grassland birds" }])
411
424
  expect(subject.descriptions.empty?).to be(true)
412
- expect(subject.date).to eq('published' => '2017-08-09', 'updated' => '2021-07-01')
413
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/1450',
414
- 'name' => 'USDA Forest Service')
415
- expect(subject.provider).to eq('Crossref')
416
- end
417
-
418
- it 'book chapter' do
419
- input = 'https://doi.org/10.1007/978-3-662-46370-3_13'
420
- subject = described_class.new(input: input)
421
- expect(subject.valid?).to be true
422
- expect(subject.id).to eq('https://doi.org/10.1007/978-3-662-46370-3_13')
423
- expect(subject.url).to eq('https://link.springer.com/10.1007/978-3-662-46370-3_13')
424
- expect(subject.type).to eq('BookChapter')
425
- expect(subject.creators.length).to eq(2)
426
- expect(subject.creators.first).to eq('type' => 'Person',
427
- 'givenName' => 'Ronald L.', 'familyName' => 'Diercks')
428
- expect(subject.titles).to eq([{ 'title' => 'Clinical Symptoms and Physical Examinations' }])
429
- expect(subject.date).to eq('published' => '2015', 'updated' => '2023-02-10')
430
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/297',
431
- 'name' => 'Springer Science and Business Media LLC')
432
- expect(subject.provider).to eq('Crossref')
433
- expect(subject.container['type']).to eq('Book')
434
- expect(subject.container['title']).to eq('Shoulder Stiffness')
435
- expect(subject.container['firstPage']).to eq('155')
436
- expect(subject.container['lastPage']).to eq('158')
437
- end
438
-
439
- it 'another book chapter' do
440
- input = 'https://doi.org/10.1007/978-3-319-75889-3_1'
441
- subject = described_class.new(input: input)
442
- expect(subject.valid?).to be true
443
- expect(subject.id).to eq('https://doi.org/10.1007/978-3-319-75889-3_1')
444
- expect(subject.url).to eq('http://link.springer.com/10.1007/978-3-319-75889-3_1')
445
- expect(subject.type).to eq('BookChapter')
446
- expect(subject.creators).to eq([{ 'familyName' => 'Jones', 'givenName' => 'Hunter M.',
447
- 'type' => 'Person' }])
448
- expect(subject.titles).to eq([{ 'title' => 'Climate Change and Increasing Risk of Extreme Heat' }])
449
- expect(subject.date).to include('published' => '2018')
450
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/297',
451
- 'name' => 'Springer Science and Business Media LLC')
452
- expect(subject.provider).to eq('Crossref')
453
- expect(subject.container['type']).to eq('Book')
454
- expect(subject.container['title']).to eq('SpringerBriefs in Medical Earth Sciences')
455
- expect(subject.container['identifier']).to eq('2523-3629')
456
- expect(subject.container['identifierType']).to eq('ISSN')
457
- end
458
-
459
- it 'yet another book chapter' do
460
- input = 'https://doi.org/10.4018/978-1-4666-1891-6.ch004'
461
- subject = described_class.new(input: input)
462
- expect(subject.valid?).to be true
463
- expect(subject.id).to eq('https://doi.org/10.4018/978-1-4666-1891-6.ch004')
464
- expect(subject.url).to eq('http://services.igi-global.com/resolvedoi/resolve.aspx?doi=10.4018%2F978-1-4666-1891-6.ch004')
465
- expect(subject.type).to eq('BookChapter')
466
- expect(subject.creators).to eq([{ 'type' => 'Person', 'affiliation' => [{ 'name' => 'Université de Lyon, France' }],
467
- 'familyName' => 'Bichot', 'givenName' => 'Charles-Edmond' }])
468
- expect(subject.titles).to eq([{ 'title' => 'Unsupervised and Supervised Image Segmentation Using Graph Partitioning' }])
469
- expect(subject.date).to eq('published' => '2012-08-08', 'updated' => '2019-07-02')
470
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/2432',
471
- 'name' => 'IGI Global')
472
- expect(subject.provider).to eq('Crossref')
473
- expect(subject.container['type']).to eq('Book')
474
- expect(subject.container['title']).to eq('Graph-Based Methods in Computer Vision')
475
- expect(subject.container['firstPage']).to eq('72')
476
- expect(subject.container['lastPage']).to eq('94')
477
- end
478
-
479
- it 'missing creator' do
480
- input = 'https://doi.org/10.3390/publications6020015'
481
- subject = described_class.new(input: input)
482
- expect(subject.valid?).to be true
483
- expect(subject.id).to eq('https://doi.org/10.3390/publications6020015')
484
- expect(subject.url).to eq('https://www.mdpi.com/2304-6775/6/2/15')
485
- expect(subject.type).to eq('JournalArticle')
486
- expect(subject.creators).to eq([{ 'familyName' => 'Kohls',
487
- 'givenName' => 'Alexander',
488
- 'id' => 'https://orcid.org/0000-0002-3836-8885',
489
- 'type' => 'Person' },
490
- { 'familyName' => 'Mele',
491
- 'givenName' => 'Salvatore',
492
-
493
- 'id' => 'https://orcid.org/0000-0003-0762-2235',
494
- 'type' => 'Person' }])
495
- expect(subject.titles).to eq([{ 'title' => 'Converting the Literature of a Scientific Field to Open Access through Global Collaboration: The Experience of SCOAP3 in Particle Physics' }])
496
- expect(subject.date).to eq('published' => '2018-04-09', 'updated' => '2021-07-22')
497
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/1968',
498
- 'name' => 'MDPI AG')
499
- expect(subject.provider).to eq('Crossref')
500
- end
501
-
502
- it 'book' do
503
- input = 'https://doi.org/10.1017/9781108348843'
504
- subject = described_class.new(input: input)
505
- expect(subject.valid?).to be true
506
- expect(subject.id).to eq('https://doi.org/10.1017/9781108348843')
507
- expect(subject.url).to eq('https://www.cambridge.org/core/product/identifier/9781108348843/type/book')
508
- expect(subject.type).to eq('Book')
509
- expect(subject.creators).to eq([{ 'type' => 'Person', 'familyName' => 'Leung',
510
- 'givenName' => 'Vincent S.' }])
511
- expect(subject.titles).to eq([{ 'title' => 'The Politics of the Past in Early China' }])
512
- expect(subject.date).to eq('published' => '2019-07-01', 'updated' => '2022-09-22')
513
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/56',
514
- 'name' => 'Cambridge University Press (CUP)')
515
- expect(subject.provider).to eq('Crossref')
516
- end
517
-
518
- it 'another book' do
519
- input = 'https://doi.org/10.2973/odp.proc.ir.180.2000'
520
- subject = described_class.new(input: input)
521
- expect(subject.valid?).to be false
522
- expect(subject.errors).to eq(["property '/creators' is invalid: error_type=minItems"])
523
- expect(subject.id).to eq('https://doi.org/10.2973/odp.proc.ir.180.2000')
524
- expect(subject.url).to eq('http://www-odp.tamu.edu/publications/180_IR/180TOC.HTM')
525
- expect(subject.type).to eq('Book')
526
- expect(subject.creators.empty?).to be true
425
+ expect(subject.date).to eq("published" => "2017-08-09", "updated" => "2021-07-01")
426
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/1450",
427
+ "name" => "USDA Forest Service")
428
+ expect(subject.provider).to eq("Crossref")
429
+ end
430
+
431
+ it "book chapter" do
432
+ input = "https://doi.org/10.1007/978-3-662-46370-3_13"
433
+ subject = described_class.new(input: input)
434
+ expect(subject.valid?).to be true
435
+ expect(subject.id).to eq("https://doi.org/10.1007/978-3-662-46370-3_13")
436
+ expect(subject.url).to eq("https://link.springer.com/10.1007/978-3-662-46370-3_13")
437
+ expect(subject.type).to eq("BookChapter")
438
+ expect(subject.contributors.length).to eq(2)
439
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"],
440
+ "givenName" => "Ronald L.", "familyName" => "Diercks")
441
+ expect(subject.titles).to eq([{ "title" => "Clinical Symptoms and Physical Examinations" }])
442
+ expect(subject.date).to eq("published" => "2015", "updated" => "2023-02-10")
443
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/297",
444
+ "name" => "Springer Science and Business Media LLC")
445
+ expect(subject.provider).to eq("Crossref")
446
+ expect(subject.container["type"]).to eq("Book")
447
+ expect(subject.container["title"]).to eq("Shoulder Stiffness")
448
+ expect(subject.container["firstPage"]).to eq("155")
449
+ expect(subject.container["lastPage"]).to eq("158")
450
+ end
451
+
452
+ it "another book chapter" do
453
+ input = "https://doi.org/10.1007/978-3-319-75889-3_1"
454
+ subject = described_class.new(input: input)
455
+ expect(subject.valid?).to be true
456
+ expect(subject.id).to eq("https://doi.org/10.1007/978-3-319-75889-3_1")
457
+ expect(subject.url).to eq("http://link.springer.com/10.1007/978-3-319-75889-3_1")
458
+ expect(subject.type).to eq("BookChapter")
459
+ expect(subject.contributors).to eq([{ "familyName" => "Jones", "givenName" => "Hunter M.",
460
+ "type" => "Person", "contributorRoles" => ["Author"] }])
461
+ expect(subject.titles).to eq([{ "title" => "Climate Change and Increasing Risk of Extreme Heat" }])
462
+ expect(subject.date).to include("published" => "2018")
463
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/297",
464
+ "name" => "Springer Science and Business Media LLC")
465
+ expect(subject.provider).to eq("Crossref")
466
+ expect(subject.container["type"]).to eq("Book")
467
+ expect(subject.container["title"]).to eq("SpringerBriefs in Medical Earth Sciences")
468
+ expect(subject.container["identifier"]).to eq("2523-3629")
469
+ expect(subject.container["identifierType"]).to eq("ISSN")
470
+ end
471
+
472
+ it "yet another book chapter" do
473
+ input = "https://doi.org/10.4018/978-1-4666-1891-6.ch004"
474
+ subject = described_class.new(input: input)
475
+ expect(subject.valid?).to be true
476
+ expect(subject.id).to eq("https://doi.org/10.4018/978-1-4666-1891-6.ch004")
477
+ expect(subject.url).to eq("http://services.igi-global.com/resolvedoi/resolve.aspx?doi=10.4018%2F978-1-4666-1891-6.ch004")
478
+ expect(subject.type).to eq("BookChapter")
479
+ expect(subject.contributors).to eq([{ "type" => "Person", "contributorRoles" => ["Author"], "affiliation" => [{ "name" => "Université de Lyon, France" }],
480
+ "familyName" => "Bichot", "givenName" => "Charles-Edmond" }])
481
+ expect(subject.titles).to eq([{ "title" => "Unsupervised and Supervised Image Segmentation Using Graph Partitioning" }])
482
+ expect(subject.date).to eq("published" => "2012-08-08", "updated" => "2019-07-02")
483
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/2432",
484
+ "name" => "IGI Global")
485
+ expect(subject.provider).to eq("Crossref")
486
+ expect(subject.container["type"]).to eq("Book")
487
+ expect(subject.container["title"]).to eq("Graph-Based Methods in Computer Vision")
488
+ expect(subject.container["firstPage"]).to eq("72")
489
+ expect(subject.container["lastPage"]).to eq("94")
490
+ end
491
+
492
+ it "missing contributor" do
493
+ input = "https://doi.org/10.3390/publications6020015"
494
+ subject = described_class.new(input: input)
495
+ expect(subject.valid?).to be true
496
+ expect(subject.id).to eq("https://doi.org/10.3390/publications6020015")
497
+ expect(subject.url).to eq("https://www.mdpi.com/2304-6775/6/2/15")
498
+ expect(subject.type).to eq("JournalArticle")
499
+ expect(subject.contributors).to eq([{ "familyName" => "Kohls",
500
+ "givenName" => "Alexander",
501
+ "id" => "https://orcid.org/0000-0002-3836-8885",
502
+ "type" => "Person", "contributorRoles" => ["Author"] },
503
+ { "familyName" => "Mele",
504
+ "givenName" => "Salvatore",
505
+
506
+ "id" => "https://orcid.org/0000-0003-0762-2235",
507
+ "type" => "Person", "contributorRoles" => ["Author"] }])
508
+ expect(subject.titles).to eq([{ "title" => "Converting the Literature of a Scientific Field to Open Access through Global Collaboration: The Experience of SCOAP3 in Particle Physics" }])
509
+ expect(subject.date).to eq("published" => "2018-04-09", "updated" => "2021-07-22")
510
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/1968",
511
+ "name" => "MDPI AG")
512
+ expect(subject.provider).to eq("Crossref")
513
+ end
514
+
515
+ it "book" do
516
+ input = "https://doi.org/10.1017/9781108348843"
517
+ subject = described_class.new(input: input)
518
+ expect(subject.valid?).to be true
519
+ expect(subject.id).to eq("https://doi.org/10.1017/9781108348843")
520
+ expect(subject.url).to eq("https://www.cambridge.org/core/product/identifier/9781108348843/type/book")
521
+ expect(subject.type).to eq("Book")
522
+ expect(subject.contributors).to eq([{ "type" => "Person", "contributorRoles" => ["Author"], "familyName" => "Leung",
523
+ "givenName" => "Vincent S." }])
524
+ expect(subject.titles).to eq([{ "title" => "The Politics of the Past in Early China" }])
525
+ expect(subject.date).to eq("published" => "2019-07-01", "updated" => "2022-09-22")
526
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/56",
527
+ "name" => "Cambridge University Press (CUP)")
528
+ expect(subject.provider).to eq("Crossref")
529
+ end
530
+
531
+ it "another book" do
532
+ input = "https://doi.org/10.2973/odp.proc.ir.180.2000"
533
+ subject = described_class.new(input: input)
534
+ expect(subject.valid?).to be true
535
+ expect(subject.id).to eq("https://doi.org/10.2973/odp.proc.ir.180.2000")
536
+ expect(subject.url).to eq("http://www-odp.tamu.edu/publications/180_IR/180TOC.HTM")
537
+ expect(subject.type).to eq("Book")
527
538
  expect(subject.contributors.size).to eq(4)
528
- expect(subject.contributors.first).to eq('type' => 'Person', 'contributorType' => 'Editor', 'familyName' => 'Taylor',
529
- 'givenName' => 'B.')
530
- expect(subject.titles).to eq([{ 'title' => 'Proceedings of the Ocean Drilling Program, 180 Initial Reports' }])
531
- expect(subject.date).to eq('published' => '2000-02-04', 'updated' => '2009-02-02')
532
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/1029',
533
- 'name' => 'International Ocean Discovery Program (IODP)')
534
- expect(subject.provider).to eq('Crossref')
535
- end
536
-
537
- it 'yet another book' do
538
- input = 'https://doi.org/10.1029/ar035'
539
- subject = described_class.new(input: input)
540
- expect(subject.valid?).to be true
541
- expect(subject.id).to eq('https://doi.org/10.1029/ar035')
542
- expect(subject.url).to eq('http://doi.wiley.com/10.1029/AR035')
543
- expect(subject.type).to eq('Book')
544
- expect(subject.creators).to eq([{ 'type' => 'Person', 'familyName' => 'McGinnis',
545
- 'givenName' => 'Richard Frank' }])
546
- expect(subject.titles).to eq([{ 'title' => 'Biogeography of Lanternfishes (Myctophidae) South of 30°S' }])
547
- expect(subject.date).to eq('published' => '1982', 'updated' => '2021-12-04')
548
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/311',
549
- 'name' => 'Wiley')
539
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Editor"], "familyName" => "Taylor",
540
+ "givenName" => "B.")
541
+ expect(subject.titles).to eq([{ "title" => "Proceedings of the Ocean Drilling Program, 180 Initial Reports" }])
542
+ expect(subject.date).to eq("published" => "2000-02-04", "updated" => "2009-02-02")
543
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/1029",
544
+ "name" => "International Ocean Discovery Program (IODP)")
545
+ expect(subject.provider).to eq("Crossref")
546
+ end
547
+
548
+ it "yet another book" do
549
+ input = "https://doi.org/10.1029/ar035"
550
+ subject = described_class.new(input: input)
551
+ expect(subject.valid?).to be true
552
+ expect(subject.id).to eq("https://doi.org/10.1029/ar035")
553
+ expect(subject.url).to eq("http://doi.wiley.com/10.1029/AR035")
554
+ expect(subject.type).to eq("Book")
555
+ expect(subject.contributors).to eq([{ "type" => "Person", "contributorRoles" => ["Author"], "familyName" => "McGinnis",
556
+ "givenName" => "Richard Frank" }])
557
+ expect(subject.titles).to eq([{ "title" => "Biogeography of Lanternfishes (Myctophidae) South of 30°S" }])
558
+ expect(subject.date).to eq("published" => "1982", "updated" => "2021-12-04")
559
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/311",
560
+ "name" => "Wiley")
550
561
  expect(subject.references.length).to eq(242)
551
- expect(subject.references.first).to eq('containerTitle' => 'Palaeogeogr. Palaeoclimatol. Palaeoecol.',
552
- 'creator' => 'Addicott',
553
- 'doi' => 'https://doi.org/10.1016/0031-0182(70)90103-3',
554
- 'firstPage' => '287',
555
- 'key' => '10.1029/AR035:addi70',
556
- 'publicationYear' => '1970',
557
- 'title' => 'Latitudinal gradients in tertiary mol-luscan faunas of the Pacific coast',
558
- 'volume' => '8')
559
- expect(subject.container).to eq('identifier' => '0066-4634', 'identifierType' => 'ISSN',
560
- 'title' => 'Antarctic Research Series', 'type' => 'BookSeries')
561
- expect(subject.provider).to eq('Crossref')
562
- end
563
-
564
- it 'mEDRA' do
565
- input = 'https://doi.org/10.3280/ecag2018-001005'
566
- subject = described_class.new(input: input)
567
- expect(subject.valid?).to be true
568
- expect(subject.id).to eq('https://doi.org/10.3280/ecag2018-001005')
569
- expect(subject.url).to eq('http://www.francoangeli.it/riviste/Scheda_Riviste.asp?IDArticolo=61645')
570
- expect(subject.type).to eq('JournalArticle')
571
- expect(subject.creators.length).to eq(2)
572
- expect(subject.creators.first).to eq('type' => 'Person', 'familyName' => 'Oh',
573
- 'givenName' => 'Sohae Eve')
574
- expect(subject.titles).to eq([{ 'title' => 'Substitutability between organic and conventional poultry products and organic price premiums' }])
575
- expect(subject.date).to include('published' => '2018-05')
576
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/4169',
577
- 'name' => 'Franco Angeli')
578
- expect(subject.provider).to eq('Crossref')
579
- end
580
-
581
- it 'KISTI' do
582
- input = 'https://doi.org/10.5012/bkcs.2013.34.10.2889'
583
- subject = described_class.new(input: input)
584
- expect(subject.valid?).to be true
585
- expect(subject.id).to eq('https://doi.org/10.5012/bkcs.2013.34.10.2889')
586
- expect(subject.url).to eq('http://koreascience.or.kr/journal/view.jsp?kj=JCGMCS&py=2013&vnc=v34n10&sp=2889')
587
- expect(subject.type).to eq('JournalArticle')
588
- expect(subject.creators.length).to eq(7)
589
- expect(subject.creators.first).to eq('type' => 'Person', 'familyName' => 'Huang',
590
- 'givenName' => 'Guimei')
591
- expect(subject.titles).to eq([{ 'title' => 'Synthesis, Crystal Structure and Theoretical Calculation of a Novel Nickel(II) Complex with Dibromotyrosine and 1,10-Phenanthroline' }])
592
- expect(subject.date).to eq('published' => '2013-10-20', 'updated' => '2016-12-15')
593
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/2923',
594
- 'name' => 'Korean Chemical Society')
595
- expect(subject.provider).to eq('KISTI')
596
- end
597
-
598
- it 'JaLC' do
599
- input = 'https://doi.org/10.1241/johokanri.39.979'
600
- subject = described_class.new(input: input)
601
- expect(subject.valid?).to be true
602
- expect(subject.id).to eq('https://doi.org/10.1241/johokanri.39.979')
603
- expect(subject.url).to eq('http://joi.jlc.jst.go.jp/JST.JSTAGE/johokanri/39.979?from=CrossRef')
604
- expect(subject.type).to eq('JournalArticle')
605
- expect(subject.creators).to eq([{ 'familyName' => 'KUSUMOTO', 'givenName' => 'Hiroyuki',
606
- 'type' => 'Person' }])
607
- expect(subject.titles).to eq([{ 'title' => 'Utilizing the Internet. 12 Series. Future of the Internet.' }])
608
- expect(subject.date).to eq('published' => '1997', 'updated' => '2020-03-06')
609
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/272',
610
- 'name' => 'Japan Science and Technology Agency (JST)')
611
- expect(subject.provider).to eq('JaLC')
612
- end
613
-
614
- it 'OP' do
615
- input = 'https://doi.org/10.2903/j.efsa.2018.5239'
616
- subject = described_class.new(input: input)
617
- expect(subject.valid?).to be true
618
- expect(subject.id).to eq('https://doi.org/10.2903/j.efsa.2018.5239')
619
- expect(subject.url).to eq('http://doi.wiley.com/10.2903/j.efsa.2018.5239')
620
- expect(subject.type).to eq('JournalArticle')
621
- expect(subject.creators.length).to eq(28)
622
- expect(subject.creators.first).to eq(
623
- 'name' => 'EFSA Panel on Food Additives and Nutrient Sources added to Food (ANS)', 'type' => 'Organization'
562
+ expect(subject.references.first).to eq("containerTitle" => "Palaeogeogr. Palaeoclimatol. Palaeoecol.",
563
+ "contributor" => "Addicott",
564
+ "doi" => "https://doi.org/10.1016/0031-0182(70)90103-3",
565
+ "firstPage" => "287",
566
+ "key" => "10.1029/AR035:addi70",
567
+ "publicationYear" => "1970",
568
+ "title" => "Latitudinal gradients in tertiary mol-luscan faunas of the Pacific coast",
569
+ "volume" => "8")
570
+ expect(subject.container).to eq("identifier" => "0066-4634", "identifierType" => "ISSN",
571
+ "title" => "Antarctic Research Series", "type" => "BookSeries")
572
+ expect(subject.provider).to eq("Crossref")
573
+ end
574
+
575
+ it "mEDRA" do
576
+ input = "https://doi.org/10.3280/ecag2018-001005"
577
+ subject = described_class.new(input: input)
578
+ expect(subject.valid?).to be true
579
+ expect(subject.id).to eq("https://doi.org/10.3280/ecag2018-001005")
580
+ expect(subject.url).to eq("http://www.francoangeli.it/riviste/Scheda_Riviste.asp?IDArticolo=61645")
581
+ expect(subject.type).to eq("JournalArticle")
582
+ expect(subject.contributors.length).to eq(2)
583
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"], "familyName" => "Oh",
584
+ "givenName" => "Sohae Eve")
585
+ expect(subject.titles).to eq([{ "title" => "Substitutability between organic and conventional poultry products and organic price premiums" }])
586
+ expect(subject.date).to include("published" => "2018-05")
587
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/4169",
588
+ "name" => "Franco Angeli")
589
+ expect(subject.provider).to eq("Crossref")
590
+ end
591
+
592
+ it "KISTI" do
593
+ input = "https://doi.org/10.5012/bkcs.2013.34.10.2889"
594
+ subject = described_class.new(input: input)
595
+ expect(subject.valid?).to be true
596
+ expect(subject.id).to eq("https://doi.org/10.5012/bkcs.2013.34.10.2889")
597
+ expect(subject.url).to eq("http://koreascience.or.kr/journal/view.jsp?kj=JCGMCS&py=2013&vnc=v34n10&sp=2889")
598
+ expect(subject.type).to eq("JournalArticle")
599
+ expect(subject.contributors.length).to eq(7)
600
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"], "familyName" => "Huang",
601
+ "givenName" => "Guimei")
602
+ expect(subject.titles).to eq([{ "title" => "Synthesis, Crystal Structure and Theoretical Calculation of a Novel Nickel(II) Complex with Dibromotyrosine and 1,10-Phenanthroline" }])
603
+ expect(subject.date).to eq("published" => "2013-10-20", "updated" => "2016-12-15")
604
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/2923",
605
+ "name" => "Korean Chemical Society")
606
+ expect(subject.provider).to eq("KISTI")
607
+ end
608
+
609
+ it "JaLC" do
610
+ input = "https://doi.org/10.1241/johokanri.39.979"
611
+ subject = described_class.new(input: input)
612
+ expect(subject.valid?).to be true
613
+ expect(subject.id).to eq("https://doi.org/10.1241/johokanri.39.979")
614
+ expect(subject.url).to eq("http://joi.jlc.jst.go.jp/JST.JSTAGE/johokanri/39.979?from=CrossRef")
615
+ expect(subject.type).to eq("JournalArticle")
616
+ expect(subject.contributors).to eq([{ "familyName" => "KUSUMOTO", "givenName" => "Hiroyuki",
617
+ "type" => "Person", "contributorRoles" => ["Author"] }])
618
+ expect(subject.titles).to eq([{ "title" => "Utilizing the Internet. 12 Series. Future of the Internet." }])
619
+ expect(subject.date).to eq("published" => "1997", "updated" => "2020-03-06")
620
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/272",
621
+ "name" => "Japan Science and Technology Agency (JST)")
622
+ expect(subject.provider).to eq("JaLC")
623
+ end
624
+
625
+ it "OP" do
626
+ input = "https://doi.org/10.2903/j.efsa.2018.5239"
627
+ subject = described_class.new(input: input)
628
+ expect(subject.valid?).to be true
629
+ expect(subject.id).to eq("https://doi.org/10.2903/j.efsa.2018.5239")
630
+ expect(subject.url).to eq("http://doi.wiley.com/10.2903/j.efsa.2018.5239")
631
+ expect(subject.type).to eq("JournalArticle")
632
+ expect(subject.contributors.length).to eq(28)
633
+ expect(subject.contributors.first).to eq(
634
+ "name" => "EFSA Panel on Food Additives and Nutrient Sources added to Food (ANS)", "type" => "Organization", "contributorRoles" => ["Author"],
624
635
  )
625
- expect(subject.titles).to eq([{ 'title' => 'Scientific opinion on the safety of green tea catechins' }])
626
- expect(subject.date).to include('published' => '2018-04')
627
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/311',
628
- 'name' => 'Wiley')
629
- expect(subject.provider).to eq('OP')
636
+ expect(subject.titles).to eq([{ "title" => "Scientific opinion on the safety of green tea catechins" }])
637
+ expect(subject.date).to include("published" => "2018-04")
638
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/311",
639
+ "name" => "Wiley")
640
+ expect(subject.provider).to eq("OP")
630
641
  end
631
642
 
632
- it 'multiple titles' do
633
- input = 'https://doi.org/10.4000/dms.865'
643
+ it "multiple titles" do
644
+ input = "https://doi.org/10.4000/dms.865"
634
645
  subject = described_class.new(input: input)
635
646
  expect(subject.valid?).to be true
636
- expect(subject.id).to eq('https://doi.org/10.4000/dms.865')
637
- expect(subject.url).to eq('http://journals.openedition.org/dms/865')
638
- expect(subject.type).to eq('JournalArticle')
639
- expect(subject.creators).to eq([{ 'familyName' => 'Peraya', 'givenName' => 'Daniel',
640
- 'type' => 'Person' }])
641
- expect(subject.titles).to eq([{ 'title' => 'Distance(s), proximity and presence(s): evolving concepts' }])
642
- expect(subject.date).to include('published' => '2014-12-14')
643
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/2399',
644
- 'name' => 'OpenEdition')
645
- expect(subject.provider).to eq('Crossref')
647
+ expect(subject.id).to eq("https://doi.org/10.4000/dms.865")
648
+ expect(subject.url).to eq("http://journals.openedition.org/dms/865")
649
+ expect(subject.type).to eq("JournalArticle")
650
+ expect(subject.contributors).to eq([{ "familyName" => "Peraya", "givenName" => "Daniel",
651
+ "type" => "Person", "contributorRoles" => ["Author"] }])
652
+ expect(subject.titles).to eq([{ "title" => "Distance(s), proximity and presence(s): evolving concepts" }])
653
+ expect(subject.date).to include("published" => "2014-12-14")
654
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/2399",
655
+ "name" => "OpenEdition")
656
+ expect(subject.provider).to eq("Crossref")
646
657
  end
647
658
 
648
- it 'multiple titles with missing' do
649
- input = 'https://doi.org/10.1186/1471-2164-7-187'
659
+ it "multiple titles with missing" do
660
+ input = "https://doi.org/10.1186/1471-2164-7-187"
650
661
  subject = described_class.new(input: input)
651
662
  expect(subject.valid?).to be true
652
- expect(subject.id).to eq('https://doi.org/10.1186/1471-2164-7-187')
653
- expect(subject.url).to eq('https://bmcgenomics.biomedcentral.com/articles/10.1186/1471-2164-7-187')
654
- expect(subject.type).to eq('JournalArticle')
655
- expect(subject.creators.size).to eq(5)
656
- expect(subject.creators.first).to eq('familyName' => 'Myers', 'givenName' => 'Chad L',
657
- 'type' => 'Person')
658
- expect(subject.titles).to eq([{ 'title' => 'Finding function: evaluation methods for functional genomic data' }])
659
- expect(subject.date).to include('published' => '2006-07-25')
660
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/297',
661
- 'name' => 'Springer Science and Business Media LLC')
662
- expect(subject.provider).to eq('Crossref')
663
+ expect(subject.id).to eq("https://doi.org/10.1186/1471-2164-7-187")
664
+ expect(subject.url).to eq("https://bmcgenomics.biomedcentral.com/articles/10.1186/1471-2164-7-187")
665
+ expect(subject.type).to eq("JournalArticle")
666
+ expect(subject.contributors.size).to eq(5)
667
+ expect(subject.contributors.first).to eq("familyName" => "Myers", "givenName" => "Chad L",
668
+ "type" => "Person", "contributorRoles" => ["Author"])
669
+ expect(subject.titles).to eq([{ "title" => "Finding function: evaluation methods for functional genomic data" }])
670
+ expect(subject.date).to include("published" => "2006-07-25")
671
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/297",
672
+ "name" => "Springer Science and Business Media LLC")
673
+ expect(subject.provider).to eq("Crossref")
663
674
  end
664
675
 
665
- it 'markup' do
666
- input = 'https://doi.org/10.1098/rspb.2017.0132'
676
+ it "markup" do
677
+ input = "https://doi.org/10.1098/rspb.2017.0132"
667
678
  subject = described_class.new(input: input)
668
679
  expect(subject.valid?).to be true
669
- expect(subject.id).to eq('https://doi.org/10.1098/rspb.2017.0132')
670
- expect(subject.url).to eq('https://royalsocietypublishing.org/doi/10.1098/rspb.2017.0132')
671
- expect(subject.type).to eq('JournalArticle')
672
- expect(subject.creators.size).to eq(6)
673
- expect(subject.creators.first).to eq(
674
- 'affiliation' => [{ 'name' => 'School of Biological Sciences, Centre for Evolutionary Biology, University of Western Australia, Crawley, WA 6009, Australia' }], 'familyName' => 'Dougherty', 'givenName' => 'Liam R.',
675
- 'id' => 'https://orcid.org/0000-0003-1406-0680', 'type' => 'Person'
680
+ expect(subject.id).to eq("https://doi.org/10.1098/rspb.2017.0132")
681
+ expect(subject.url).to eq("https://royalsocietypublishing.org/doi/10.1098/rspb.2017.0132")
682
+ expect(subject.type).to eq("JournalArticle")
683
+ expect(subject.contributors.size).to eq(6)
684
+ expect(subject.contributors.first).to eq(
685
+ "affiliation" => [{ "name" => "School of Biological Sciences, Centre for Evolutionary Biology, University of Western Australia, Crawley, WA 6009, Australia" }], "familyName" => "Dougherty", "givenName" => "Liam R.",
686
+ "id" => "https://orcid.org/0000-0003-1406-0680", "type" => "Person", "contributorRoles" => ["Author"],
676
687
  )
677
- expect(subject.titles).to eq([{ 'title' => 'Sexual conflict and correlated evolution between male persistence and female resistance traits in the seed beetle <i>Callosobruchus maculatus</i>' }])
678
- expect(subject.date).to include('published' => '2017-05-24')
679
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/175',
680
- 'name' => 'The Royal Society')
681
- expect(subject.provider).to eq('Crossref')
682
- end
683
-
684
- it 'empty given name' do
685
- input = 'https://doi.org/10.1111/J.1865-1682.2010.01171.X'
686
- subject = described_class.new(input: input)
687
- expect(subject.valid?).to be true
688
- expect(subject.id).to eq('https://doi.org/10.1111/j.1865-1682.2010.01171.x')
689
- expect(subject.url).to eq('https://onlinelibrary.wiley.com/doi/10.1111/j.1865-1682.2010.01171.x')
690
- expect(subject.type).to eq('JournalArticle')
691
- expect(subject.creators.length).to eq(5)
692
- expect(subject.creators[3]).to eq('type' => 'Person', 'familyName' => 'Ehtisham-ul-Haq')
693
- expect(subject.titles).to eq([{ 'title' => 'Serological Evidence of Brucella abortus Prevalence in Punjab Province, Pakistan - A Cross-Sectional Study' }])
694
- expect(subject.license).to eq('url' => 'http://doi.wiley.com/10.1002/tdm_license_1.1')
695
- expect(subject.date).to eq('published' => '2010-09-29', 'updated' => '2023-02-09')
696
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/98',
697
- 'name' => 'Hindawi Limited')
698
- end
699
-
700
- it 'invalid date' do
701
- input = 'https://doi.org/10.1055/s-0039-1690894'
702
- subject = described_class.new(input: input)
703
- expect(subject.valid?).to be true
704
- expect(subject.id).to eq('https://doi.org/10.1055/s-0039-1690894')
705
- expect(subject.url).to eq('http://www.thieme-connect.de/DOI/DOI?10.1055%2Fs-0039-1690894')
706
- expect(subject.type).to eq('JournalArticle')
707
- expect(subject.creators.length).to eq(4)
708
- expect(subject.creators[1]).to eq('affiliation' => [{ 'name' => 'Department of Chemistry, Tianjin Key Laboratory of Molecular Optoelectronic Sciences, and Tianjin Collaborative Innovation Centre of Chemical Science and Engineering, Tianjin University' }, { 'name' => 'Joint School of National University of Singapore and Tianjin University, International Campus of Tianjin University' }],
709
- 'familyName' => 'Ma',
710
- 'givenName' => 'Jun-An',
711
- 'id' => 'https://orcid.org/0000-0002-3902-6799',
712
- 'type' => 'Person')
713
- expect(subject.titles).to eq([{ 'title' => 'Silver-Catalyzed [3+3] Annulation of Glycine Imino Esters with Seyferth–Gilbert Reagent To Access Tetrahydro-1,2,4-triazinecarboxylate Esters' }])
714
- expect(subject.date).to eq('published' => '2020-04-08', 'updated' => '2020-06-16')
715
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/194',
716
- 'name' => 'Georg Thieme Verlag KG')
717
- end
718
-
719
- it 'journal article with' do
720
- input = 'https://doi.org/10.1111/nph.14619'
721
- subject = described_class.new(input: input)
722
- expect(subject.valid?).to be true
723
- expect(subject.id).to eq('https://doi.org/10.1111/nph.14619')
724
- expect(subject.url).to eq('https://onlinelibrary.wiley.com/doi/10.1111/nph.14619')
725
- expect(subject.type).to eq('JournalArticle')
726
- expect(subject.creators.length).to eq(3)
727
- expect(subject.creators.first).to eq('affiliation' => [{ 'name' => 'Independent Junior Research Group on Protein Recognition and Degradation; Leibniz Institute of Plant Biochemistry (IPB); Weinberg 3 Halle (Saale) D-06120 Germany' }, { 'name' => 'ScienceCampus Halle - Plant-based Bioeconomy; Betty-Heimann-Strasse 3 Halle (Saale) D-06120 Germany' }],
728
- 'familyName' => 'Dissmeyer',
729
- 'givenName' => 'Nico',
730
- 'id' => 'https://orcid.org/0000-0002-4156-3761',
731
- 'type' => 'Person')
732
- expect(subject.titles).to eq([{ 'title' => 'Life and death of proteins after protease cleavage: protein degradation by the N-end rule pathway' }])
733
- expect(subject.license).to eq('url' => 'http://doi.wiley.com/10.1002/tdm_license_1.1')
734
- expect(subject.date).to eq('published' => '2017-06-05', 'updated' => '2021-07-07')
735
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/311',
736
- 'name' => 'Wiley')
688
+ expect(subject.titles).to eq([{ "title" => "Sexual conflict and correlated evolution between male persistence and female resistance traits in the seed beetle <i>Callosobruchus maculatus</i>" }])
689
+ expect(subject.date).to include("published" => "2017-05-24")
690
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/175",
691
+ "name" => "The Royal Society")
692
+ expect(subject.provider).to eq("Crossref")
693
+ end
694
+
695
+ it "empty given name" do
696
+ input = "https://doi.org/10.1111/J.1865-1682.2010.01171.X"
697
+ subject = described_class.new(input: input)
698
+ expect(subject.valid?).to be true
699
+ expect(subject.id).to eq("https://doi.org/10.1111/j.1865-1682.2010.01171.x")
700
+ expect(subject.url).to eq("https://onlinelibrary.wiley.com/doi/10.1111/j.1865-1682.2010.01171.x")
701
+ expect(subject.type).to eq("JournalArticle")
702
+ expect(subject.contributors.length).to eq(5)
703
+ expect(subject.contributors[3]).to eq("type" => "Person", "contributorRoles" => ["Author"], "familyName" => "Ehtisham-ul-Haq")
704
+ expect(subject.titles).to eq([{ "title" => "Serological Evidence of Brucella abortus Prevalence in Punjab Province, Pakistan - A Cross-Sectional Study" }])
705
+ expect(subject.license).to eq("url" => "http://doi.wiley.com/10.1002/tdm_license_1.1")
706
+ expect(subject.date).to eq("published" => "2010-09-29", "updated" => "2023-02-09")
707
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/98",
708
+ "name" => "Hindawi Limited")
709
+ end
710
+
711
+ it "invalid date" do
712
+ input = "https://doi.org/10.1055/s-0039-1690894"
713
+ subject = described_class.new(input: input)
714
+ expect(subject.valid?).to be true
715
+ expect(subject.id).to eq("https://doi.org/10.1055/s-0039-1690894")
716
+ expect(subject.url).to eq("http://www.thieme-connect.de/DOI/DOI?10.1055%2Fs-0039-1690894")
717
+ expect(subject.type).to eq("JournalArticle")
718
+ expect(subject.contributors.length).to eq(4)
719
+ expect(subject.contributors[1]).to eq("affiliation" => [{ "name" => "Department of Chemistry, Tianjin Key Laboratory of Molecular Optoelectronic Sciences, and Tianjin Collaborative Innovation Centre of Chemical Science and Engineering, Tianjin University" }, { "name" => "Joint School of National University of Singapore and Tianjin University, International Campus of Tianjin University" }],
720
+ "familyName" => "Ma",
721
+ "givenName" => "Jun-An",
722
+ "id" => "https://orcid.org/0000-0002-3902-6799",
723
+ "type" => "Person", "contributorRoles" => ["Author"])
724
+ expect(subject.titles).to eq([{ "title" => "Silver-Catalyzed [3+3] Annulation of Glycine Imino Esters with Seyferth–Gilbert Reagent To Access Tetrahydro-1,2,4-triazinecarboxylate Esters" }])
725
+ expect(subject.date).to eq("published" => "2020-04-08", "updated" => "2020-06-16")
726
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/194",
727
+ "name" => "Georg Thieme Verlag KG")
728
+ end
729
+
730
+ it "journal article with" do
731
+ input = "https://doi.org/10.1111/nph.14619"
732
+ subject = described_class.new(input: input)
733
+ expect(subject.valid?).to be true
734
+ expect(subject.id).to eq("https://doi.org/10.1111/nph.14619")
735
+ expect(subject.url).to eq("https://onlinelibrary.wiley.com/doi/10.1111/nph.14619")
736
+ expect(subject.type).to eq("JournalArticle")
737
+ expect(subject.contributors.length).to eq(3)
738
+ expect(subject.contributors.first).to eq("affiliation" => [{ "name" => "Independent Junior Research Group on Protein Recognition and Degradation; Leibniz Institute of Plant Biochemistry (IPB); Weinberg 3 Halle (Saale) D-06120 Germany" }, { "name" => "ScienceCampus Halle - Plant-based Bioeconomy; Betty-Heimann-Strasse 3 Halle (Saale) D-06120 Germany" }],
739
+ "familyName" => "Dissmeyer",
740
+ "givenName" => "Nico",
741
+ "id" => "https://orcid.org/0000-0002-4156-3761",
742
+ "type" => "Person", "contributorRoles" => ["Author"])
743
+ expect(subject.titles).to eq([{ "title" => "Life and death of proteins after protease cleavage: protein degradation by the N-end rule pathway" }])
744
+ expect(subject.license).to eq("url" => "http://doi.wiley.com/10.1002/tdm_license_1.1")
745
+ expect(subject.date).to eq("published" => "2017-06-05", "updated" => "2021-07-07")
746
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/311",
747
+ "name" => "Wiley")
737
748
  expect(subject.references.length).to eq(49)
738
- expect(subject.references.last).to eq('containerTitle' => 'Proteomics',
739
- 'creator' => 'Zhang',
740
- 'doi' => 'https://doi.org/10.1002/pmic.201400530',
741
- 'firstPage' => '2447',
742
- 'key' => '10.1111/nph.14619-BIB0049|nph14619-cit-0049',
743
- 'publicationYear' => '2015',
744
- 'title' => 'Quantitative proteomics analysis of the Arg/N-end rule pathway of targeted degradation in Arabidopsis roots',
745
- 'volume' => '15')
746
- expect(subject.container).to eq('firstPage' => '929', 'identifier' => '0028-646X',
747
- 'identifierType' => 'ISSN', 'issue' => '3', 'lastPage' => '935', 'title' => 'New Phytologist', 'type' => 'Journal', 'volume' => '218')
748
- expect(subject.provider).to eq('Crossref')
749
- end
750
-
751
- it 'author literal' do
752
- input = 'https://doi.org/10.1038/ng.3834'
753
- subject = described_class.new(input: input)
754
- expect(subject.valid?).to be true
755
- expect(subject.id).to eq('https://doi.org/10.1038/ng.3834')
756
- expect(subject.url).to eq('https://www.nature.com/articles/ng.3834')
757
- expect(subject.type).to eq('JournalArticle')
758
- expect(subject.creators.length).to eq(14)
759
- expect(subject.creators[1]).to eq('name' => 'GTEx Consortium', 'type' => 'Organization')
760
- expect(subject.titles).to eq([{ 'title' => 'The impact of structural variation on human gene expression' }])
761
- expect(subject.date).to include('published' => '2017-04-03')
762
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/297',
763
- 'name' => 'Springer Science and Business Media LLC')
764
- expect(subject.provider).to eq('Crossref')
765
- end
766
-
767
- it 'affiliation is space' do
768
- input = 'https://doi.org/10.1177/0042098011428175'
769
- subject = described_class.new(input: input)
770
- expect(subject.valid?).to be true
771
- expect(subject.id).to eq('https://doi.org/10.1177/0042098011428175')
772
- expect(subject.url).to eq('http://journals.sagepub.com/doi/10.1177/0042098011428175')
773
- expect(subject.type).to eq('JournalArticle')
774
- expect(subject.creators.length).to eq(1)
775
- expect(subject.creators.first).to eq('familyName' => 'Petrovici', 'givenName' => 'Norbert',
776
- 'type' => 'Person')
777
- expect(subject.titles).to eq([{ 'title' => 'Workers and the City: Rethinking the Geographies of Power in Post-socialist Urbanisation' }])
778
- expect(subject.date).to include('published' => '2011-12-22')
779
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/179',
780
- 'name' => 'SAGE Publications')
781
- expect(subject.provider).to eq('Crossref')
782
- end
783
-
784
- it 'multiple issn' do
785
- input = 'https://doi.org/10.1007/978-3-642-34922-5_19'
749
+ expect(subject.references.last).to eq("containerTitle" => "Proteomics",
750
+ "contributor" => "Zhang",
751
+ "doi" => "https://doi.org/10.1002/pmic.201400530",
752
+ "firstPage" => "2447",
753
+ "key" => "10.1111/nph.14619-BIB0049|nph14619-cit-0049",
754
+ "publicationYear" => "2015",
755
+ "title" => "Quantitative proteomics analysis of the Arg/N-end rule pathway of targeted degradation in Arabidopsis roots",
756
+ "volume" => "15")
757
+ expect(subject.container).to eq("firstPage" => "929", "identifier" => "0028-646X",
758
+ "identifierType" => "ISSN", "issue" => "3", "lastPage" => "935", "title" => "New Phytologist", "type" => "Journal", "volume" => "218")
759
+ expect(subject.provider).to eq("Crossref")
760
+ end
761
+
762
+ it "author literal" do
763
+ input = "https://doi.org/10.1038/ng.3834"
764
+ subject = described_class.new(input: input)
765
+ expect(subject.valid?).to be true
766
+ expect(subject.id).to eq("https://doi.org/10.1038/ng.3834")
767
+ expect(subject.url).to eq("https://www.nature.com/articles/ng.3834")
768
+ expect(subject.type).to eq("JournalArticle")
769
+ expect(subject.contributors.length).to eq(14)
770
+ expect(subject.contributors[1]).to eq("contributorRoles" => ["Author"], "name" => "GTEx Consortium", "type" => "Organization")
771
+ expect(subject.titles).to eq([{ "title" => "The impact of structural variation on human gene expression" }])
772
+ expect(subject.date).to include("published" => "2017-04-03")
773
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/297",
774
+ "name" => "Springer Science and Business Media LLC")
775
+ expect(subject.provider).to eq("Crossref")
776
+ end
777
+
778
+ it "affiliation is space" do
779
+ input = "https://doi.org/10.1177/0042098011428175"
780
+ subject = described_class.new(input: input)
781
+ expect(subject.valid?).to be true
782
+ expect(subject.id).to eq("https://doi.org/10.1177/0042098011428175")
783
+ expect(subject.url).to eq("http://journals.sagepub.com/doi/10.1177/0042098011428175")
784
+ expect(subject.type).to eq("JournalArticle")
785
+ expect(subject.contributors.length).to eq(1)
786
+ expect(subject.contributors.first).to eq("familyName" => "Petrovici", "givenName" => "Norbert",
787
+ "type" => "Person", "contributorRoles" => ["Author"])
788
+ expect(subject.titles).to eq([{ "title" => "Workers and the City: Rethinking the Geographies of Power in Post-socialist Urbanisation" }])
789
+ expect(subject.date).to include("published" => "2011-12-22")
790
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/179",
791
+ "name" => "SAGE Publications")
792
+ expect(subject.provider).to eq("Crossref")
793
+ end
794
+
795
+ it "multiple issn" do
796
+ input = "https://doi.org/10.1007/978-3-642-34922-5_19"
786
797
  subject = described_class.new(input: input)
787
798
  # expect(subject.valid?).to be true
788
- expect(subject.id).to eq('https://doi.org/10.1007/978-3-642-34922-5_19')
789
- expect(subject.url).to eq('https://link.springer.com/10.1007/978-3-642-34922-5_19')
790
- expect(subject.type).to eq('BookChapter')
791
- expect(subject.creators.length).to eq(3)
792
- expect(subject.creators.first).to eq('familyName' => 'Razib', 'givenName' => 'Ali',
793
- 'type' => 'Person')
794
- expect(subject.titles).to eq([{ 'title' => 'Log-Domain Arithmetic for High-Speed Fuzzy Control on a Field-Programmable Gate Array' }])
795
- expect(subject.date).to include('published' => '2013')
796
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/297',
797
- 'name' => 'Springer Science and Business Media LLC')
798
- expect(subject.container).to eq('identifier' => '1860-0808', 'identifierType' => 'ISSN', 'firstPage' => '269', 'lastPage' => '287',
799
- 'title' => 'Soft Computing: State of the Art Theory and Novel Applications', 'type' => 'Book')
800
- expect(subject.provider).to eq('Crossref')
801
- end
802
-
803
- it 'article id as page number' do
804
- input = 'https://doi.org/10.1103/physrevlett.120.117701'
805
- subject = described_class.new(input: input)
806
- expect(subject.valid?).to be true
807
- expect(subject.id).to eq('https://doi.org/10.1103/physrevlett.120.117701')
808
- expect(subject.url).to eq('https://link.aps.org/doi/10.1103/PhysRevLett.120.117701')
809
- expect(subject.type).to eq('JournalArticle')
810
- expect(subject.creators.length).to eq(5)
811
- expect(subject.creators.first).to eq('familyName' => 'Marrazzo', 'givenName' => 'Antimo',
812
- 'type' => 'Person')
813
- expect(subject.titles).to eq([{ 'title' => 'Prediction of a Large-Gap and Switchable Kane-Mele Quantum Spin Hall Insulator' }])
814
- expect(subject.date).to include('published' => '2018-03-13')
815
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/16',
816
- 'name' => 'American Physical Society (APS)')
817
- expect(subject.container).to eq('identifier' => '1079-7114',
818
- 'identifierType' => 'ISSN', 'issue' => '11', 'title' => 'Physical Review Letters', 'type' => 'Journal', 'volume' => '120')
819
- expect(subject.provider).to eq('Crossref')
820
- end
821
-
822
- it 'posted content copernicus' do
823
- input = 'https://doi.org/10.5194/CP-2020-95'
824
- subject = described_class.new(input: input)
825
- expect(subject.valid?).to be true
826
- expect(subject.url).to eq('https://cp.copernicus.org/preprints/cp-2020-95/cp-2020-95.pdf')
827
- expect(subject.type).to eq('Article')
828
- expect(subject.creators.count).to eq(6)
829
- expect(subject.creators.first).to eq('type' => 'Person', 'familyName' => 'Shao',
830
- 'givenName' => 'Jun',
831
- 'id' => 'https://orcid.org/0000-0001-6130-6474')
832
- expect(subject.titles).to eq([{ 'title' => 'The Atmospheric Bridge Communicated the δ&amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt;C Decline during the Last Deglaciation to the Global Upper Ocean' }])
833
- expect(subject.id).to eq('https://doi.org/10.5194/cp-2020-95')
799
+ expect(subject.id).to eq("https://doi.org/10.1007/978-3-642-34922-5_19")
800
+ expect(subject.url).to eq("https://link.springer.com/10.1007/978-3-642-34922-5_19")
801
+ expect(subject.type).to eq("BookChapter")
802
+ expect(subject.contributors.length).to eq(3)
803
+ expect(subject.contributors.first).to eq("familyName" => "Razib", "givenName" => "Ali",
804
+ "type" => "Person", "contributorRoles" => ["Author"])
805
+ expect(subject.titles).to eq([{ "title" => "Log-Domain Arithmetic for High-Speed Fuzzy Control on a Field-Programmable Gate Array" }])
806
+ expect(subject.date).to include("published" => "2013")
807
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/297",
808
+ "name" => "Springer Science and Business Media LLC")
809
+ expect(subject.container).to eq("identifier" => "1860-0808", "identifierType" => "ISSN", "firstPage" => "269", "lastPage" => "287",
810
+ "title" => "Soft Computing: State of the Art Theory and Novel Applications", "type" => "Book")
811
+ expect(subject.provider).to eq("Crossref")
812
+ end
813
+
814
+ it "article id as page number" do
815
+ input = "https://doi.org/10.1103/physrevlett.120.117701"
816
+ subject = described_class.new(input: input)
817
+ expect(subject.valid?).to be true
818
+ expect(subject.id).to eq("https://doi.org/10.1103/physrevlett.120.117701")
819
+ expect(subject.url).to eq("https://link.aps.org/doi/10.1103/PhysRevLett.120.117701")
820
+ expect(subject.type).to eq("JournalArticle")
821
+ expect(subject.contributors.length).to eq(5)
822
+ expect(subject.contributors.first).to eq("familyName" => "Marrazzo", "givenName" => "Antimo",
823
+ "type" => "Person", "contributorRoles" => ["Author"])
824
+ expect(subject.titles).to eq([{ "title" => "Prediction of a Large-Gap and Switchable Kane-Mele Quantum Spin Hall Insulator" }])
825
+ expect(subject.date).to include("published" => "2018-03-13")
826
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/16",
827
+ "name" => "American Physical Society (APS)")
828
+ expect(subject.container).to eq("identifier" => "1079-7114",
829
+ "identifierType" => "ISSN", "issue" => "11", "title" => "Physical Review Letters", "type" => "Journal", "volume" => "120")
830
+ expect(subject.provider).to eq("Crossref")
831
+ end
832
+
833
+ it "posted content copernicus" do
834
+ input = "https://doi.org/10.5194/CP-2020-95"
835
+ subject = described_class.new(input: input)
836
+ expect(subject.valid?).to be true
837
+ expect(subject.url).to eq("https://cp.copernicus.org/preprints/cp-2020-95/cp-2020-95.pdf")
838
+ expect(subject.type).to eq("Article")
839
+ expect(subject.contributors.count).to eq(6)
840
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"], "familyName" => "Shao",
841
+ "givenName" => "Jun",
842
+ "id" => "https://orcid.org/0000-0001-6130-6474")
843
+ expect(subject.titles).to eq([{ "title" => "The Atmospheric Bridge Communicated the δ&amp;lt;sup&amp;gt;13&amp;lt;/sup&amp;gt;C Decline during the Last Deglaciation to the Global Upper Ocean" }])
844
+ expect(subject.id).to eq("https://doi.org/10.5194/cp-2020-95")
834
845
  expect(subject.alternate_identifiers.empty?).to be(true)
835
- expect(subject.descriptions.first['description']).to start_with('Abstract. During the early last glacial termination')
836
- expect(subject.date).to include('published' => '2020-07-28')
837
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/3145',
838
- 'name' => 'Copernicus GmbH')
839
- expect(subject.provider).to eq('Crossref')
840
- end
841
-
842
- it 'book oup' do
843
- input = '10.1093/oxfordhb/9780198746140.013.5'
844
- subject = described_class.new(input: input)
845
- expect(subject.valid?).to be true
846
- expect(subject.url).to eq('https://academic.oup.com/edited-volume/28081/chapter/212116415')
847
- expect(subject.type).to eq('Book')
848
- expect(subject.creators.count).to eq(1)
849
- expect(subject.creators.first).to eq('type' => 'Person', 'familyName' => 'Clayton',
850
- 'givenName' => 'Barbra R.')
851
- expect(subject.contributors.count).to eq(2)
852
- expect(subject.contributors.first).to eq('contributorType' => 'Editor', 'familyName' => 'Cozort',
853
- 'givenName' => 'Daniel', 'type' => 'Person')
854
- expect(subject.titles).to eq([{ 'title' => 'The Changing Way of the Bodhisattva' }])
855
- expect(subject.id).to eq('https://doi.org/10.1093/oxfordhb/9780198746140.013.5')
846
+ expect(subject.descriptions.first["description"]).to start_with("Abstract. During the early last glacial termination")
847
+ expect(subject.date).to include("published" => "2020-07-28")
848
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/3145",
849
+ "name" => "Copernicus GmbH")
850
+ expect(subject.provider).to eq("Crossref")
851
+ end
852
+
853
+ it "book oup" do
854
+ input = "10.1093/oxfordhb/9780198746140.013.5"
855
+ subject = described_class.new(input: input)
856
+ expect(subject.valid?).to be true
857
+ expect(subject.url).to eq("https://academic.oup.com/edited-volume/28081/chapter/212116415")
858
+ expect(subject.type).to eq("Book")
859
+ expect(subject.contributors.count).to eq(3)
860
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"], "familyName" => "Clayton",
861
+ "givenName" => "Barbra R.")
862
+ expect(subject.contributors.last).to eq("contributorRoles" => ["Editor"], "familyName" => "Shields", "givenName" => "James Mark", "type" => "Person")
863
+ expect(subject.titles).to eq([{ "title" => "The Changing Way of the Bodhisattva" }])
864
+ expect(subject.id).to eq("https://doi.org/10.1093/oxfordhb/9780198746140.013.5")
856
865
  expect(subject.alternate_identifiers.empty?).to be(true)
857
- expect(subject.descriptions.first['description']).to start_with('This chapter explores the nature of the connections')
858
- expect(subject.date).to include('published' => '2018-04-05')
859
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/286',
860
- 'name' => 'Oxford University Press (OUP)')
861
- expect(subject.provider).to eq('Crossref')
866
+ expect(subject.descriptions.first["description"]).to start_with("This chapter explores the nature of the connections")
867
+ expect(subject.date).to include("published" => "2018-04-05")
868
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/286",
869
+ "name" => "Oxford University Press (OUP)")
870
+ expect(subject.provider).to eq("Crossref")
862
871
  end
863
872
 
864
- it 'report osti' do
865
- input = '10.2172/972169'
873
+ it "report osti" do
874
+ input = "10.2172/972169"
866
875
  subject = described_class.new(input: input)
867
876
  expect(subject.valid?).to be true
868
- expect(subject.url).to eq('http://www.osti.gov/servlets/purl/972169-1QXROM')
869
- expect(subject.type).to eq('Report')
870
- expect(subject.creators.count).to eq(4)
871
- expect(subject.creators.first).to eq('type' => 'Person', 'familyName' => 'Denholm',
872
- 'givenName' => 'P.')
873
- expect(subject.contributors.count).to eq(0)
874
- expect(subject.titles).to eq([{ 'title' => 'Role of Energy Storage with Renewable Electricity Generation' }])
875
- expect(subject.id).to eq('https://doi.org/10.2172/972169')
877
+ expect(subject.url).to eq("http://www.osti.gov/servlets/purl/972169-1QXROM")
878
+ expect(subject.type).to eq("Report")
879
+ expect(subject.contributors.count).to eq(4)
880
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"], "familyName" => "Denholm",
881
+ "givenName" => "P.")
882
+ expect(subject.titles).to eq([{ "title" => "Role of Energy Storage with Renewable Electricity Generation" }])
883
+ expect(subject.id).to eq("https://doi.org/10.2172/972169")
876
884
  expect(subject.descriptions.empty?).to be(true)
877
- expect(subject.date).to include('published' => '2010-01-01')
878
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/960',
879
- 'name' => 'Office of Scientific and Technical Information (OSTI)')
880
- expect(subject.provider).to eq('Crossref')
885
+ expect(subject.date).to include("published" => "2010-01-01")
886
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/960",
887
+ "name" => "Office of Scientific and Technical Information (OSTI)")
888
+ expect(subject.provider).to eq("Crossref")
881
889
  end
882
890
 
883
- it 'journal issue' do
884
- input = 'https://doi.org/10.6002/ect.2015.0371'
891
+ it "journal issue" do
892
+ input = "https://doi.org/10.6002/ect.2015.0371"
885
893
  subject = described_class.new(input: input)
886
894
  expect(subject.valid?).to be false
887
- expect(subject.id).to eq('https://doi.org/10.6002/ect.2015.0371')
888
- expect(subject.url).to eq('http://ectrx.org/forms/ectrxcontentshow.php?doi_id=10.6002%2Fect.2015.0371')
889
- expect(subject.type).to eq('JournalIssue')
890
- expect(subject.creators.empty?).to be true
891
- expect(subject.titles).to eq([{ 'title' => ':(unav)' }])
892
- expect(subject.date).to eq('published' => '2018-10', 'updated' => '2018-10-03')
893
- expect(subject.publisher).to eq('id' => 'https://api.crossref.org/members/4021',
894
- 'name' => 'Baskent University')
895
+ expect(subject.errors).to eq(["property '/contributors' is invalid: error_type=minItems"])
896
+ expect(subject.id).to eq("https://doi.org/10.6002/ect.2015.0371")
897
+ expect(subject.url).to eq("http://ectrx.org/forms/ectrxcontentshow.php?doi_id=10.6002%2Fect.2015.0371")
898
+ expect(subject.type).to eq("JournalIssue")
899
+ expect(subject.contributors.empty?).to be true
900
+ expect(subject.titles).to eq([{ "title" => ":(unav)" }])
901
+ expect(subject.date).to eq("published" => "2018-10", "updated" => "2018-10-03")
902
+ expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/4021",
903
+ "name" => "Baskent University")
895
904
  expect(subject.references.length).to eq(1)
896
- expect(subject.references.first).to eq('containerTitle' => 'Ergonomics',
897
- 'creator' => 'IMAMURA',
898
- 'doi' => 'https://doi.org/10.1080/001401398186180',
899
- 'firstPage' => '1421',
900
- 'issue' => '10',
901
- 'key' => 'ref0',
902
- 'publicationYear' => '1998',
903
- 'title' => 'Manual performance in cold conditions while wearing NBC clothing',
904
- 'volume' => '41')
905
- expect(subject.container).to eq('identifier' => '2146-8427', 'identifierType' => 'ISSN',
906
- 'issue' => '5', 'title' => 'Experimental and Clinical Transplantation', 'type' => 'Journal', 'volume' => '16')
907
- expect(subject.provider).to eq('Crossref')
908
- end
909
-
910
- it 'not found error' do
911
- input = 'https://doi.org/10.7554/elife.01567x'
905
+ expect(subject.references.first).to eq("containerTitle" => "Ergonomics",
906
+ "contributor" => "IMAMURA",
907
+ "doi" => "https://doi.org/10.1080/001401398186180",
908
+ "firstPage" => "1421",
909
+ "issue" => "10",
910
+ "key" => "ref0",
911
+ "publicationYear" => "1998",
912
+ "title" => "Manual performance in cold conditions while wearing NBC clothing",
913
+ "volume" => "41")
914
+ expect(subject.container).to eq("identifier" => "2146-8427", "identifierType" => "ISSN",
915
+ "issue" => "5", "title" => "Experimental and Clinical Transplantation", "type" => "Journal", "volume" => "16")
916
+ expect(subject.provider).to eq("Crossref")
917
+ end
918
+
919
+ it "not found error" do
920
+ input = "https://doi.org/10.7554/elife.01567x"
912
921
  subject = described_class.new(input: input)
913
922
  expect(subject.valid?).to be false
914
- expect(subject.id).to eq('https://doi.org/10.7554/elife.01567x')
915
- expect(subject.provider).to eq('Crossref')
916
- expect(subject.state).to eq('not_found')
923
+ expect(subject.id).to eq("https://doi.org/10.7554/elife.01567x")
924
+ expect(subject.provider).to eq("Crossref")
925
+ expect(subject.state).to eq("not_found")
917
926
  end
918
927
  end
919
928
  end