commonmeta-ruby 3.4.4 → 3.5

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