commonmeta-ruby 3.2.14 → 3.3
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 +2 -2
- data/bin/commonmeta +1 -1
- data/lib/commonmeta/author_utils.rb +1 -1
- data/lib/commonmeta/cli.rb +14 -0
- data/lib/commonmeta/crossref_utils.rb +56 -14
- data/lib/commonmeta/readers/json_feed_reader.rb +30 -2
- data/lib/commonmeta/utils.rb +34 -0
- data/lib/commonmeta/version.rb +1 -1
- data/spec/cli_spec.rb +12 -3
- data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/doi_prefix/doi_prefix_by_blog.yml +997 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/doi_prefix/doi_prefix_by_uuid.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/encode/by_blog.yml +997 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/encode/by_uuid.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_id.yml +997 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_post_uuid.yml +389 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_post_uuid_specific_prefix.yml +389 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item/by_uuid.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blog_post_with_non-url_id.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml +91 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/substack_post_with_broken_reference.yml +1316 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml +91 -0
- data/spec/readers/json_feed_reader_spec.rb +280 -186
- data/spec/utils_spec.rb +8 -0
- data/spec/writers/crossref_xml_writer_spec.rb +28 -0
- metadata +14 -2
@@ -257,5 +257,33 @@ describe Commonmeta::Metadata, vcr: true do
|
|
257
257
|
expect(crossref_xml.dig('item_number')).to eq("__content__"=>"1c57855813244493b8af84c49eabc52f", "item_number_type"=>"uuid")
|
258
258
|
expect(crossref_xml.dig('group_title')).to eq('Engineering and technology')
|
259
259
|
end
|
260
|
+
|
261
|
+
it "json_feed_item from rogue scholar with organizational author" do
|
262
|
+
input = "https://rogue-scholar.org/api/posts/5561f8e4-2ff1-4186-a8d5-8dacb3afe414"
|
263
|
+
subject = described_class.new(input: input, doi: "10.59350/9ry27-7cz42")
|
264
|
+
|
265
|
+
expect(subject.valid?).to be true
|
266
|
+
expect(subject.id).to eq("https://doi.org/10.59350/9ry27-7cz42")
|
267
|
+
expect(subject.url).to eq("https://libscie.org/ku-leuven-supports-researchequals")
|
268
|
+
expect(subject.type).to eq("Article")
|
269
|
+
expect(subject.titles).to eq([{ "title" => "KU Leuven supports ResearchEquals" }])
|
270
|
+
expect(subject.creators.length).to eq(1)
|
271
|
+
expect(subject.creators.first).to eq("id"=>"https://ror.org/0342dzm54", "name"=>"Liberate Science", "type"=>"Organization")
|
272
|
+
expect(subject.subjects).to eq([{"subject"=>"Social sciences"},
|
273
|
+
{"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
|
274
|
+
"subject"=>"FOS: Social sciences",
|
275
|
+
"subjectScheme"=>"Fields of Science and Technology (FOS)"}])
|
276
|
+
expect(subject.language).to eq("en")
|
277
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
278
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
279
|
+
crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
|
280
|
+
expect(Array.wrap(crossref_xml.dig("contributors", "organization")).length).to eq(1)
|
281
|
+
expect(Array.wrap(crossref_xml.dig("contributors",
|
282
|
+
"organization")).first).to eq("contributor_role"=>"author", "name"=>"Liberate Science", "sequence"=>"first")
|
283
|
+
expect(crossref_xml.dig("titles",
|
284
|
+
"title")).to eq("KU Leuven supports ResearchEquals")
|
285
|
+
expect(crossref_xml.dig('item_number')).to eq("__content__"=>"5561f8e42ff14186a8d58dacb3afe414", "item_number_type"=>"uuid")
|
286
|
+
expect(crossref_xml.dig('group_title')).to eq('Social sciences')
|
287
|
+
end
|
260
288
|
end
|
261
289
|
end
|
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
|
+
version: '3.3'
|
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-06-
|
11
|
+
date: 2023-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -1071,6 +1071,10 @@ files:
|
|
1071
1071
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/to_crossref_xml.yml
|
1072
1072
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/to_datacite.yml
|
1073
1073
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/to_schema_org.yml
|
1074
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/doi_prefix/doi_prefix_by_blog.yml
|
1075
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/doi_prefix/doi_prefix_by_uuid.yml
|
1076
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/encode/by_blog.yml
|
1077
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/encode/by_uuid.yml
|
1074
1078
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/crossref.yml
|
1075
1079
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/datacite.yml
|
1076
1080
|
- spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/jalc.yml
|
@@ -1170,6 +1174,9 @@ files:
|
|
1170
1174
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/nil.yml
|
1171
1175
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/past.yml
|
1172
1176
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/present.yml
|
1177
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_id.yml
|
1178
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_post_uuid.yml
|
1179
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_doi_prefix_for_blog/by_blog_post_uuid_specific_prefix.yml
|
1173
1180
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/all_posts.yml
|
1174
1181
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/behind_the_science.yml
|
1175
1182
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/by_blog_id.yml
|
@@ -1180,11 +1187,15 @@ files:
|
|
1180
1187
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/unregistered_posts.yml
|
1181
1188
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/upstream.yml
|
1182
1189
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/upstream_blog.yml
|
1190
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item/by_uuid.yml
|
1191
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blog_post_with_non-url_id.yml
|
1183
1192
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml
|
1184
1193
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_author_name_suffix.yml
|
1185
1194
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_doi.yml
|
1195
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml
|
1186
1196
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_without_doi.yml
|
1187
1197
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml
|
1198
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/substack_post_with_broken_reference.yml
|
1188
1199
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/syldavia_gazette_post_with_references.yml
|
1189
1200
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/upstream_post_with_references.yml
|
1190
1201
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post.yml
|
@@ -1300,6 +1311,7 @@ files:
|
|
1300
1311
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article.yml
|
1301
1312
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml
|
1302
1313
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml
|
1314
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml
|
1303
1315
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_upstream_blog.yml
|
1304
1316
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_with_references.yml
|
1305
1317
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/posted_content.yml
|