commonmeta-ruby 3.4.5 → 3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) 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 +2 -2
  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/write_metadata_as_crossref/book_oup.yml +107 -0
  35. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_plos.yml +407 -0
  36. data/spec/metadata_spec.rb +2 -2
  37. data/spec/readers/bibtex_reader_spec.rb +5 -5
  38. data/spec/readers/cff_reader_spec.rb +127 -127
  39. data/spec/readers/codemeta_reader_spec.rb +11 -11
  40. data/spec/readers/crossref_reader_spec.rb +831 -835
  41. data/spec/readers/crossref_xml_reader_spec.rb +899 -901
  42. data/spec/readers/csl_reader_spec.rb +33 -33
  43. data/spec/readers/datacite_reader_spec.rb +106 -103
  44. data/spec/readers/json_feed_reader_spec.rb +40 -40
  45. data/spec/readers/npm_reader_spec.rb +32 -33
  46. data/spec/readers/ris_reader_spec.rb +36 -36
  47. data/spec/readers/schema_org_reader_spec.rb +284 -284
  48. data/spec/writers/codemeta_writer_spec.rb +19 -20
  49. data/spec/writers/crossref_xml_writer_spec.rb +73 -37
  50. data/spec/writers/datacite_writer_spec.rb +1 -1
  51. metadata +7 -3
@@ -1,61 +1,61 @@
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
- subject { described_class.new(input: input, from: 'csl') }
6
+ subject { described_class.new(input: input, from: "csl") }
7
7
 
8
8
  let(:input) { "#{fixture_path}citeproc.json" }
9
9
 
10
- context 'get citeproc raw' do
11
- it 'BlogPosting' do
10
+ context "get citeproc raw" do
11
+ it "BlogPosting" do
12
12
  expect(subject.raw).to eq(File.read(input).strip)
13
13
  end
14
14
  end
15
15
 
16
- context 'get citeproc metadata' do
17
- it 'BlogPosting' do
16
+ context "get citeproc metadata" do
17
+ it "BlogPosting" do
18
18
  expect(subject.valid?).to be true
19
- expect(subject.id).to eq('https://doi.org/10.5438/4k3m-nyvg')
20
- expect(subject.url).to eq('https://blog.datacite.org/eating-your-own-dog-food')
21
- expect(subject.type).to eq('Article')
22
- expect(subject.creators).to eq([{ 'familyName' => 'Fenner', 'givenName' => 'Martin',
23
- 'type' => 'Person' }])
24
- expect(subject.titles).to eq([{ 'title' => 'Eating your own Dog Food' }])
25
- expect(subject.descriptions.first['description']).to start_with('Eating your own dog food')
26
- expect(subject.date).to eq('published' => '2016-12-20')
19
+ expect(subject.id).to eq("https://doi.org/10.5438/4k3m-nyvg")
20
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
21
+ expect(subject.type).to eq("Article")
22
+ expect(subject.contributors).to eq([{ "familyName" => "Fenner", "givenName" => "Martin",
23
+ "type" => "Person", "contributorRoles" => ["Author"] }])
24
+ expect(subject.titles).to eq([{ "title" => "Eating your own Dog Food" }])
25
+ expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
26
+ expect(subject.date).to eq("published" => "2016-12-20")
27
27
  expect(subject.license).to be_nil
28
28
  end
29
29
  end
30
30
 
31
- context 'get citeproc no categories' do
32
- it 'BlogPosting' do
31
+ context "get citeproc no categories" do
32
+ it "BlogPosting" do
33
33
  input = "#{fixture_path}citeproc-no-categories.json"
34
34
  subject = described_class.new(input: input)
35
35
  expect(subject.valid?).to be true
36
- expect(subject.id).to eq('https://doi.org/10.5072/4k3m-nyvg')
37
- expect(subject.url).to eq('https://blog.datacite.org/eating-your-own-dog-food')
38
- expect(subject.type).to eq('Article')
39
- expect(subject.creators).to eq([{ 'familyName' => 'Fenner', 'givenName' => 'Martin',
40
- 'type' => 'Person' }])
41
- expect(subject.titles).to eq([{ 'title' => 'Eating your own Dog Food' }])
42
- expect(subject.descriptions.first['description']).to start_with('Eating your own dog food')
43
- expect(subject.date).to eq('published' => '2016-12-20')
36
+ expect(subject.id).to eq("https://doi.org/10.5072/4k3m-nyvg")
37
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
38
+ expect(subject.type).to eq("Article")
39
+ expect(subject.contributors).to eq([{ "familyName" => "Fenner", "givenName" => "Martin",
40
+ "type" => "Person", "contributorRoles" => ["Author"] }])
41
+ expect(subject.titles).to eq([{ "title" => "Eating your own Dog Food" }])
42
+ expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
43
+ expect(subject.date).to eq("published" => "2016-12-20")
44
44
  end
45
45
  end
46
46
 
47
- context 'get citeproc no author' do
48
- it 'Journal article' do
47
+ context "get citeproc no author" do
48
+ it "Journal article" do
49
49
  input = "#{fixture_path}citeproc-no-author.json"
50
50
  subject = described_class.new(input: input)
51
51
  # expect(subject.valid?).to be true
52
- expect(subject.id).to eq('https://doi.org/10.5438/4k3m-nyvg')
53
- expect(subject.url).to eq('https://blog.datacite.org/eating-your-own-dog-food')
54
- expect(subject.type).to eq('Article')
55
- expect(subject.creators).to eq([{ 'name' => ':(unav)', 'type' => 'Organization' }])
56
- expect(subject.titles).to eq([{ 'title' => 'Eating your own Dog Food' }])
57
- expect(subject.descriptions.first['description']).to start_with('Eating your own dog food')
58
- expect(subject.date).to eq('published' => '2016-12-20')
52
+ expect(subject.id).to eq("https://doi.org/10.5438/4k3m-nyvg")
53
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
54
+ expect(subject.type).to eq("Article")
55
+ expect(subject.contributors).to eq([{ "name" => ":(unav)", "type" => "Organization", "contributorRoles" => ["Author"] }])
56
+ expect(subject.titles).to eq([{ "title" => "Eating your own Dog Food" }])
57
+ expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
58
+ expect(subject.date).to eq("published" => "2016-12-20")
59
59
  end
60
60
  end
61
61
  end
@@ -1,156 +1,159 @@
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 datacite raw' do
7
- it 'BlogPosting' do
6
+ context "get datacite raw" do
7
+ it "BlogPosting" do
8
8
  input = "#{fixture_path}datacite.json"
9
9
  subject = described_class.new(input: input)
10
10
  expect(subject.raw).to eq(File.read(input).strip)
11
11
  end
12
12
  end
13
13
 
14
- context 'get datacite metadata' do
15
- it 'BlogPosting' do
14
+ context "get datacite metadata" do
15
+ it "BlogPosting" do
16
16
  input = "#{fixture_path}datacite.json"
17
17
  subject = described_class.new(input: input)
18
18
  # expect(subject.valid?).to be true
19
- expect(subject.type).to eq('Article')
20
- expect(subject.creators).to eq([{ 'type' => 'Person', 'givenName' => 'Martin', 'familyName' => 'Fenner',
21
- 'id' => 'https://orcid.org/0000-0003-1419-2405' }])
22
- expect(subject.titles).to eq([{ 'title' => 'Eating your own Dog Food' }])
19
+ expect(subject.type).to eq("Article")
20
+ expect(subject.contributors).to eq([{ "type" => "Person", "contributorRoles" => ["Author"], "givenName" => "Martin", "familyName" => "Fenner",
21
+ "id" => "https://orcid.org/0000-0003-1419-2405" }])
22
+ expect(subject.titles).to eq([{ "title" => "Eating your own Dog Food" }])
23
23
  expect(subject.alternate_identifiers).to be_nil
24
- expect(subject.date).to eq('created' => '2016-12-20',
25
- 'published' => '2016-12-20',
26
- 'updated' => '2016-12-20')
24
+ expect(subject.date).to eq("created" => "2016-12-20",
25
+ "published" => "2016-12-20",
26
+ "updated" => "2016-12-20")
27
27
  expect(subject.references.length).to eq(2)
28
- expect(subject.references.first).to eq('doi' => 'https://doi.org/10.5438/0012',
29
- 'key' => '10.5438/0012')
30
- expect(subject.provider).to eq('DataCite')
28
+ expect(subject.references.first).to eq("doi" => "https://doi.org/10.5438/0012",
29
+ "key" => "10.5438/0012")
30
+ expect(subject.provider).to eq("DataCite")
31
31
  end
32
32
 
33
- # it "SoftwareSourceCode" do
34
- # input = fixture_path + "datacite_software.json"
35
- # subject = Commonmeta::Metadata.new(input: input, from: "datacite")
36
- # # # expect(subject.valid?).to be true
37
- # expect(subject.identifier).to eq("https://doi.org/10.5063/f1m61h5x")
38
- # expect(subject.type).to eq("bibtex"=>"misc", "citeproc"=>"article", "resource_type"=>"Software", "resource_type_general"=>"Software", "ris"=>"COMP", "type"=>"SoftwareSourceCode")
39
- # expect(subject.creators).to eq([{"familyName"=>"Jones", "givenName"=>"Matthew B.", "name"=>"Matthew B. Jones", "type"=>"Person"}])
40
- # expect(subject.titles).to eq([{"title"=>"dataone: R interface to the DataONE network of data repositories"}])
41
- # expect(subject.date).to eq([{"date"=>"2016", "date_type"=>"Issued"}])
42
- # expect(subject.publisher).to eq("KNB Data Repository")
43
- # expect(subject.provider).to eq("DataCite")
44
- # end
33
+ it "SoftwareSourceCode" do
34
+ input = "10.5063/f1m61h5x"
35
+ subject = Commonmeta::Metadata.new(input: input, from: "datacite")
36
+ # expect(subject.valid?).to be true
37
+ expect(subject.id).to eq("https://doi.org/10.5063/f1m61h5x")
38
+ expect(subject.type).to eq("Software")
39
+ expect(subject.contributors).to eq([{"contributorRoles"=>["Author"],
40
+ "name"=>
41
+ "Jones, Matthew B.; Slaughter, Peter; Nahf, Rob; Boettiger, Carl ; Jones, Chris; Read, Jordan; Walker, Lauren; Hart, Edmund; Chamberlain, Scott",
42
+ "type"=>"Organization"}])
43
+ expect(subject.titles).to eq([{"title"=>"dataone: R interface to the DataONE network of data repositories"}])
44
+ expect(subject.date).to eq("created"=>"2016-03-12", "published"=>"2016", "registered"=>"2016-03-12", "updated"=>"2020-09-18")
45
+ expect(subject.publisher).to eq("name"=>"KNB Data Repository")
46
+ expect(subject.provider).to eq("DataCite")
47
+ end
45
48
 
46
- it 'SoftwareSourceCode missing_comma' do
49
+ it "SoftwareSourceCode missing_comma" do
47
50
  input = "#{fixture_path}datacite_software_missing_comma.json"
48
- subject = described_class.new(input: input, from: 'datacite', show_errors: true)
51
+ subject = described_class.new(input: input, from: "datacite", show_errors: true)
49
52
  # expect(subject.valid?).to be false
50
- expect(subject.errors).to eq(['expected comma, not a string (after doi) at line 4, column 11 [parse.c:416]'])
53
+ expect(subject.errors).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:416]"])
51
54
  expect(subject.codemeta.nil?).to be(true)
52
55
  end
53
56
 
54
- it 'SoftwareSourceCode overlapping_keys' do
57
+ it "SoftwareSourceCode overlapping_keys" do
55
58
  input = "#{fixture_path}datacite_software_overlapping_keys.json"
56
- subject = described_class.new(input: input, from: 'datacite', show_errors: true)
59
+ subject = described_class.new(input: input, from: "datacite", show_errors: true)
57
60
  expect(subject.valid?).to be false
58
- expect(subject.errors).to eq(['The same key is defined more than once: id'])
61
+ expect(subject.errors).to eq(["The same key is defined more than once: id"])
59
62
  expect(subject.codemeta.nil?).to be(true)
60
63
  end
61
64
 
62
- it 'dissertation' do
63
- input = '10.3204/desy-2014-01645'
65
+ it "dissertation" do
66
+ input = "10.3204/desy-2014-01645"
64
67
  subject = described_class.new(input: input)
65
68
  # expect(subject.valid?).to be true
66
- expect(subject.id).to eq('https://doi.org/10.3204/desy-2014-01645')
67
- expect(subject.type).to eq('Dissertation')
68
- expect(subject.creators).to eq([{ 'type' => 'Person',
69
- 'givenName' => 'Heiko', 'familyName' => 'Conrad' }])
70
- expect(subject.titles).to eq([{ 'title' => 'Dynamics of colloids in molecular glass forming liquids studied via X-ray photon correlation spectroscopy' }])
71
- expect(subject.date).to eq('created' => '2018-01-25', 'published' => '2014',
72
- 'registered' => '2018-01-25', 'updated' => '2020-09-19')
69
+ expect(subject.id).to eq("https://doi.org/10.3204/desy-2014-01645")
70
+ expect(subject.type).to eq("Dissertation")
71
+ expect(subject.contributors.length).to eq(3)
72
+ expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"],
73
+ "givenName" => "Heiko", "familyName" => "Conrad")
74
+ expect(subject.contributors.last).to eq("id"=>"https://orcid.org/0000-0002-8633-8234", "type"=>"Person", "contributorRoles"=>["Supervision"], "givenName"=>"Gerhard", "familyName"=>"Gruebel", "affiliation"=>[{"name"=>"Deutsches Elektronen-Synchrotron"}])
75
+ expect(subject.titles).to eq([{ "title" => "Dynamics of colloids in molecular glass forming liquids studied via X-ray photon correlation spectroscopy" }])
76
+ expect(subject.date).to eq("created" => "2018-01-25", "published" => "2014",
77
+ "registered" => "2018-01-25", "updated" => "2020-09-19")
73
78
  expect(subject.license).to be_nil
74
- expect(subject.publisher).to eq('name' => 'Deutsches Elektronen-Synchrotron, DESY, Hamburg')
75
- expect(subject.provider).to eq('DataCite')
79
+ expect(subject.publisher).to eq("name" => "Deutsches Elektronen-Synchrotron, DESY, Hamburg")
80
+ expect(subject.provider).to eq("DataCite")
76
81
  end
77
82
 
78
- it 'funding references' do
79
- input = '10.26102/2310-6018/2019.24.1.006'
83
+ it "funding references" do
84
+ input = "10.26102/2310-6018/2019.24.1.006"
80
85
  subject = described_class.new(input: input)
81
86
  # expect(subject.valid?).to be true
82
- expect(subject.id).to eq('https://doi.org/10.26102/2310-6018/2019.24.1.006')
83
- expect(subject.type).to eq('Document')
84
- expect(subject.creators.length).to eq(2)
85
- expect(subject.creators.first).to eq(
86
- 'affiliation' => [{ 'name' => 'Тверская государственная сельскохозяйственная академия' }], 'familyName' => 'Ганичева', 'givenName' => 'А.В.', 'type' => 'Person'
87
+ expect(subject.id).to eq("https://doi.org/10.26102/2310-6018/2019.24.1.006")
88
+ expect(subject.type).to eq("Document")
89
+ expect(subject.contributors.length).to eq(2)
90
+ expect(subject.contributors.first).to eq(
91
+ "affiliation" => [{ "name" => "Тверская государственная сельскохозяйственная академия" }], "familyName" => "Ганичева", "givenName" => "А.В.", "type" => "Person", "contributorRoles" => ["Author"],
87
92
  )
88
- expect(subject.titles.last).to eq('title' => 'MODEL OF SYSTEM DYNAMICS OF PROCESS OF TRAINING',
89
- 'titleType' => 'TranslatedTitle')
90
- expect(subject.date).to eq('created' => '2019-02-12', 'published' => '2019',
91
- 'registered' => '2019-02-12', 'updated' => '2022-08-23')
92
- expect(subject.publisher).to eq('name' => 'МОДЕЛИРОВАНИЕ, ОПТИМИЗАЦИЯ И ИНФОРМАЦИОННЫЕ ТЕХНОЛОГИИ')
93
+ expect(subject.titles.last).to eq("title" => "MODEL OF SYSTEM DYNAMICS OF PROCESS OF TRAINING",
94
+ "titleType" => "TranslatedTitle")
95
+ expect(subject.date).to eq("created" => "2019-02-12", "published" => "2019",
96
+ "registered" => "2019-02-12", "updated" => "2022-08-23")
97
+ expect(subject.publisher).to eq("name" => "МОДЕЛИРОВАНИЕ, ОПТИМИЗАЦИЯ И ИНФОРМАЦИОННЫЕ ТЕХНОЛОГИИ")
93
98
  expect(subject.license).to be_nil
94
99
  expect(subject.funding_references.count).to eq(1)
95
- expect(subject.funding_references.first).to eq('awardNumber' => 'проект № 170100728',
96
- 'funderName' => 'РФФИ')
97
- expect(subject.provider).to eq('DataCite')
100
+ expect(subject.funding_references.first).to eq("awardNumber" => "проект № 170100728",
101
+ "funderName" => "РФФИ")
102
+ expect(subject.provider).to eq("DataCite")
98
103
  end
99
104
 
100
- it 'subject scheme' do
101
- input = 'https://doi.org/10.4232/1.2745'
105
+ it "subject scheme" do
106
+ input = "https://doi.org/10.4232/1.2745"
102
107
  subject = described_class.new(input: input)
103
108
  # expect(subject.valid?).to be true
104
- expect(subject.id).to eq('https://doi.org/10.4232/1.2745')
105
- expect(subject.alternate_identifiers).to eq([{ 'alternateIdentifier' => 'ZA2745', 'alternateIdentifierType' => 'ZA-No.' },
106
- { 'alternateIdentifier' => 'Internationale Umfrageprogramme',
107
- 'alternateIdentifierType' => 'FDZ' }])
108
- expect(subject.type).to eq('Dataset')
109
- expect(subject.creators).to eq([{ 'name' => 'Europäische Kommission',
110
- 'type' => 'Organization' }])
111
- expect(subject.contributors.length).to eq(18)
109
+ expect(subject.id).to eq("https://doi.org/10.4232/1.2745")
110
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "ZA2745", "alternateIdentifierType" => "ZA-No." },
111
+ { "alternateIdentifier" => "Internationale Umfrageprogramme",
112
+ "alternateIdentifierType" => "FDZ" }])
113
+ expect(subject.type).to eq("Dataset")
114
+ expect(subject.contributors.length).to eq(19)
112
115
  expect(subject.contributors.first).to eq(
113
- 'affiliation' => [{ 'name' => 'Europäische Kommission, Brüssel' }], 'contributorType' => 'Researcher', 'familyName' => 'Reif', 'givenName' => 'Karlheinz', 'type' => 'Person'
116
+ "name" => "Europäische Kommission", "contributorRoles" => ["Author"], "type" => "Organization",
114
117
  )
115
118
  expect(subject.titles).to eq([
116
- { 'lang' => 'de',
117
- 'title' => 'Flash Eurobarometer 54 (Madrid Summit)' }, { 'lang' => 'en', 'title' => 'Flash Eurobarometer 54 (Madrid Summit)' }, { 'titleType' => 'Subtitle', 'lang' => 'de', 'title' => 'The Common European Currency' }, { 'titleType' => 'Subtitle', 'lang' => 'en', 'title' => 'The Common European Currency' }
119
+ { "lang" => "de",
120
+ "title" => "Flash Eurobarometer 54 (Madrid Summit)" }, { "lang" => "en", "title" => "Flash Eurobarometer 54 (Madrid Summit)" }, { "titleType" => "Subtitle", "lang" => "de", "title" => "The Common European Currency" }, { "titleType" => "Subtitle", "lang" => "en", "title" => "The Common European Currency" },
118
121
  ])
119
- expect(subject.subjects).to eq([{ 'lang' => 'en',
120
- 'subject' => 'KAT12 International Institutions, Relations, Conditions',
121
- 'subjectScheme' => 'ZA' },
122
- { 'lang' => 'de',
123
- 'subject' => 'Internationale Politik und Internationale Organisationen',
124
- 'subjectScheme' => 'CESSDA Topic Classification' },
125
- { 'lang' => 'de',
126
- 'subject' => 'Wirtschaftssysteme und wirtschaftliche Entwicklung',
127
- 'subjectScheme' => 'CESSDA Topic Classification' },
128
- { 'lang' => 'en',
129
- 'subject' => 'International politics and organisations',
130
- 'subjectScheme' => 'CESSDA Topic Classification' },
131
- { 'lang' => 'en',
132
- 'subject' => 'Economic systems and development',
133
- 'subjectScheme' => 'CESSDA Topic Classification' }])
134
- expect(subject.date).to eq('created' => '2012-01-10', 'published' => '1996',
135
- 'registered' => '2010-07-22', 'updated' => '2023-02-02')
122
+ expect(subject.subjects).to eq([{ "lang" => "en",
123
+ "subject" => "KAT12 International Institutions, Relations, Conditions",
124
+ "subjectScheme" => "ZA" },
125
+ { "lang" => "de",
126
+ "subject" => "Internationale Politik und Internationale Organisationen",
127
+ "subjectScheme" => "CESSDA Topic Classification" },
128
+ { "lang" => "de",
129
+ "subject" => "Wirtschaftssysteme und wirtschaftliche Entwicklung",
130
+ "subjectScheme" => "CESSDA Topic Classification" },
131
+ { "lang" => "en",
132
+ "subject" => "International politics and organisations",
133
+ "subjectScheme" => "CESSDA Topic Classification" },
134
+ { "lang" => "en",
135
+ "subject" => "Economic systems and development",
136
+ "subjectScheme" => "CESSDA Topic Classification" }])
137
+ expect(subject.date).to eq("created" => "2012-01-10", "published" => "1996",
138
+ "registered" => "2010-07-22", "updated" => "2023-02-02")
136
139
  expect(subject.license).to be_nil
137
- expect(subject.publisher).to eq('name' => 'GESIS Data Archive')
138
- expect(subject.provider).to eq('DataCite')
140
+ expect(subject.publisher).to eq("name" => "GESIS Data Archive")
141
+ expect(subject.provider).to eq("DataCite")
139
142
  end
140
143
 
141
- it 'subject scheme' do
142
- input = 'https://doi.org/10.6084/m9.figshare.3475223.v1'
144
+ it "subject scheme" do
145
+ input = "https://doi.org/10.6084/m9.figshare.3475223.v1"
143
146
  subject = described_class.new(input: input)
144
- expect(subject.id).to eq('https://doi.org/10.6084/m9.figshare.3475223.v1')
145
- expect(subject.type).to eq('Image')
146
- expect(subject.creators).to eq([{ 'familyName' => 'Franklund', 'givenName' => 'Clifton',
147
- 'type' => 'Person' }])
148
- expect(subject.date).to eq('created' => '2016-07-08',
149
- 'published' => '2016',
150
- 'registered' => '2016-07-08',
151
- 'updated' => '2020-09-04')
152
- expect(subject.license).to eq('id' => 'CC-BY-4.0',
153
- 'url' => 'https://creativecommons.org/licenses/by/4.0/legalcode')
147
+ expect(subject.id).to eq("https://doi.org/10.6084/m9.figshare.3475223.v1")
148
+ expect(subject.type).to eq("Image")
149
+ expect(subject.contributors).to eq([{ "familyName" => "Franklund", "givenName" => "Clifton",
150
+ "type" => "Person", "contributorRoles" => ["Author"] }])
151
+ expect(subject.date).to eq("created" => "2016-07-08",
152
+ "published" => "2016",
153
+ "registered" => "2016-07-08",
154
+ "updated" => "2020-09-04")
155
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
156
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
154
157
  end
155
158
  end
156
159
  end