commonmeta-ruby 3.4.3 → 3.4.5
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/crossref_utils.rb +21 -18
- data/lib/commonmeta/readers/json_feed_reader.rb +34 -5
- data/lib/commonmeta/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_related_identifiers_and_funding.yml +580 -0
- 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
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_relations_and_funding.yml +580 -0
- data/spec/readers/json_feed_reader_spec.rb +52 -1
- data/spec/writers/crossref_xml_writer_spec.rb +36 -0
- metadata +5 -2
@@ -323,6 +323,42 @@ describe Commonmeta::Metadata, vcr: true do
|
|
323
323
|
expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
|
324
324
|
end
|
325
325
|
|
326
|
+
it "json_feed_item from rogue scholar with relations and funding" do
|
327
|
+
input = "https://rogue-scholar.org/api/posts/e58dc9c8-b870-4db2-8896-238b3246c551"
|
328
|
+
subject = described_class.new(input: input, doi: "10.53731/r79s4nh-97aq74v-ag4t1")
|
329
|
+
|
330
|
+
expect(subject.valid?).to be true
|
331
|
+
expect(subject.id).to eq("https://doi.org/10.53731/r79s4nh-97aq74v-ag4t1")
|
332
|
+
expect(subject.url).to eq("https://blog.front-matter.io/posts/tracking-the-growth-of-the-pid-graph")
|
333
|
+
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "e58dc9c8-b870-4db2-8896-238b3246c551", "alternateIdentifierType" => "UUID" }])
|
334
|
+
expect(subject.type).to eq("Article")
|
335
|
+
expect(subject.creators.length).to eq(1)
|
336
|
+
expect(subject.creators.first).to eq("id" => "https://orcid.org/0000-0003-1419-2405", "familyName" => "Fenner", "givenName" => "Martin", "type" => "Person")
|
337
|
+
expect(subject.titles).to eq([{ "title" => "Tracking the Growth of the PID Graph" }])
|
338
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
339
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
340
|
+
expect(subject.date).to eq("published" => "2019-07-01", "updated" => "2023-09-07")
|
341
|
+
expect(subject.descriptions.first["description"]).to start_with("The connections between scholarly resources generated by persistent identifiers (PIDs)")
|
342
|
+
expect(subject.publisher).to eq("name" => "Front Matter")
|
343
|
+
expect(subject.funding_references).to eq([{ "awardNumber" => "777523", "funderIdentifier"=>"http://doi.org/10.13039/501100000780", "funderName" => "European Commission" }])
|
344
|
+
expect(subject.related_identifiers).to eq([{ "id" => "https://doi.org/10.5438/bv9z-dc66", "type" => "IsIdenticalTo" }])
|
345
|
+
expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
|
346
|
+
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
347
|
+
"subject" => "FOS: Computer and information sciences",
|
348
|
+
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
349
|
+
expect(subject.language).to eq("en")
|
350
|
+
expect(subject.container).to eq("identifier" => "https://blog.front-matter.io", "identifierType" => "URL", "title" => "Front Matter", "type" => "Periodical")
|
351
|
+
# puts subject.crossref_xml
|
352
|
+
crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
|
353
|
+
expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(1)
|
354
|
+
expect(Array.wrap(crossref_xml.dig("contributors",
|
355
|
+
"person_name")).first).to eq({"ORCID"=>"https://orcid.org/0000-0003-1419-2405", "contributor_role"=>"author", "given_name"=>"Martin", "sequence"=>"first", "surname"=>"Fenner"})
|
356
|
+
expect(crossref_xml.dig("titles",
|
357
|
+
"title")).to eq("Tracking the Growth of the PID Graph")
|
358
|
+
expect(crossref_xml.dig("item_number")).to eq("__content__" => "e58dc9c8b8704db28896238b3246c551", "item_number_type" => "uuid")
|
359
|
+
expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
|
360
|
+
end
|
361
|
+
|
326
362
|
it "json_feed_item from rogue scholar with anonymous author" do
|
327
363
|
input = "https://rogue-scholar.org/api/posts/a163e340-5b3c-4736-9ab0-8c54fdff6a3c"
|
328
364
|
subject = described_class.new(input: input, doi: "10.59350/9ry27-7cz42")
|
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.4.
|
4
|
+
version: 3.4.5
|
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-09-
|
11
|
+
date: 2023-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -874,6 +874,8 @@ files:
|
|
874
874
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_institutional_author.yml
|
875
875
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml
|
876
876
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_related_identifiers.yml
|
877
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_related_identifiers_and_funding.yml
|
878
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_related_identifiers_and_link_to_peer-reviewed_article.yml
|
877
879
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_without_doi.yml
|
878
880
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml
|
879
881
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post_with_anonymous_author.yml
|
@@ -928,6 +930,7 @@ files:
|
|
928
930
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml
|
929
931
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml
|
930
932
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_relations.yml
|
933
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_relations_and_funding.yml
|
931
934
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_upstream_blog.yml
|
932
935
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_with_references.yml
|
933
936
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/posted_content.yml
|