bolognese 2.3.2 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87b12df51d1fcae47a692ca1bfa34c41f37837d48b6b341fb4669bd10cf545df
4
- data.tar.gz: b2052486460de2fd1769d084116f3968430b532d08eb2e6a29608c8442553445
3
+ metadata.gz: 1a86efd4d59883de399bfae917077f97c5f5e33bd698bc70fc4a3daa40736acc
4
+ data.tar.gz: da3ac310e177b6ad9733ff56cb9893cfe107c0beb930167b7b8f392dfb2332f4
5
5
  SHA512:
6
- metadata.gz: 3f08a7a5c7880372702b122bdf588dc1dd1c84512158961438fd8041eda547694188a6bbcc3f52c4e2234353bd07cc0506176483bb31084770f35583b9293c7c
7
- data.tar.gz: 1ddf1ba488957f079c9889e4c2da169714de4fd17ce785eb882d5c76ac9b7a8e6279f8614d6ee04e96d911be0107794ea900acc05c2079afdbee63e3e3d2db0c
6
+ metadata.gz: ee269b568dd16e08da5c10f00155a3e0b55e9725c1d6aa114c6c3a5020dfe05c2df89388a9bc394a6274e86ca81567f4f756dd31bcaf5faa12dff2a7df275308
7
+ data.tar.gz: 26245d3b2e4553616ba0708047b542f4092240e4cc251ae578de502010ba69a3d6700a5df48f59cd427b7f0eaf498a15cc043cd78ad799572bd589dfcbad6784
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (2.3.2)
4
+ bolognese (2.3.3)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -128,7 +128,7 @@ module Bolognese
128
128
  def insert_resource_type(xml)
129
129
  return xml unless types.is_a?(Hash) && (types["schemaOrg"].present? || types["resourceTypeGeneral"])
130
130
 
131
- xml.resourceType(types["resourceType"] || types["schemaOrg"],
131
+ xml.resourceType(types["resourceType"],
132
132
  'resourceTypeGeneral' => types["resourceTypeGeneral"] || Metadata::SO_TO_DC_TRANSLATIONS[types["schemaOrg"]] || "Other")
133
133
  end
134
134
 
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "2.3.2"
2
+ VERSION = "2.3.3"
3
3
  end
@@ -249,6 +249,48 @@ describe Bolognese::Metadata, vcr: true do
249
249
  end
250
250
  end
251
251
 
252
+ context "insert_resource_type when resourceType is available, but using schemaOrg (via SO_TO_DC_TRANSLATIONS) when resourceTypeGeneral is unavailable" do
253
+ it "supports schemaOrg value as resourceTypeGeneral" do
254
+ # Mock the `types` hash to include the necessary values
255
+ subject.instance_variable_set(:@types, {
256
+ "schemaOrg" => "BlogPosting",
257
+ "resourceType" => "This dataset contains all projects funded by the European Union under the fifth framework programme for research and technological development (FP5) from 1998 to 2002."
258
+ })
259
+
260
+ # Generate XML using the insert_resource_type method
261
+ xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') { |xml| subject.insert_resource_type(xml) }.to_xml
262
+
263
+ response = Maremma.from_xml(xml)
264
+
265
+ # Expect `Text` in resourceTypeGeneral (via SO_TP_DC_TRANSLATIONS) and `This dataset contains all projects funded...` as the content
266
+ expect(response["resourceType"]).to eq(
267
+ "resourceTypeGeneral" => "Text",
268
+ "__content__" => "This dataset contains all projects funded by the European Union under the fifth framework programme for research and technological development (FP5) from 1998 to 2002."
269
+ )
270
+ end
271
+ end
272
+
273
+ context "insert_resource_type when resourceType is available, 'OTHER' when schemaOrg has no valid translations, and 'resourceTypeGeneral is unavailable" do
274
+ it "supports Other as resourceTypeGeneral" do
275
+ # Mock the `types` hash to include the necessary values
276
+ subject.instance_variable_set(:@types, {
277
+ "schemaOrg" => "Invalid_SO_Value",
278
+ "resourceType" => "This dataset contains all projects funded by the European Union under the fifth framework programme for research and technological development (FP5) from 1998 to 2002."
279
+ })
280
+
281
+ # Generate XML using the insert_resource_type method
282
+ xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') { |xml| subject.insert_resource_type(xml) }.to_xml
283
+
284
+ response = Maremma.from_xml(xml)
285
+
286
+ # Expect `Text` in resourceTypeGeneral (via SO_TP_DC_TRANSLATIONS) and `This dataset contains all projects funded...` as the content
287
+ expect(response["resourceType"]).to eq(
288
+ "resourceTypeGeneral" => "Other",
289
+ "__content__" => "This dataset contains all projects funded by the European Union under the fifth framework programme for research and technological development (FP5) from 1998 to 2002."
290
+ )
291
+ end
292
+ end
293
+
252
294
  # Test case to insert Coverage DateType (new dateType in DataCite 4.6).
253
295
  context "insert_dates with Coverage" do
254
296
  it "inserts date with dateType Coverage" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-20 00:00:00.000000000 Z
11
+ date: 2025-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -1330,7 +1330,7 @@ homepage: https://github.com/datacite/bolognese
1330
1330
  licenses:
1331
1331
  - MIT
1332
1332
  metadata: {}
1333
- post_install_message:
1333
+ post_install_message:
1334
1334
  rdoc_options: []
1335
1335
  require_paths:
1336
1336
  - lib
@@ -1346,7 +1346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1346
1346
  version: '0'
1347
1347
  requirements: []
1348
1348
  rubygems_version: 3.3.26
1349
- signing_key:
1349
+ signing_key:
1350
1350
  specification_version: 4
1351
1351
  summary: Ruby client library for conversion of DOI Metadata
1352
1352
  test_files: []