commonmeta-ruby 3.2.13 → 3.2.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/commonmeta/crossref_utils.rb +3 -3
- data/lib/commonmeta/readers/json_feed_reader.rb +6 -2
- data/lib/commonmeta/readers/schema_org_reader.rb +1 -1
- data/lib/commonmeta/utils.rb +6 -3
- data/lib/commonmeta/version.rb +1 -1
- data/lib/commonmeta/writers/bibtex_writer.rb +1 -1
- data/lib/commonmeta/writers/ris_writer.rb +1 -1
- data/lib/commonmeta/writers/schema_org_writer.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/substack_post_with_broken_reference.yml +1316 -0
- data/spec/readers/cff_reader_spec.rb +33 -33
- data/spec/readers/codemeta_reader_spec.rb +8 -8
- data/spec/readers/json_feed_reader_spec.rb +204 -154
- data/spec/readers/schema_org_reader_spec.rb +38 -38
- data/spec/utils_spec.rb +3 -3
- data/spec/writers/bibtex_writer_spec.rb +3 -3
- data/spec/writers/cff_writer_spec.rb +2 -2
- data/spec/writers/crossref_xml_writer_spec.rb +21 -9
- data/spec/writers/ris_writer_spec.rb +8 -8
- data/spec/writers/schema_org_writer_spec.rb +6 -6
- metadata +3 -2
@@ -1,220 +1,270 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Commonmeta::Metadata, vcr: true do
|
6
6
|
subject { described_class.new }
|
7
7
|
|
8
|
-
context
|
9
|
-
it
|
10
|
-
input =
|
8
|
+
context "get json_feed_item metadata" do
|
9
|
+
it "blogger post" do
|
10
|
+
input = "https://rogue-scholar.org/api/posts/f3629c86-06e0-42c0-844a-266b03a91ef1"
|
11
11
|
subject = described_class.new(input: input)
|
12
12
|
expect(subject.valid?).to be true
|
13
|
-
expect(subject.id).to eq(
|
14
|
-
expect(subject.url).to eq(
|
15
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"f3629c86-06e0-42c0-844a-266b03a91ef1", "alternateIdentifierType"=>"UUID"}])
|
16
|
-
expect(subject.type).to eq(
|
13
|
+
expect(subject.id).to eq("https://iphylo.blogspot.com/2023/05/ten-years-and-million-links.html")
|
14
|
+
expect(subject.url).to eq("https://iphylo.blogspot.com/2023/05/ten-years-and-million-links.html")
|
15
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "f3629c86-06e0-42c0-844a-266b03a91ef1", "alternateIdentifierType" => "UUID" }])
|
16
|
+
expect(subject.type).to eq("Article")
|
17
17
|
expect(subject.creators.length).to eq(1)
|
18
|
-
expect(subject.creators.first).to eq("familyName"=>"Page", "givenName"=>"Roderic", "type"=>"Person")
|
19
|
-
expect(subject.titles).to eq([{"title"=>"Ten years and a million links"}])
|
20
|
-
expect(subject.license).to eq(
|
21
|
-
|
22
|
-
expect(subject.date).to eq(
|
23
|
-
expect(subject.descriptions.first[
|
24
|
-
expect(subject.publisher).to eq(
|
25
|
-
expect(subject.subjects).to
|
26
|
-
|
27
|
-
|
18
|
+
expect(subject.creators.first).to eq("familyName" => "Page", "givenName" => "Roderic", "type" => "Person")
|
19
|
+
expect(subject.titles).to eq([{ "title" => "Ten years and a million links" }])
|
20
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
21
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
22
|
+
expect(subject.date).to eq("published" => "2023-05-31")
|
23
|
+
expect(subject.descriptions.first["description"]).to start_with("As trailed on a Twitter thread last week I’ve been working on a manuscript describing the efforts to map taxonomic names to their original descriptions in the taxonomic literature.")
|
24
|
+
expect(subject.publisher).to eq("name" => "iPhylo")
|
25
|
+
expect(subject.subjects).to eq([{ "subject" => "Natural sciences" },
|
26
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
27
|
+
"subject" => "FOS: Natural sciences",
|
28
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
29
|
+
expect(subject.language).to eq("en")
|
30
|
+
expect(subject.container).to eq("identifier" => "https://iphylo.blogspot.com/", "identifierType" => "URL", "title" => "iPhylo", "type" => "Periodical")
|
28
31
|
end
|
29
32
|
|
30
|
-
it
|
31
|
-
input =
|
33
|
+
it "ghost post with doi" do
|
34
|
+
input = "https://rogue-scholar.org/api/posts/5bb66e92-5cb9-4659-8aca-20e486b695c9"
|
32
35
|
subject = described_class.new(input: input)
|
33
36
|
expect(subject.valid?).to be true
|
34
|
-
expect(subject.id).to eq(
|
35
|
-
expect(subject.url).to eq(
|
36
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"5bb66e92-5cb9-4659-8aca-20e486b695c9", "alternateIdentifierType"=>"UUID"}])
|
37
|
-
expect(subject.type).to eq(
|
37
|
+
expect(subject.id).to eq("https://doi.org/10.53731/4nwxn-frt36")
|
38
|
+
expect(subject.url).to eq("https://blog.front-matter.io/posts/does-it-compose")
|
39
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5bb66e92-5cb9-4659-8aca-20e486b695c9", "alternateIdentifierType" => "UUID" }])
|
40
|
+
expect(subject.type).to eq("Article")
|
38
41
|
expect(subject.creators.length).to eq(1)
|
39
|
-
expect(subject.creators.first).to eq("id" => "https://orcid.org/0000-0003-1419-2405", "familyName"=>"Fenner", "givenName"=>"Martin", "type"=>"Person")
|
40
|
-
expect(subject.titles).to eq([{"title"=>"Does it compose?"}])
|
41
|
-
expect(subject.license).to eq(
|
42
|
-
|
43
|
-
expect(subject.date).to eq(
|
44
|
-
expect(subject.descriptions.first[
|
45
|
-
expect(subject.publisher).to eq(
|
46
|
-
expect(subject.subjects).to eq([{"subject"=>"
|
47
|
-
|
48
|
-
|
42
|
+
expect(subject.creators.first).to eq("id" => "https://orcid.org/0000-0003-1419-2405", "familyName" => "Fenner", "givenName" => "Martin", "type" => "Person")
|
43
|
+
expect(subject.titles).to eq([{ "title" => "Does it compose?" }])
|
44
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
45
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
46
|
+
expect(subject.date).to eq("published" => "2023-05-16", "updated" => "2023-05-16")
|
47
|
+
expect(subject.descriptions.first["description"]).to start_with("One question I have increasingly asked myself in the past few years. Meaning Can I run this open source software using Docker containers and a Docker Compose file?")
|
48
|
+
expect(subject.publisher).to eq("name" => "Front Matter")
|
49
|
+
expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
|
50
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
51
|
+
"subject" => "FOS: Engineering and technology",
|
52
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
53
|
+
expect(subject.language).to eq("en")
|
54
|
+
expect(subject.container).to eq("identifier" => "https://blog.front-matter.io", "identifierType" => "URL", "title" => "Front Matter", "type" => "Periodical")
|
49
55
|
end
|
50
56
|
|
51
|
-
it
|
52
|
-
input =
|
57
|
+
it "ghost post without doi" do
|
58
|
+
input = "https://rogue-scholar.org/api/posts/c3095752-2af0-40a4-a229-3ceb7424bce2"
|
53
59
|
subject = described_class.new(input: input)
|
54
60
|
expect(subject.valid?).to be true
|
55
|
-
expect(subject.id).to eq(
|
56
|
-
expect(subject.url).to eq(
|
57
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"c3095752-2af0-40a4-a229-3ceb7424bce2", "alternateIdentifierType"=>"UUID"}])
|
58
|
-
expect(subject.type).to eq(
|
61
|
+
expect(subject.id).to eq("https://www.ideasurg.pub/residency-visual-abstract")
|
62
|
+
expect(subject.url).to eq("https://www.ideasurg.pub/residency-visual-abstract")
|
63
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "c3095752-2af0-40a4-a229-3ceb7424bce2", "alternateIdentifierType" => "UUID" }])
|
64
|
+
expect(subject.type).to eq("Article")
|
59
65
|
expect(subject.creators.length).to eq(1)
|
60
|
-
expect(subject.creators.first).to eq("familyName"=>"Sathe", "givenName"=>"Tejas S.", "type"=>"Person")
|
61
|
-
expect(subject.titles).to eq([{"title"=>"The Residency Visual Abstract"}])
|
62
|
-
expect(subject.license).to eq(
|
63
|
-
|
64
|
-
expect(subject.date).to eq(
|
65
|
-
expect(subject.descriptions.first[
|
66
|
-
expect(subject.publisher).to eq(
|
67
|
-
expect(subject.subjects).to
|
68
|
-
|
69
|
-
|
66
|
+
expect(subject.creators.first).to eq("familyName" => "Sathe", "givenName" => "Tejas S.", "type" => "Person")
|
67
|
+
expect(subject.titles).to eq([{ "title" => "The Residency Visual Abstract" }])
|
68
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
69
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
70
|
+
expect(subject.date).to eq("published" => "2023-04-08")
|
71
|
+
expect(subject.descriptions.first["description"]).to start_with("A graphical, user-friendly tool for programs to highlight important data to prospective applicants")
|
72
|
+
expect(subject.publisher).to eq("name" => "I.D.E.A.S.")
|
73
|
+
expect(subject.subjects).to eq([{ "subject" => "Medical and health sciences" },
|
74
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
75
|
+
"subject" => "FOS: Medical and health sciences",
|
76
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
77
|
+
expect(subject.language).to eq("en")
|
78
|
+
expect(subject.container).to eq("identifier" => "https://www.ideasurg.pub/", "identifierType" => "URL", "title" => "I.D.E.A.S.", "type" => "Periodical")
|
70
79
|
end
|
71
80
|
|
72
|
-
it
|
73
|
-
input =
|
81
|
+
it "ghost post with author name suffix" do
|
82
|
+
input = "https://rogue-scholar.org/api/posts/6179ad80-cc7f-4904-9260-0ecb3c3a90ba"
|
74
83
|
subject = described_class.new(input: input)
|
75
84
|
expect(subject.valid?).to be true
|
76
|
-
expect(subject.id).to eq(
|
77
|
-
expect(subject.url).to eq(
|
78
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"6179ad80-cc7f-4904-9260-0ecb3c3a90ba", "alternateIdentifierType"=>"UUID"}])
|
79
|
-
expect(subject.type).to eq(
|
85
|
+
expect(subject.id).to eq("https://www.ideasurg.pub/academic-powerhouse")
|
86
|
+
expect(subject.url).to eq("https://www.ideasurg.pub/academic-powerhouse")
|
87
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "6179ad80-cc7f-4904-9260-0ecb3c3a90ba", "alternateIdentifierType" => "UUID" }])
|
88
|
+
expect(subject.type).to eq("Article")
|
80
89
|
expect(subject.creators.length).to eq(1)
|
81
|
-
expect(subject.creators.first).to eq("familyName"=>"Sathe", "givenName"=>"Tejas S.", "type"=>"Person")
|
82
|
-
expect(subject.titles).to eq([{"title"=>"How to Build an Academic Powerhouse: Let's Study Who's Doing it"}])
|
83
|
-
expect(subject.license).to eq(
|
84
|
-
|
85
|
-
expect(subject.date).to eq(
|
86
|
-
expect(subject.descriptions.first[
|
87
|
-
expect(subject.publisher).to eq(
|
88
|
-
expect(subject.subjects).to eq([{"subject"=>"
|
89
|
-
|
90
|
-
|
90
|
+
expect(subject.creators.first).to eq("familyName" => "Sathe", "givenName" => "Tejas S.", "type" => "Person")
|
91
|
+
expect(subject.titles).to eq([{ "title" => "How to Build an Academic Powerhouse: Let's Study Who's Doing it" }])
|
92
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
93
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
94
|
+
expect(subject.date).to eq("published" => "2023-06-03")
|
95
|
+
expect(subject.descriptions.first["description"]).to start_with("A Data Exploration with Public Data from the Academic Surgical Congress")
|
96
|
+
expect(subject.publisher).to eq("name" => "I.D.E.A.S.")
|
97
|
+
expect(subject.subjects).to eq([{ "subject" => "Medical and health sciences" },
|
98
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
99
|
+
"subject" => "FOS: Medical and health sciences",
|
100
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
101
|
+
expect(subject.language).to eq("en")
|
102
|
+
expect(subject.container).to eq("identifier" => "https://www.ideasurg.pub/", "identifierType" => "URL", "title" => "I.D.E.A.S.", "type" => "Periodical")
|
91
103
|
expect(subject.references).to be_nil
|
92
104
|
end
|
93
105
|
|
94
|
-
it
|
95
|
-
input =
|
106
|
+
it "syldavia gazette post with references" do
|
107
|
+
input = "https://rogue-scholar.org/api/posts/0022b9ef-525a-4a79-81ad-13411697f58a"
|
96
108
|
subject = described_class.new(input: input)
|
97
109
|
expect(subject.valid?).to be true
|
98
|
-
expect(subject.id).to eq(
|
99
|
-
expect(subject.url).to eq(
|
100
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"0022b9ef-525a-4a79-81ad-13411697f58a", "alternateIdentifierType"=>"UUID"}])
|
101
|
-
expect(subject.type).to eq(
|
110
|
+
expect(subject.id).to eq("https://doi.org/10.53731/ffbx660-083tnag")
|
111
|
+
expect(subject.url).to eq("https://syldavia-gazette.org/guinea-worms-chatgpt-neanderthals")
|
112
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "0022b9ef-525a-4a79-81ad-13411697f58a", "alternateIdentifierType" => "UUID" }])
|
113
|
+
expect(subject.type).to eq("Article")
|
102
114
|
expect(subject.creators.length).to eq(1)
|
103
|
-
expect(subject.creators.first).to eq("familyName"=>"Fenner", "givenName"=>"Martin", "id"=>"https://orcid.org/0000-0003-1419-2405", "type"=>"Person")
|
104
|
-
expect(subject.titles).to eq([{"title"=>"Guinea Worms, ChatGPT, Neanderthals, Plagiarism, Tidyverse"}])
|
105
|
-
expect(subject.license).to eq(
|
106
|
-
|
107
|
-
expect(subject.date).to eq(
|
108
|
-
expect(subject.descriptions.first[
|
109
|
-
expect(subject.publisher).to eq(
|
110
|
-
expect(subject.subjects).to
|
111
|
-
expect(subject.language).to eq(
|
112
|
-
expect(subject.container).to eq("identifier"=>"https://syldavia-gazette.org", "identifierType"=>"URL", "title"=>"Syldavia Gazette", "type"=>"Periodical")
|
115
|
+
expect(subject.creators.first).to eq("familyName" => "Fenner", "givenName" => "Martin", "id" => "https://orcid.org/0000-0003-1419-2405", "type" => "Person")
|
116
|
+
expect(subject.titles).to eq([{ "title" => "Guinea Worms, ChatGPT, Neanderthals, Plagiarism, Tidyverse" }])
|
117
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
118
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
119
|
+
expect(subject.date).to eq("published" => "2023-02-01", "updated" => "2023-04-13")
|
120
|
+
expect(subject.descriptions.first["description"]).to start_with("Guinea worm disease reaches all-time low: only 13* human cases reported in 2022")
|
121
|
+
expect(subject.publisher).to eq("name" => "Syldavia Gazette")
|
122
|
+
expect(subject.subjects).to eq([{ "subject" => "Humanities" }, { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf", "subject" => "FOS: Humanities", "subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
123
|
+
expect(subject.language).to eq("en")
|
124
|
+
expect(subject.container).to eq("identifier" => "https://syldavia-gazette.org", "identifierType" => "URL", "title" => "Syldavia Gazette", "type" => "Periodical")
|
113
125
|
expect(subject.references.length).to eq(5)
|
114
|
-
expect(subject.references.first).to eq("key"=>"ref1", "url"=>"https://cartercenter.org/news/pr/2023/2022-guinea-worm-worldwide-cases-announcement.html")
|
126
|
+
expect(subject.references.first).to eq("key" => "ref1", "url" => "https://cartercenter.org/news/pr/2023/2022-guinea-worm-worldwide-cases-announcement.html")
|
115
127
|
end
|
116
128
|
|
117
|
-
it
|
118
|
-
input =
|
129
|
+
it "wordpress post" do
|
130
|
+
input = "https://rogue-scholar.org/api/posts/1c578558-1324-4493-b8af-84c49eabc52f"
|
119
131
|
subject = described_class.new(input: input)
|
120
132
|
expect(subject.valid?).to be true
|
121
|
-
expect(subject.id).to eq(
|
122
|
-
expect(subject.url).to eq(
|
123
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"1c578558-1324-4493-b8af-84c49eabc52f", "alternateIdentifierType"=>"UUID"}])
|
124
|
-
expect(subject.type).to eq(
|
133
|
+
expect(subject.id).to eq("http://wisspub.net/?p=20455")
|
134
|
+
expect(subject.url).to eq("https://wisspub.net/2023/05/23/eu-mitgliedstaaten-betonen-die-rolle-von-wissenschaftsgeleiteten-open-access-modellen-jenseits-von-apcs")
|
135
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "1c578558-1324-4493-b8af-84c49eabc52f", "alternateIdentifierType" => "UUID" }])
|
136
|
+
expect(subject.type).to eq("Article")
|
125
137
|
expect(subject.creators.length).to eq(1)
|
126
|
-
expect(subject.creators.first).to eq("familyName"=>"Pampel", "givenName"=>"Heinz", "id"=>"https://orcid.org/0000-0003-3334-2771", "type"=>"Person")
|
127
|
-
expect(subject.titles).to eq([{"title"=>"EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs"}])
|
128
|
-
expect(subject.license).to eq(
|
129
|
-
|
130
|
-
expect(subject.date).to eq(
|
131
|
-
expect(subject.descriptions.first[
|
132
|
-
expect(subject.publisher).to eq(
|
133
|
-
expect(subject.subjects).to eq([{"subject"=>
|
134
|
-
|
135
|
-
|
138
|
+
expect(subject.creators.first).to eq("familyName" => "Pampel", "givenName" => "Heinz", "id" => "https://orcid.org/0000-0003-3334-2771", "type" => "Person")
|
139
|
+
expect(subject.titles).to eq([{ "title" => "EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs" }])
|
140
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
141
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
142
|
+
expect(subject.date).to eq("published" => "2023-05-23", "updated" => "2023-05-23")
|
143
|
+
expect(subject.descriptions.first["description"]).to start_with("Die EU-Wissenschaftsministerien haben sich auf ihrer heutigen Sitzung in Brüssel unter dem Titel “Council conclusions on high-quality, transparent, open, trustworthy and equitable scholarly publishing”")
|
144
|
+
expect(subject.publisher).to eq("name" => "wisspub.net")
|
145
|
+
expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
|
146
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
147
|
+
"subject" => "FOS: Engineering and technology",
|
148
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
149
|
+
expect(subject.language).to eq("de")
|
150
|
+
expect(subject.container).to eq("identifier" => "https://wisspub.net", "identifierType" => "URL", "title" => "wisspub.net", "type" => "Periodical")
|
136
151
|
end
|
137
152
|
|
138
|
-
it
|
139
|
-
input =
|
153
|
+
it "wordpress post with references" do
|
154
|
+
input = "https://rogue-scholar.org/api/posts/4e4bf150-751f-4245-b4ca-fe69e3c3bb24"
|
140
155
|
subject = described_class.new(input: input)
|
141
156
|
expect(subject.valid?).to be true
|
142
|
-
expect(subject.id).to eq(
|
143
|
-
expect(subject.url).to eq(
|
144
|
-
expect(subject.type).to eq(
|
157
|
+
expect(subject.id).to eq("http://svpow.com/?p=20992")
|
158
|
+
expect(subject.url).to eq("https://svpow.com/2023/06/09/new-paper-curtice-et-al-2023-on-the-first-haplocanthosaurus-from-dry-mesa")
|
159
|
+
expect(subject.type).to eq("Article")
|
145
160
|
expect(subject.creators.length).to eq(1)
|
146
|
-
expect(subject.creators.first).to eq("familyName"=>"Wedel", "givenName"=>"Matt", "type"=>"Person")
|
147
|
-
expect(subject.titles).to eq([{"title"=>"New paper: Curtice et al. (2023) on the first Haplocanthosaurus from Dry Mesa"}])
|
148
|
-
expect(subject.license).to eq(
|
149
|
-
|
150
|
-
expect(subject.date).to eq(
|
151
|
-
expect(subject.descriptions.first[
|
152
|
-
expect(subject.publisher).to eq(
|
153
|
-
expect(subject.subjects).to eq([{"subject"=>
|
154
|
-
|
155
|
-
|
161
|
+
expect(subject.creators.first).to eq("familyName" => "Wedel", "givenName" => "Matt", "type" => "Person")
|
162
|
+
expect(subject.titles).to eq([{ "title" => "New paper: Curtice et al. (2023) on the first Haplocanthosaurus from Dry Mesa" }])
|
163
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
164
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
165
|
+
expect(subject.date).to eq("published" => "2023-06-09", "updated" => "2023-06-09")
|
166
|
+
expect(subject.descriptions.first["description"]).to start_with("Haplocanthosaurus tibiae and dorsal vertebrae.")
|
167
|
+
expect(subject.publisher).to eq("name" => "Sauropod Vertebra Picture of the Week")
|
168
|
+
expect(subject.subjects).to eq([{ "subject" => "Natural sciences" },
|
169
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
170
|
+
"subject" => "FOS: Natural sciences",
|
171
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
172
|
+
expect(subject.language).to eq("en")
|
173
|
+
expect(subject.container).to eq("identifier" => "https://svpow.com", "identifierType" => "URL", "title" => "Sauropod Vertebra Picture of the Week", "type" => "Periodical")
|
156
174
|
expect(subject.references.length).to eq(3)
|
157
|
-
expect(subject.references.first).to eq("key"=>"ref1", "url"=>"https://sauroposeidon.files.wordpress.com/2010/04/foster-and-wedel-2014-haplocanthosaurus-from-snowmass-colorado.pdf")
|
175
|
+
expect(subject.references.first).to eq("key" => "ref1", "url" => "https://sauroposeidon.files.wordpress.com/2010/04/foster-and-wedel-2014-haplocanthosaurus-from-snowmass-colorado.pdf")
|
158
176
|
end
|
159
177
|
|
160
|
-
it
|
161
|
-
input =
|
178
|
+
it "upstream post with references" do
|
179
|
+
input = "https://rogue-scholar.org/api/posts/954f8138-0ecd-4090-87c5-cef1297f1470"
|
162
180
|
subject = described_class.new(input: input)
|
163
181
|
expect(subject.valid?).to be true
|
164
|
-
expect(subject.id).to eq(
|
165
|
-
expect(subject.url).to eq(
|
166
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"954f8138-0ecd-4090-87c5-cef1297f1470", "alternateIdentifierType"=>"UUID"}])
|
167
|
-
expect(subject.type).to eq(
|
182
|
+
expect(subject.id).to eq("https://doi.org/10.54900/zwm7q-vet94")
|
183
|
+
expect(subject.url).to eq("https://upstream.force11.org/the-research-software-alliance-resa")
|
184
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "954f8138-0ecd-4090-87c5-cef1297f1470", "alternateIdentifierType" => "UUID" }])
|
185
|
+
expect(subject.type).to eq("Article")
|
168
186
|
expect(subject.creators.length).to eq(2)
|
169
|
-
expect(subject.creators.first).to eq("familyName"=>"Katz", "givenName"=>"Daniel S.", "id"=>"https://orcid.org/0000-0001-5934-7525", "type"=>"Person")
|
170
|
-
expect(subject.titles).to eq([{"title"=>"The Research Software Alliance (ReSA)"}])
|
171
|
-
expect(subject.license).to eq(
|
172
|
-
|
173
|
-
expect(subject.date).to eq(
|
174
|
-
expect(subject.descriptions.first[
|
175
|
-
expect(subject.publisher).to eq(
|
176
|
-
expect(subject.subjects).to eq([{"subject"=>"
|
177
|
-
|
178
|
-
|
187
|
+
expect(subject.creators.first).to eq("familyName" => "Katz", "givenName" => "Daniel S.", "id" => "https://orcid.org/0000-0001-5934-7525", "type" => "Person")
|
188
|
+
expect(subject.titles).to eq([{ "title" => "The Research Software Alliance (ReSA)" }])
|
189
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
190
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
191
|
+
expect(subject.date).to eq("published" => "2023-04-18", "updated" => "2023-04-18")
|
192
|
+
expect(subject.descriptions.first["description"]).to start_with("Research software is a key part of most research today. As University of Manchester Professor Carole Goble has said, \"software is the ubiquitous instrument of science.\"")
|
193
|
+
expect(subject.publisher).to eq("name" => "Upstream")
|
194
|
+
expect(subject.subjects).to eq([{ "subject" => "Humanities" },
|
195
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
196
|
+
"subject" => "FOS: Humanities",
|
197
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
198
|
+
expect(subject.language).to eq("en")
|
199
|
+
expect(subject.container).to eq("identifier" => "https://upstream.force11.org", "identifierType" => "URL", "title" => "Upstream", "type" => "Periodical")
|
179
200
|
expect(subject.references.length).to eq(11)
|
180
|
-
expect(subject.references.first).to eq("key"=>"ref1", "url"=>"https://software.ac.uk/blog/2014-12-04-its-impossible-conduct-research-without-software-say-7-out-10-uk-researchers")
|
201
|
+
expect(subject.references.first).to eq("key" => "ref1", "url" => "https://software.ac.uk/blog/2014-12-04-its-impossible-conduct-research-without-software-say-7-out-10-uk-researchers")
|
181
202
|
end
|
182
203
|
|
183
|
-
it
|
184
|
-
input =
|
204
|
+
it "jekyll post" do
|
205
|
+
input = "https://rogue-scholar.org/api/posts/efdacb04-bcec-49d7-b689-ab3eab0634bf"
|
185
206
|
subject = described_class.new(input: input)
|
186
207
|
expect(subject.valid?).to be true
|
187
|
-
expect(subject.id).to eq(
|
188
|
-
expect(subject.url).to eq(
|
189
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"efdacb04-bcec-49d7-b689-ab3eab0634bf", "alternateIdentifierType"=>"UUID"}])
|
190
|
-
expect(subject.type).to eq(
|
208
|
+
expect(subject.id).to eq("https://citationstyles.org/2020/07/11/seeking-public-comment-on-CSL-1-0-2")
|
209
|
+
expect(subject.url).to eq("https://citationstyles.org/2020/07/11/seeking-public-comment-on-CSL-1-0-2")
|
210
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "efdacb04-bcec-49d7-b689-ab3eab0634bf", "alternateIdentifierType" => "UUID" }])
|
211
|
+
expect(subject.type).to eq("Article")
|
191
212
|
expect(subject.creators.length).to eq(1)
|
192
|
-
expect(subject.creators.first).to eq("familyName"=>"Karcher", "givenName"=>"Sebastian", "type"=>"Person")
|
193
|
-
expect(subject.titles).to eq([{"title"=>"Seeking Public Comment on CSL 1.0.2 Release"}])
|
194
|
-
expect(subject.license).to eq(
|
195
|
-
|
196
|
-
expect(subject.date).to eq(
|
197
|
-
expect(subject.descriptions.first[
|
198
|
-
expect(subject.publisher).to eq(
|
199
|
-
expect(subject.subjects).to
|
200
|
-
|
201
|
-
|
213
|
+
expect(subject.creators.first).to eq("familyName" => "Karcher", "givenName" => "Sebastian", "type" => "Person")
|
214
|
+
expect(subject.titles).to eq([{ "title" => "Seeking Public Comment on CSL 1.0.2 Release" }])
|
215
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
216
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
217
|
+
expect(subject.date).to eq("published" => "2020-07-11", "updated" => "2020-07-11")
|
218
|
+
expect(subject.descriptions.first["description"]).to start_with("Over the past few months, Citation Style Language developers have worked to address a backlog of feature requests. This work will be reflected in two upcoming releases.")
|
219
|
+
expect(subject.publisher).to eq("name" => "Citation Style Language")
|
220
|
+
expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
|
221
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
222
|
+
"subject" => "FOS: Engineering and technology",
|
223
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
224
|
+
expect(subject.language).to eq("en")
|
225
|
+
expect(subject.container).to eq("identifier" => "https://citationstyles.org/", "identifierType" => "URL", "title" => "Citation Style Language", "type" => "Periodical")
|
226
|
+
end
|
227
|
+
|
228
|
+
it "substack post with broken reference" do
|
229
|
+
input = "https://rogue-scholar.org/api/posts/2b105b29-acbc-4eae-9ff1-368803f36a4d"
|
230
|
+
subject = described_class.new(input: input)
|
231
|
+
expect(subject.valid?).to be true
|
232
|
+
expect(subject.id).to eq("https://doi.org/10.59350/bbcsr-r4b59")
|
233
|
+
expect(subject.url).to eq("https://markrubin.substack.com/p/the-preregistration-prescriptiveness")
|
234
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "2b105b29-acbc-4eae-9ff1-368803f36a4d", "alternateIdentifierType" => "UUID" }])
|
235
|
+
expect(subject.type).to eq("Article")
|
236
|
+
expect(subject.creators.length).to eq(1)
|
237
|
+
expect(subject.creators.first).to eq("familyName" => "Rubin", "givenName" => "Mark", "type" => "Person")
|
238
|
+
expect(subject.titles).to eq([{ "title" => "The Preregistration Prescriptiveness Trade-Off and Unknown Unknowns in Science" }])
|
239
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
240
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
241
|
+
expect(subject.date).to eq("published" => "2023-06-06")
|
242
|
+
expect(subject.descriptions.first["description"]).to start_with("Comments on Van Drimmelen (2023)")
|
243
|
+
expect(subject.publisher).to eq("name" => "Critical Metascience")
|
244
|
+
expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
|
245
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
246
|
+
"subject" => "FOS: Social sciences",
|
247
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
248
|
+
expect(subject.language).to eq("en")
|
249
|
+
expect(subject.container).to eq("identifier" => "https://markrubin.substack.com", "identifierType" => "URL", "title" => "Critical Metascience", "type" => "Periodical")
|
250
|
+
expect(subject.references.length).to eq(16)
|
251
|
+
expect(subject.references.first).to eq("key" => "ref1", "doi" => "https://doi.org/10.3386/w27250")
|
202
252
|
end
|
203
253
|
end
|
204
254
|
|
205
|
-
context
|
206
|
-
it
|
255
|
+
context "get json_feed" do
|
256
|
+
it "unregistered posts" do
|
207
257
|
response = subject.get_json_feed_unregistered
|
208
258
|
expect(response).to eq("ca2a7df4-f3b9-487c-82e9-27f54de75ea8")
|
209
259
|
end
|
210
260
|
|
211
|
-
it
|
212
|
-
response = subject.get_json_feed_not_indexed(
|
261
|
+
it "not indexed posts" do
|
262
|
+
response = subject.get_json_feed_not_indexed("2023-01-01")
|
213
263
|
expect(response).to eq("ab58e412-06eb-42b7-b81a-d340825b9d48")
|
214
264
|
end
|
215
265
|
|
216
|
-
it
|
217
|
-
response = subject.get_json_feed_by_blog(
|
266
|
+
it "by blog_id" do
|
267
|
+
response = subject.get_json_feed_by_blog("tyfqw20")
|
218
268
|
expect(response).to eq("3e1278f6-e7c0-43e1-bb54-6829e1344c0d")
|
219
269
|
end
|
220
270
|
end
|