commonmeta-ruby 3.3.16 → 3.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/commonmeta/readers/json_feed_reader.rb +5 -6
- data/lib/commonmeta/utils.rb +14 -0
- data/lib/commonmeta/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blog_post_with_non-url_id.yml +18 -88
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml +11 -50
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_author_name_suffix.yml +64 -173
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_doi.yml +13 -75
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_institutional_author.yml +15 -11
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml +15 -46
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_without_doi.yml +17 -155
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml +14 -45
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post_with_anonymous_author.yml +13 -16
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/substack_post_with_broken_reference.yml +938 -1865
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/syldavia_gazette_post_with_references.yml +128 -267
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/upstream_post_with_references.yml +570 -1279
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post.yml +12 -119
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_many_references.yml +4095 -5759
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_references.yml +24 -220
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_tracking_code_on_url.yml +13 -12
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_anonymous_author.yml +13 -16
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml +12 -119
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml +15 -46
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_upstream_blog.yml +13 -201
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_with_references.yml +104 -813
- data/spec/readers/json_feed_reader_spec.rb +19 -21
- data/spec/utils_spec.rb +40 -0
- data/spec/writers/crossref_xml_writer_spec.rb +4 -4
- metadata +2 -2
@@ -15,7 +15,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
15
15
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "f3629c86-06e0-42c0-844a-266b03a91ef1", "alternateIdentifierType" => "UUID" }])
|
16
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")
|
18
|
+
expect(subject.creators.first).to eq("id" => "https://orcid.org/0000-0002-7101-9767", "familyName" => "Page", "givenName" => "Roderic", "type" => "Person")
|
19
19
|
expect(subject.titles).to eq([{ "title" => "Ten years and a million links" }])
|
20
20
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
21
21
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
@@ -43,7 +43,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
43
43
|
expect(subject.titles).to eq([{ "title" => "Does it compose?" }])
|
44
44
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
45
45
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
46
|
-
expect(subject.date).to eq("published"
|
46
|
+
expect(subject.date).to eq("published"=>"2023-05-16", "updated"=>"2023-06-18")
|
47
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
48
|
expect(subject.publisher).to eq("name" => "Front Matter")
|
49
49
|
expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
|
@@ -67,8 +67,8 @@ describe Commonmeta::Metadata, vcr: true do
|
|
67
67
|
expect(subject.titles).to eq([{ "title" => "The Residency Visual Abstract" }])
|
68
68
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
69
69
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
70
|
-
expect(subject.date).to eq("published"
|
71
|
-
expect(subject.descriptions.first["description"]).to start_with("
|
70
|
+
expect(subject.date).to eq("published"=>"2023-04-08", "updated"=>"2023-04-08")
|
71
|
+
expect(subject.descriptions.first["description"]).to start_with("My prototype for a Residency Visual Abstract")
|
72
72
|
expect(subject.publisher).to eq("name" => "I.D.E.A.S.")
|
73
73
|
expect(subject.subjects).to eq([{ "subject" => "Medical and health sciences" },
|
74
74
|
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
@@ -79,20 +79,20 @@ describe Commonmeta::Metadata, vcr: true do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it "ghost post with author name suffix" do
|
82
|
-
input = "https://rogue-scholar.org/api/posts/
|
82
|
+
input = "https://rogue-scholar.org/api/posts/153d65e1-f0e4-49a6-a969-33d2129800ba"
|
83
83
|
subject = described_class.new(input: input)
|
84
84
|
expect(subject.valid?).to be true
|
85
85
|
expect(subject.id).to eq("https://doi.org/10.59350/ytvy2-59450")
|
86
86
|
expect(subject.url).to eq("https://www.ideasurg.pub/academic-powerhouse")
|
87
|
-
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "
|
87
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "153d65e1-f0e4-49a6-a969-33d2129800ba", "alternateIdentifierType" => "UUID" }])
|
88
88
|
expect(subject.type).to eq("Article")
|
89
89
|
expect(subject.creators.length).to eq(1)
|
90
90
|
expect(subject.creators.first).to eq("familyName" => "Sathe", "givenName" => "Tejas S.", "type" => "Person")
|
91
91
|
expect(subject.titles).to eq([{ "title" => "How to Build an Academic Powerhouse: Let's Study Who's Doing it" }])
|
92
92
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
93
93
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
94
|
-
expect(subject.date).to eq("published"
|
95
|
-
expect(subject.descriptions.first["description"]).to start_with("
|
94
|
+
expect(subject.date).to eq("published"=>"2023-06-03", "updated"=>"2023-06-03")
|
95
|
+
expect(subject.descriptions.first["description"]).to start_with("Students and residents aspiring for a career in academic surgery")
|
96
96
|
expect(subject.publisher).to eq("name" => "I.D.E.A.S.")
|
97
97
|
expect(subject.subjects).to eq([{ "subject" => "Medical and health sciences" },
|
98
98
|
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
@@ -106,8 +106,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
106
106
|
it "syldavia gazette post with references" do
|
107
107
|
input = "https://rogue-scholar.org/api/posts/0022b9ef-525a-4a79-81ad-13411697f58a"
|
108
108
|
subject = described_class.new(input: input)
|
109
|
-
|
110
|
-
# expect(subject.valid?).to be true
|
109
|
+
expect(subject.valid?).to be true
|
111
110
|
expect(subject.id).to eq("https://doi.org/10.53731/ffbx660-083tnag")
|
112
111
|
expect(subject.url).to eq("https://syldavia-gazette.org/guinea-worms-chatgpt-neanderthals")
|
113
112
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "0022b9ef-525a-4a79-81ad-13411697f58a", "alternateIdentifierType" => "UUID" }])
|
@@ -179,8 +178,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
179
178
|
it "wordpress post with tracking code on url" do
|
180
179
|
input = "https://rogue-scholar.org/api/posts/5d95d90d-ff59-4c8b-b7f8-44e6b45fd593"
|
181
180
|
subject = described_class.new(input: input)
|
182
|
-
|
183
|
-
# expect(subject.valid?).to be true
|
181
|
+
expect(subject.valid?).to be true
|
184
182
|
expect(subject.id).to eq("https://doi.org/10.59350/tpa8t-j6292")
|
185
183
|
expect(subject.url).to eq("https://www.samuelmoore.org/2023/04/20/how-to-cultivate-good-closures-scaling-small-and-the-limits-of-openness")
|
186
184
|
expect(subject.type).to eq("Article")
|
@@ -205,7 +203,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
205
203
|
input = "https://rogue-scholar.org/api/posts/2b3cdd27-5123-4167-9482-3c074392e2d2"
|
206
204
|
subject = described_class.new(input: input)
|
207
205
|
expect(subject.valid?).to be true
|
208
|
-
expect(subject.id).to eq("https://
|
206
|
+
expect(subject.id).to eq("https://doi.org/10.59350/tfahc-rp566")
|
209
207
|
expect(subject.url).to eq("https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice")
|
210
208
|
expect(subject.type).to eq("Article")
|
211
209
|
expect(subject.creators.length).to eq(1)
|
@@ -213,7 +211,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
213
211
|
expect(subject.titles).to eq([{ "title" => "Nature features OA.Report's work putting OA policy into practice!" }])
|
214
212
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
215
213
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
216
|
-
expect(subject.date).to eq("published"
|
214
|
+
expect(subject.date).to eq("published"=>"2023-01-24", "updated"=>"2023-01-24")
|
217
215
|
expect(subject.descriptions.first["description"]).to start_with("After a couple of years of working to support institutions implementing their OA policies")
|
218
216
|
expect(subject.publisher).to eq("name" => "OA.Works Blog")
|
219
217
|
expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
|
@@ -278,7 +276,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
278
276
|
input = "https://rogue-scholar.org/api/posts/5561f8e4-2ff1-4186-a8d5-8dacb3afe414"
|
279
277
|
subject = described_class.new(input: input)
|
280
278
|
expect(subject.valid?).to be true
|
281
|
-
expect(subject.id).to eq("https://
|
279
|
+
expect(subject.id).to eq("https://doi.org/10.59350/2shz7-ehx26")
|
282
280
|
expect(subject.url).to eq("https://libscie.org/ku-leuven-supports-researchequals")
|
283
281
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5561f8e4-2ff1-4186-a8d5-8dacb3afe414", "alternateIdentifierType" => "UUID" }])
|
284
282
|
expect(subject.type).to eq("Article")
|
@@ -287,7 +285,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
287
285
|
expect(subject.titles).to eq([{ "title" => "KU Leuven supports ResearchEquals" }])
|
288
286
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
289
287
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
290
|
-
expect(subject.date).to eq("published"
|
288
|
+
expect(subject.date).to eq("published"=>"2023-05-09", "updated"=>"2023-05-09")
|
291
289
|
expect(subject.descriptions.first["description"]).to start_with("KU Leuven is now an inaugural supporting member of ResearchEquals")
|
292
290
|
expect(subject.publisher).to eq("name" => "Liberate Science")
|
293
291
|
expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
|
@@ -303,12 +301,12 @@ describe Commonmeta::Metadata, vcr: true do
|
|
303
301
|
input = "https://rogue-scholar.org/api/posts/a163e340-5b3c-4736-9ab0-8c54fdff6a3c"
|
304
302
|
subject = described_class.new(input: input)
|
305
303
|
expect(subject.valid?).to be true
|
306
|
-
expect(subject.id).to eq("https://doi.org/10.59350/
|
304
|
+
expect(subject.id).to eq("https://doi.org/10.59350/33es7-fqz31")
|
307
305
|
expect(subject.url).to eq("https://lab.sub.uni-goettingen.de/welcome.html")
|
308
306
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
|
309
307
|
expect(subject.type).to eq("Article")
|
310
308
|
expect(subject.creators.length).to eq(1)
|
311
|
-
expect(subject.creators.first).to eq("
|
309
|
+
expect(subject.creators.first).to eq("familyName"=>"Göbel", "givenName"=>"Mathias", "type"=>"Person")
|
312
310
|
expect(subject.titles).to eq([{ "title" => "Welcome to the Lab" }])
|
313
311
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
314
312
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
@@ -353,7 +351,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
353
351
|
input = "https://rogue-scholar.org/api/posts/f3dc29da-0481-4f3b-8110-4c07260fca67"
|
354
352
|
subject = described_class.new(input: input)
|
355
353
|
expect(subject.valid?).to be true
|
356
|
-
expect(subject.id).to eq("https://
|
354
|
+
expect(subject.id).to eq("https://doi.org/10.59350/9gfjs-pey70")
|
357
355
|
expect(subject.url).to eq("https://flavoursofopen.science/grundlagen-fur-die-entwicklung-einer-open-scholarship-strategie")
|
358
356
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "f3dc29da-0481-4f3b-8110-4c07260fca67", "alternateIdentifierType" => "UUID" }])
|
359
357
|
expect(subject.type).to eq("Article")
|
@@ -388,8 +386,8 @@ describe Commonmeta::Metadata, vcr: true do
|
|
388
386
|
expect(subject.titles).to eq([{ "title" => "The Preregistration Prescriptiveness Trade-Off and Unknown Unknowns in Science" }])
|
389
387
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
390
388
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
391
|
-
expect(subject.date).to eq("published"
|
392
|
-
expect(subject.descriptions.first["description"]).to start_with("
|
389
|
+
expect(subject.date).to eq("published"=>"2023-06-06", "updated"=>"2023-06-06")
|
390
|
+
expect(subject.descriptions.first["description"]).to start_with("AbstractI discuss Van Drimmelen’s (2023) Metascience2023 presentation")
|
393
391
|
expect(subject.publisher).to eq("name" => "Critical Metascience")
|
394
392
|
expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
|
395
393
|
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
data/spec/utils_spec.rb
CHANGED
@@ -393,6 +393,46 @@ describe Commonmeta::Metadata do
|
|
393
393
|
end
|
394
394
|
end
|
395
395
|
|
396
|
+
context "get_datetime_from_unix_timestamp" do
|
397
|
+
it "present" do
|
398
|
+
timestamp = 1582703829
|
399
|
+
response = subject.get_datetime_from_unix_timestamp(timestamp)
|
400
|
+
expect(response).to eq("2020-02-26T07:57:09Z")
|
401
|
+
end
|
402
|
+
|
403
|
+
it "past" do
|
404
|
+
timestamp = 844144
|
405
|
+
response = subject.get_datetime_from_unix_timestamp(timestamp)
|
406
|
+
expect(response).to eq("1970-01-10T18:29:04Z")
|
407
|
+
end
|
408
|
+
|
409
|
+
it "future" do
|
410
|
+
timestamp = 2410244144
|
411
|
+
response = subject.get_datetime_from_unix_timestamp(timestamp)
|
412
|
+
expect(response).to eq("2046-05-18T08:15:44Z")
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
context "get_date_from_unix_timestamp" do
|
417
|
+
it "present" do
|
418
|
+
timestamp = 1582703829
|
419
|
+
response = subject.get_date_from_unix_timestamp(timestamp)
|
420
|
+
expect(response).to eq("2020-02-26")
|
421
|
+
end
|
422
|
+
|
423
|
+
it "past" do
|
424
|
+
timestamp = 844144
|
425
|
+
response = subject.get_date_from_unix_timestamp(timestamp)
|
426
|
+
expect(response).to eq("1970-01-10")
|
427
|
+
end
|
428
|
+
|
429
|
+
it "future" do
|
430
|
+
timestamp = 2410244144
|
431
|
+
response = subject.get_date_from_unix_timestamp(timestamp)
|
432
|
+
expect(response).to eq("2046-05-18")
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
396
436
|
context "get_date_parts" do
|
397
437
|
it "date" do
|
398
438
|
date = "2016-12-20"
|
@@ -175,7 +175,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
175
175
|
subject = described_class.new(input: input)
|
176
176
|
|
177
177
|
expect(subject.valid?).to be true
|
178
|
-
expect(subject.id).to eq("https://doi.org/10.54900/
|
178
|
+
expect(subject.id).to eq("https://doi.org/10.54900/n6dnt-xpq48")
|
179
179
|
expect(subject.url).to eq("https://upstream.force11.org/attempts-at-automating-journal-subject-classification")
|
180
180
|
expect(subject.type).to eq("Article")
|
181
181
|
expect(subject.titles).to eq([{ "title" => "Attempts at automating journal subject classification" }])
|
@@ -295,7 +295,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
295
295
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
|
296
296
|
expect(subject.type).to eq("Article")
|
297
297
|
expect(subject.creators.length).to eq(1)
|
298
|
-
expect(subject.creators.first).to eq("
|
298
|
+
expect(subject.creators.first).to eq("familyName"=>"Göbel", "givenName"=>"Mathias", "type"=>"Person")
|
299
299
|
expect(subject.titles).to eq([{ "title" => "Welcome to the Lab" }])
|
300
300
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
301
301
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
@@ -310,9 +310,9 @@ describe Commonmeta::Metadata, vcr: true do
|
|
310
310
|
expect(subject.container).to eq("identifier" => "https://lab.sub.uni-goettingen.de/", "identifierType" => "URL", "title" => "lab.sub - Articles", "type" => "Periodical")
|
311
311
|
expect(subject.references).to be_nil
|
312
312
|
crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
|
313
|
-
expect(Array.wrap(crossref_xml.dig("contributors", "
|
313
|
+
expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(1)
|
314
314
|
expect(Array.wrap(crossref_xml.dig("contributors",
|
315
|
-
"
|
315
|
+
"person_name")).first).to eq("contributor_role"=>"author", "given_name"=>"Mathias", "sequence"=>"first", "surname"=>"Göbel")
|
316
316
|
expect(crossref_xml.dig("titles",
|
317
317
|
"title")).to eq("Welcome to the Lab")
|
318
318
|
expect(crossref_xml.dig('item_number')).to eq("__content__"=>"a163e3405b3c47369ab08c54fdff6a3c", "item_number_type"=>"uuid")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonmeta-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|