commonmeta-ruby 3.3.10 → 3.3.11

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: 533ba980ff639a50d0a61e345be68413bdf63467fc319685b6b64c9b466c7bf5
4
- data.tar.gz: 3b87fd2fba942083c9962f9acf6bc5e99d54422f977d5f8b27c99cb6617bf5d1
3
+ metadata.gz: c8e7c60967025a09cb657d4fca3b6a2a75729d41567ae0fbe6eabae72a149d6b
4
+ data.tar.gz: c182b27c23b4ad623e0fbb9893f02e9d0a29eae30195e235f04c87018af0a3d6
5
5
  SHA512:
6
- metadata.gz: 20cb1df5c515d34a2b782f48479e8f6ae271eb74ae23b685478d216034109677602f388468cd6b86944513f48b6f3e2a3544cf1d8359c46ce68369a0e20edfa0
7
- data.tar.gz: aeedc938048a579bc6fa903a287a6f551e1e6e2e340a8809dc0e3505f0da134806f30ce2110f14394a03d3a3a82d4b9a6f8457e0dae5e51b2a49b17032279dfb
6
+ metadata.gz: be7fd107870ad39838906c7abb0554267db3121c126cf7f7f913a39c3957ba80db3230aac745adb5aa109058324ffd1994796482d2e9e7ef7d10c79486826626
7
+ data.tar.gz: a662fb919e4c920485cf2766268f5e173a4758d14ff4164d77653c3a8b301eec46f8d53aeeb780d7f9553c663e505f120a04d8b607f0b63fb7f00be6e8552121
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- commonmeta-ruby (3.3.10)
4
+ commonmeta-ruby (3.3.11)
5
5
  activesupport (>= 4.2.5, < 8.0)
6
6
  addressable (~> 2.8.1, < 2.8.2)
7
7
  base32-url (>= 0.7.0, < 1)
@@ -191,7 +191,7 @@ GEM
191
191
  rspec-xsd (0.1.0)
192
192
  nokogiri (~> 1.6)
193
193
  rspec (~> 3)
194
- rubocop (1.54.0)
194
+ rubocop (1.54.1)
195
195
  json (~> 2.3)
196
196
  language_server-protocol (>= 3.17.0)
197
197
  parallel (~> 1.10)
@@ -84,10 +84,15 @@ module Commonmeta
84
84
  def get_references(meta)
85
85
  # check that references resolve
86
86
  Array.wrap(meta["references"]).reduce([]) do |sum, reference|
87
- if reference["doi"] && validate_doi(reference["doi"])
88
- sum << reference if [200, 301, 302].include? HTTP.head(reference["doi"]).status
89
- elsif reference["url"] && validate_url(reference["url"]) == "URL"
90
- sum << reference if [200, 301, 302].include? HTTP.head(reference["url"]).status
87
+ begin
88
+ if reference["doi"] && validate_doi(reference["doi"])
89
+ sum << reference if [200, 301, 302].include? HTTP.head(reference["doi"]).status
90
+ elsif reference["url"] && validate_url(reference["url"]) == "URL"
91
+ sum << reference if [200, 301, 302].include? HTTP.head(reference["url"]).status
92
+ end
93
+ rescue => error
94
+ puts "Error: #{error.message}"
95
+ puts "Error: #{reference}"
91
96
  end
92
97
 
93
98
  sum
@@ -135,7 +140,7 @@ module Commonmeta
135
140
  return nil unless response.status.success?
136
141
 
137
142
  post = JSON.parse(response.body.to_s)
138
- post.to_h.dig('prefix')
143
+ post.to_h.dig("prefix")
139
144
  end
140
145
 
141
146
  def get_doi_prefix_by_json_feed_item_uuid(uuid)
@@ -146,7 +151,7 @@ module Commonmeta
146
151
  return nil unless response.status.success?
147
152
 
148
153
  post = JSON.parse(response.body.to_s)
149
- post.to_h.dig('blog', 'prefix')
154
+ post.to_h.dig("blog", "prefix")
150
155
  end
151
156
  end
152
157
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commonmeta
4
- VERSION = '3.3.10'
4
+ VERSION = '3.3.11'
5
5
  end
@@ -348,6 +348,32 @@ describe Commonmeta::Metadata, vcr: true do
348
348
  expect(subject.references).to be_nil
349
349
  end
350
350
 
351
+ it "wordpress post with many references" do
352
+ input = "https://rogue-scholar.org/api/posts/f3dc29da-0481-4f3b-8110-4c07260fca67"
353
+ subject = described_class.new(input: input)
354
+ expect(subject.valid?).to be true
355
+ expect(subject.id).to eq("https://flavoursofopen.science/grundlagen-fur-die-entwicklung-einer-open-scholarship-strategie")
356
+ expect(subject.url).to eq("https://flavoursofopen.science/grundlagen-fur-die-entwicklung-einer-open-scholarship-strategie")
357
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "f3dc29da-0481-4f3b-8110-4c07260fca67", "alternateIdentifierType" => "UUID" }])
358
+ expect(subject.type).to eq("Article")
359
+ expect(subject.creators.length).to eq(1)
360
+ expect(subject.creators.first).to eq("familyName"=>"Steiner", "givenName"=>"Tobias", "id"=>"https://orcid.org/0000-0002-3158-3136", "type"=>"Person")
361
+ expect(subject.titles).to eq([{ "title" => "Grundlagen für die Entwicklung einer Open Scholarship-Strategie" }])
362
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
363
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
364
+ expect(subject.date).to eq("published"=>"2019-01-31", "updated"=>"2023-06-19")
365
+ expect(subject.descriptions.first["description"]).to start_with("Versionshistorie Version 1.0 — 16. Oktober 2017 – Erste Version des Dokuments")
366
+ expect(subject.publisher).to eq("name" => "Flavours of Open")
367
+ expect(subject.subjects).to eq([{ "subject" => "Humanities" },
368
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
369
+ "subject" => "FOS: Humanities",
370
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
371
+ expect(subject.language).to eq("de")
372
+ expect(subject.container).to eq("identifier" => "https://flavoursofopen.science", "identifierType" => "URL", "title" => "Flavours of Open", "type" => "Periodical")
373
+ expect(subject.references.length).to eq(55)
374
+ expect(subject.references.first).to eq("key" => "ref1", "url" => "http://oerstrategy.org/home/read-the-doc")
375
+ end
376
+
351
377
  it "substack post with broken reference" do
352
378
  input = "https://rogue-scholar.org/api/posts/2b105b29-acbc-4eae-9ff1-368803f36a4d"
353
379
  subject = described_class.new(input: input)
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.10
4
+ version: 3.3.11
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-01 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport