commonmeta-ruby 3.3.8 → 3.3.9

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: e717e42ba9e8264cfc3ebb4bcb774c58b7f003afad4ffea7da385cd66e84eb27
4
- data.tar.gz: bee1fe28c91acb00e3b5afae8b4305d6036dd4924f554b44d49145ac388fcf69
3
+ metadata.gz: 39731365147aea3875a44db36625a0cd825826f7f0f94755601634b2716fcef9
4
+ data.tar.gz: 7591e80c87796e20933352f49079437a9faac148e47889009a5ee3298471ee4c
5
5
  SHA512:
6
- metadata.gz: 1cc77541969f79992f5e8b6f0677939e64397ffbedfbb75c40d2d534c2a64ad2f8a29b86df1570d76cdd0245f2f80a01e422052c065ca5e45085b85fb9dda7ec
7
- data.tar.gz: 1389f97cf9c919eda5a384a247b7cddb142b0bfb50ce4c7bb77d83f8c1da6812a20c3277a1a0860d42b4952c63c8862d29c6061e0c11cf2a1436ea0424cd3fc9
6
+ metadata.gz: c9c3593d73cadfd1697163801d0505a74c536a93e2a40c2bcaac5e12e7c6e703970a4a207f9282331fe065257ec26856db4e214342926019334e64229b920059
7
+ data.tar.gz: 69a053002420f6aa808b15c6a77344fa02e7a7c26e208a00b7be68d489540356beb47481e8f7565e102905233b51830a1dbd591a4a6435d5bc4c646a3f632d01
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- commonmeta-ruby (3.3.8)
4
+ commonmeta-ruby (3.3.9)
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)
@@ -27,7 +27,7 @@ PATH
27
27
  GEM
28
28
  remote: https://rubygems.org/
29
29
  specs:
30
- activesupport (7.0.5)
30
+ activesupport (7.0.5.1)
31
31
  concurrent-ruby (~> 1.0, >= 1.0.2)
32
32
  i18n (>= 1.6, < 2)
33
33
  minitest (>= 5.1)
@@ -113,6 +113,7 @@ GEM
113
113
  oj (~> 3)
114
114
  optimist (~> 3)
115
115
  jwt (2.7.1)
116
+ language_server-protocol (3.17.0.3)
116
117
  latex-decode (0.4.0)
117
118
  link_header (0.0.8)
118
119
  llhttp-ffi (0.4.0)
@@ -186,12 +187,13 @@ GEM
186
187
  rspec-mocks (3.12.5)
187
188
  diff-lcs (>= 1.2.0, < 2.0)
188
189
  rspec-support (~> 3.12.0)
189
- rspec-support (3.12.0)
190
+ rspec-support (3.12.1)
190
191
  rspec-xsd (0.1.0)
191
192
  nokogiri (~> 1.6)
192
193
  rspec (~> 3)
193
- rubocop (1.52.1)
194
+ rubocop (1.53.1)
194
195
  json (~> 2.3)
196
+ language_server-protocol (>= 3.17.0)
195
197
  parallel (~> 1.10)
196
198
  parser (>= 3.2.2.3)
197
199
  rainbow (>= 2.2.2, < 4.0)
@@ -245,7 +247,7 @@ GEM
245
247
  unicode-display_width (2.4.2)
246
248
  unicode-types (1.8.0)
247
249
  uuidtools (2.2.0)
248
- vcr (6.1.0)
250
+ vcr (6.2.0)
249
251
  webmock (3.18.1)
250
252
  addressable (>= 2.8.0)
251
253
  crack (>= 0.3.2)
@@ -63,6 +63,8 @@ module Commonmeta
63
63
  type = 'Person'
64
64
  elsif type.blank? && is_personal_name?(name: name) && name.to_s.exclude?(';')
65
65
  type = 'Person'
66
+ elsif type.blank? && name.present? && !is_personal_name?(name: name)
67
+ type = 'Organization'
66
68
  end
67
69
 
68
70
  # parse author contributor role
@@ -127,8 +129,8 @@ module Commonmeta
127
129
  def is_personal_name?(name: nil)
128
130
  return true if name_exists?(name.to_s.split.first) || name_exists?(name.to_s.split(', ').last)
129
131
 
130
- # check if a name has only one word, e.g. "FamousOrganization"
131
- return false if name.to_s.split(' ').size == 1
132
+ # check if a name has only one word, e.g. "FamousOrganization", not including commas
133
+ return false if name.to_s.split(' ').size == 1 && name.to_s.exclude?(',')
132
134
 
133
135
  # check for suffixes, e.g. "John Smith, MD"
134
136
  return true if %w[MD PhD].include? name.split(', ').last
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commonmeta
4
- VERSION = '3.3.8'
4
+ VERSION = '3.3.9'
5
5
  end
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://rogue-scholar.org/api/posts/2b3cdd27-5123-4167-9482-3c074392e2d2
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Connection:
11
+ - close
12
+ Host:
13
+ - rogue-scholar.org
14
+ User-Agent:
15
+ - http.rb/5.1.1
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Age:
22
+ - '0'
23
+ Cache-Control:
24
+ - public, max-age=0, must-revalidate
25
+ Content-Length:
26
+ - '1509'
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Wed, 28 Jun 2023 07:30:24 GMT
31
+ Etag:
32
+ - '"8258swzkwh15x"'
33
+ Server:
34
+ - Vercel
35
+ Strict-Transport-Security:
36
+ - max-age=63072000
37
+ X-Matched-Path:
38
+ - "/api/posts/[slug]"
39
+ X-Vercel-Cache:
40
+ - MISS
41
+ X-Vercel-Id:
42
+ - fra1::iad1::wc777-1687937422070-9bb853322252
43
+ Connection:
44
+ - close
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"63cef642602205003d6f50fb","uuid":"2b3cdd27-5123-4167-9482-3c074392e2d2","url":"https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice/","title":"Nature
48
+ features OA.Report''s work putting OA policy into practice!","summary":"After
49
+ a couple of years of working to support institutions implementing their OA
50
+ policies, we''re so proud to see OA.Report, our development partner, and one
51
+ of our collaborators featured in Nature. We appreciate Nature bringing attention
52
+ to the progress being made in more effectively implementing OA policies.","date_published":"2023-01-24T11:11:47Z","date_modified":null,"date_indexed":"2023-06-20T06:34:19.365+00:00","authors":[{"url":null,"name":"OA.Works"}],"image":"https://blog.oa.works/content/images/2023/01/nature-website-v2.png","tags":["OA.Report"],"language":"en","references":[],"blog_id":"h7bpg11","blog":{"id":"h7bpg11","title":"OA.Works
53
+ Blog","description":"OA.Works Blog","language":"en","favicon":"https://blog.oa.works/favicon.png","feed_url":"https://blog.oa.works/rss/","home_page_url":"https://blog.oa.works/","user_id":"8498eaf6-8c58-4b58-bc15-27eda292b1aa","created_at":"2023-05-31T14:11:14+00:00","indexed_at":"2023-01-04","feed_format":"application/rss+xml","license":"https://creativecommons.org/licenses/by/4.0/legalcode","generator":"Ghost
54
+ 5.53","category":"Engineering and Technology","prefix":null,"modified_at":"2023-03-23T12:24:58+00:00","version":"https://jsonfeed.org/version/1.1","backlog":true,"authors":null}}'
55
+ recorded_at: Wed, 28 Jun 2023 07:30:24 GMT
56
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://rogue-scholar.org/api/posts/5d95d90d-ff59-4c8b-b7f8-44e6b45fd593
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Connection:
11
+ - close
12
+ Host:
13
+ - rogue-scholar.org
14
+ User-Agent:
15
+ - http.rb/5.1.1
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Age:
22
+ - '0'
23
+ Cache-Control:
24
+ - public, max-age=0, must-revalidate
25
+ Content-Length:
26
+ - '1844'
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Wed, 28 Jun 2023 07:39:01 GMT
31
+ Etag:
32
+ - '"6emrve7vie1ew"'
33
+ Server:
34
+ - Vercel
35
+ Strict-Transport-Security:
36
+ - max-age=63072000
37
+ X-Matched-Path:
38
+ - "/api/posts/[slug]"
39
+ X-Vercel-Cache:
40
+ - MISS
41
+ X-Vercel-Id:
42
+ - fra1::iad1::q9g2k-1687937937528-5f071f224fc7
43
+ Connection:
44
+ - close
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"https://doi.org/10.59350/tpa8t-j6292","uuid":"5d95d90d-ff59-4c8b-b7f8-44e6b45fd593","url":"https://www.samuelmoore.org/2023/04/20/how-to-cultivate-good-closures-scaling-small-and-the-limits-of-openness","title":"How
48
+ to cultivate good closures: ‘scaling small’ and the limits of openness","summary":"Text
49
+ of a talk given to the COPIM end-of-project conference: “Scaling Small: Community-Owned
50
+ Futures for Open Access Books”, April 20th 2023 Open access publishing has
51
+ always had a difficult relationship with smoothness and scale. Openness implies
52
+ seamlessness, limitlessness or structureless-ness – or the idea that the removal
53
+ of price and permission barriers is what’s needed to allow research to reach
54
+ its full potential. The drive for seamlessness is on display in much of the
55
+ push for...","date_published":"2023-04-20T15:37:20Z","date_modified":"2023-06-19T11:01:51Z","date_indexed":"2023-06-20T06:34:19+00:00","authors":[{"url":"https://orcid.org/0000-0002-0504-2897","name":"Samuel
56
+ Moore"}],"image":null,"tags":["Open access"],"language":"en","references":null,"blog_id":"gr1by89","blog":{"id":"gr1by89","title":"Samuel
57
+ Moore","description":"publishing, technology, commons","language":"en","favicon":"https://www.samuelmoore.org/wp-content/uploads/2019/02/cropped-cropped-cropped-roAorange-icon-2-32x32.png","feed_url":"https://www.samuelmoore.org/feed/atom/","home_page_url":"https://www.samuelmoore.org/","user_id":"8498eaf6-8c58-4b58-bc15-27eda292b1aa","created_at":"2023-05-31T14:25:06+00:00","indexed_at":"2023-01-05","feed_format":"application/atom+xml","license":"https://creativecommons.org/licenses/by/4.0/legalcode","generator":"WordPress
58
+ 6.2.2","category":"Social Sciences","prefix":null,"modified_at":"2023-04-20T15:37:20+00:00","version":"https://jsonfeed.org/version/1.1","backlog":true,"authors":null}}'
59
+ recorded_at: Wed, 28 Jun 2023 07:39:01 GMT
60
+ recorded_with: VCR 6.1.0
@@ -174,6 +174,54 @@ describe Commonmeta::Metadata, vcr: true do
174
174
  expect(subject.references.length).to eq(3)
175
175
  expect(subject.references.first).to eq("key" => "ref1", "url" => "https://sauroposeidon.files.wordpress.com/2010/04/foster-and-wedel-2014-haplocanthosaurus-from-snowmass-colorado.pdf")
176
176
  end
177
+
178
+ it "wordpress post with tracking code on url" do
179
+ input = "https://rogue-scholar.org/api/posts/5d95d90d-ff59-4c8b-b7f8-44e6b45fd593"
180
+ subject = described_class.new(input: input)
181
+ puts subject.errors
182
+ # expect(subject.valid?).to be true
183
+ expect(subject.id).to eq("https://doi.org/10.59350/tpa8t-j6292")
184
+ expect(subject.url).to eq("https://www.samuelmoore.org/2023/04/20/how-to-cultivate-good-closures-scaling-small-and-the-limits-of-openness")
185
+ expect(subject.type).to eq("Article")
186
+ expect(subject.creators.length).to eq(1)
187
+ expect(subject.creators.first).to eq("familyName"=>"Moore", "givenName"=>"Samuel", "id"=>"https://orcid.org/0000-0002-0504-2897", "type"=>"Person")
188
+ expect(subject.titles).to eq([{ "title" => "How to cultivate good closures: ‘scaling small’ and the limits of openness" }])
189
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
190
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
191
+ expect(subject.date).to eq("published"=>"2023-04-20", "updated"=>"2023-06-19")
192
+ expect(subject.descriptions.first["description"]).to start_with("Text of a talk given to the COPIM end-of-project conference")
193
+ expect(subject.publisher).to eq("name" => "Samuel Moore")
194
+ expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
195
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
196
+ "subject" => "FOS: Social sciences",
197
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
198
+ expect(subject.language).to eq("en")
199
+ expect(subject.container).to eq("identifier" => "https://www.samuelmoore.org/", "identifierType" => "URL", "title" => "Samuel Moore", "type" => "Periodical")
200
+ expect(subject.references).to be_nil
201
+ end
202
+
203
+ it "ghost post with institutional author" do
204
+ input = "https://rogue-scholar.org/api/posts/2b3cdd27-5123-4167-9482-3c074392e2d2"
205
+ subject = described_class.new(input: input)
206
+ expect(subject.valid?).to be true
207
+ expect(subject.id).to eq("https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice")
208
+ expect(subject.url).to eq("https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice")
209
+ expect(subject.type).to eq("Article")
210
+ expect(subject.creators.length).to eq(1)
211
+ expect(subject.creators.first).to eq("name"=>"OA.Works", "type"=>"Organization")
212
+ expect(subject.titles).to eq([{ "title" => "Nature features OA.Report's work putting OA policy into practice!" }])
213
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
214
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
215
+ expect(subject.date).to eq("published" => "2023-01-24")
216
+ expect(subject.descriptions.first["description"]).to start_with("After a couple of years of working to support institutions implementing their OA policies")
217
+ expect(subject.publisher).to eq("name" => "OA.Works Blog")
218
+ expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
219
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
220
+ "subject" => "FOS: Engineering and technology",
221
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
222
+ expect(subject.language).to eq("en")
223
+ expect(subject.container).to eq("identifier" => "https://blog.oa.works/", "identifierType" => "URL", "title" => "OA.Works Blog", "type" => "Periodical")
224
+ end
177
225
 
178
226
  it "upstream post with references" do
179
227
  input = "https://rogue-scholar.org/api/posts/954f8138-0ecd-4090-87c5-cef1297f1470"
@@ -50,7 +50,7 @@ describe Commonmeta::Metadata, vcr: true do
50
50
  expect(subject.state).to eq('not_found')
51
51
  expect(subject.id).to eq('https://doi.org/10.7554/elife.01567')
52
52
  expect(subject.type).to eq('Dissertation')
53
- expect(subject.creators).to eq([{ 'name' => 'Toparlar,Y.' }])
53
+ expect(subject.creators).to eq([{"familyName"=>"Toparlar", "givenName"=>"Y.", "type"=>"Person"}])
54
54
  expect(subject.titles).to eq([{ 'title' => 'A multiscale analysis of the urban heat island effect' }])
55
55
  expect(subject.descriptions.first['description']).to start_with('Designing the climates of cities')
56
56
  expect(subject.date).to eq('created' => '2018-04-25', 'published' => '2018-04-25')
@@ -153,9 +153,7 @@ describe Commonmeta::Metadata, vcr: true do
153
153
  expect(subject.titles).to eq([{ 'title' => 'Summary data ankylosing spondylitis GWAS' }])
154
154
  expect(subject.container).to eq('identifier' => 'https://dataverse.harvard.edu',
155
155
  'identifierType' => 'URL', 'title' => 'Harvard Dataverse', 'type' => 'DataRepository')
156
- expect(subject.creators).to eq([{
157
- 'name' => 'International Genetics of Ankylosing Spondylitis Consortium (IGAS)'
158
- }])
156
+ expect(subject.creators).to eq([{"name"=>"International Genetics of Ankylosing Spondylitis Consortium (IGAS)", "type"=>"Organization"}])
159
157
  expect(subject.subjects).to eq([{ 'subject' => 'Medicine, health and life sciences' },
160
158
  { 'subject' => 'genome-wide association studies' },
161
159
  { 'subject' => 'Ankylosing spondylitis' }])
@@ -177,7 +177,7 @@ describe Commonmeta::Metadata, vcr: true do
177
177
  expect(json['@id']).to eq('https://doi.org/10.23725/8na3-9s47')
178
178
  expect(json['@type']).to eq('Dataset')
179
179
  expect(json['name']).to eq('NWD165827.recab.cram')
180
- expect(json['author']).to eq('name' => 'TOPMed')
180
+ expect(json['author']).to eq("@type"=>"Organization", "name"=>"TOPMed")
181
181
  expect(json['includedInDataCatalog']).to be_empty
182
182
  expect(json['identifier']).to eq(
183
183
  [{ '@type' => 'PropertyValue',
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.8
4
+ version: 3.3.9
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-21 00:00:00.000000000 Z
11
+ date: 2023-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -870,6 +870,7 @@ files:
870
870
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml
871
871
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_author_name_suffix.yml
872
872
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_doi.yml
873
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_institutional_author.yml
873
874
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml
874
875
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_without_doi.yml
875
876
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml
@@ -879,6 +880,7 @@ files:
879
880
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/upstream_post_with_references.yml
880
881
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post.yml
881
882
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_references.yml
883
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_tracking_code_on_url.yml
882
884
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/affiliation_is_space.yml
883
885
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/has_familyName.yml
884
886
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/has_name_in_display-order_with_ORCID.yml