commonmeta-ruby 3.5.3 → 3.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c2acea093c17e097fef5234c724c32893b6df9bb8192fcd356bbee1321d5ad5
4
- data.tar.gz: 9a93f805c39e517b7659d91508918bb7ad84a9270700f9662f90910fcf081f21
3
+ metadata.gz: c42c11b4ae0ee7743906d829813c5686e64359da51743c886b96dce34935556e
4
+ data.tar.gz: 2ab7d6c4fce7c9d33fb546a002cbad7c1220a8576cd2e73eb2341b39259eae9a
5
5
  SHA512:
6
- metadata.gz: 570d1f410f9dd9608967697c3f3f6476cf767877441d3626eccf9993d56d551588bf2b39d514f5cfcd96043ad44f379c325334802f015445d99e19438d05f5a7
7
- data.tar.gz: '0678f6e2adc93ac9d740654efc9b5583e525dc1496fc75d01d22be26939ac8f07fd0c00f58e635ce4a97e1344672ef162c95ddfae72f489b3db72e5a51eb028d'
6
+ metadata.gz: f95088f184873a000063b3ea5bbc426723c3782d33b98956d07eeac152ba24c0445ad491b85b95aa7369df8c4705d867780d18d7ac92225839ef7133e8d7ee6e
7
+ data.tar.gz: 5e836d35579afa5921c4e342b6d66f2b5059b5f8165194d1508e45b9c92060f1ac67bdbffd87477650c1bc48f8defd10daeea19a42ca5b52c3590162ddffab94
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- commonmeta-ruby (3.5.3)
4
+ commonmeta-ruby (3.5.4)
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)
@@ -232,7 +232,7 @@ GEM
232
232
  unf_ext
233
233
  unf_ext (0.0.8.2)
234
234
  unicode-display_width (2.4.2)
235
- unicode-types (1.8.0)
235
+ unicode-types (1.9.0)
236
236
  uuidtools (2.2.0)
237
237
  vcr (6.2.0)
238
238
  webmock (3.19.1)
@@ -26,7 +26,7 @@ module Commonmeta
26
26
 
27
27
  desc "", "convert metadata"
28
28
  method_option :from, aliases: "-f"
29
- method_option :to, aliases: "-t", default: "schema_org"
29
+ method_option :to, aliases: "-t", default: "commonmeta"
30
30
  method_option :regenerate, type: :boolean, force: false
31
31
  method_option :style, aliases: "-s", default: "apa"
32
32
  method_option :locale, aliases: "-l", default: "en-US"
@@ -115,6 +115,12 @@ module Commonmeta
115
115
  puts get_json_feed_by_blog(id)
116
116
  end
117
117
 
118
+ desc "", "json_feed_blog_id"
119
+
120
+ def json_feed_blog_id(id)
121
+ puts get_json_feed_blog_id(id)
122
+ end
123
+
118
124
  desc "", "update_ghost_post"
119
125
 
120
126
  def update_ghost_post(id)
@@ -198,6 +198,17 @@ module Commonmeta
198
198
  blog["items"].map { |item| item["id"] }.first
199
199
  end
200
200
 
201
+ def get_json_feed_blog_id(id)
202
+ # get JSON Feed item by id and return blog id
203
+
204
+ url = json_feed_item_by_id_url(id)
205
+ response = HTTP.get(url)
206
+ return nil unless response.status.success?
207
+
208
+ post = JSON.parse(response.body.to_s)
209
+ post.to_h.dig("blog", "slug")
210
+ end
211
+
201
212
  def get_doi_prefix_by_blog_id(blog_id)
202
213
  # for generating a random DOI.
203
214
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commonmeta
4
- VERSION = '3.5.3'
4
+ VERSION = '3.5.4'
5
5
  end
@@ -0,0 +1,132 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://rogue-scholar.org/api/posts/1898d2d7-4d87-4487-96c4-3073cf99e9a5
6
+ body:
7
+ encoding: ASCII-8BIT
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
+ - '8651'
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Sun, 01 Oct 2023 12:54:48 GMT
31
+ Etag:
32
+ - '"cgg0qca1si6o1"'
33
+ Server:
34
+ - Vercel
35
+ Strict-Transport-Security:
36
+ - max-age=63072000
37
+ X-Matched-Path:
38
+ - "/api/posts/[[...params]]"
39
+ X-Vercel-Cache:
40
+ - MISS
41
+ X-Vercel-Id:
42
+ - fra1::iad1::chhkb-1696164887801-9f1569e3d50b
43
+ Connection:
44
+ - close
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"1898d2d7-4d87-4487-96c4-3073cf99e9a5","doi":"https://doi.org/10.59350/63055-a8604","url":"http://sfmatheson.blogspot.com/2023/01/quintessence-of-dust-2023-restart-why.html","archive_url":null,"title":"Quintessence
48
+ of Dust 2023 restart: the why","summary":"It''s early January 2023, a little
49
+ before sunset in Tucson. Live image below, showing the glorious Santa Catalina
50
+ mountains (the snow on the upper reaches is more apparent earlier in the day)
51
+ and my dinner preparations (shrimp and veggies on the grill).I''ve decided
52
+ to start writing here at <i>Quintessence of Dust</i>, after another long hiatus.","content_html":"It''s
53
+ early January 2023, a little before sunset in Tucson. Live image below, showing
54
+ the glorious Santa Catalina mountains (the snow on the upper reaches is more
55
+ apparent earlier in the day) and my dinner preparations (shrimp and veggies
56
+ on the grill).<div><a href=\"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghgBx9BU21qMDFnLxgHmnsl6TQVfb3QCwOXrC1zcXq7WH9gN8E0TcH3pTslRBG6O8mb5gcuF9JVtDlJ2je6dFcfyzKE4OD38-ftr66nBxddo892_NkyuevrrX65ndSbwmXMaLh3F5yiqU1QIj8JtA8FLkKOcHOEVwVafz0rzh7PejbFzp3XT25nQxc/s4032/Jan%207.jpg\"><img
57
+ height=\"320\" src=\"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghgBx9BU21qMDFnLxgHmnsl6TQVfb3QCwOXrC1zcXq7WH9gN8E0TcH3pTslRBG6O8mb5gcuF9JVtDlJ2je6dFcfyzKE4OD38-ftr66nBxddo892_NkyuevrrX65ndSbwmXMaLh3F5yiqU1QIj8JtA8FLkKOcHOEVwVafz0rzh7PejbFzp3XT25nQxc/s320/Jan%207.jpg\"
58
+ width=\"240\" /></a></div><br /><div><div>I''ve decided to start writing here
59
+ at <i>Quintessence of Dust</i>, after another long hiatus. Here are some of
60
+ my reasons.</div><div><br /></div><div>1. I like to write, and I have things
61
+ to say, and I self-identify as an author. For eight years, I have co-organized
62
+ and taught in the <a href=\"https://meetings.cshl.edu/courses.aspx?course=C-WRITE&amp;year=23\"
63
+ target=\"_blank\">Scientific Writing Retreat at Cold Spring Harbor Laboratory</a>.
64
+ I''m a writer and I need to write, if only for myself.</div><div><br /></div><div>2.
65
+ I have an idea for a book, along with some introductory work (but no sample
66
+ chapters yet) and writing here will help me develop those thoughts. The idea
67
+ is over twelve years old and has never faded away, which I take to mean that
68
+ I need to get it out of my system somehow.</div><div><br /></div><div>3. I
69
+ have other ideas kicking around in my head and most of them are worth writing
70
+ about. I have one new intellectual passion that is totally worth writing about:
71
+ <a href=\"https://skyislandalliance.org/the-sky-islands/\" target=\"_blank\">the
72
+ Sky Islands</a> that nearly surround us here in Tucson.</div><div><br /></div><div>4.
73
+ I have an exciting new job with great new people at <a href=\"https://plos.org/\"
74
+ target=\"_blank\">an organization</a> that''s all in for <a href=\"https://plos.org/open-science/\"
75
+ target=\"_blank\">open science</a>. I recently turned over the tens digit
76
+ on my age-o-meter. My kids will very soon be all out of college. (One is about
77
+ to start a postdoc!) All of this led, predictably, to a spasm of reflection
78
+ on projects and vision. One clear result is that I''m feeling more inspired.<span><a
79
+ name=\"more\"></a></span></div><div><br /></div><div>5. The demise of Twitter
80
+ has led to a lot of <a href=\"https://www.theatlantic.com/technology/archive/2022/11/twitter-facebook-social-media-decline/672074/\"
81
+ target=\"_blank\">useful commentary</a> about the nature of social media.
82
+ I left Facebook two years ago and all but left Twitter two months ago. I''m
83
+ on a <a href=\"https://fediscience.org/explore\" target=\"_blank\">good server
84
+ at Mastodon</a> and I like it; maybe microblogging there can satisfy my desire
85
+ for conversation and connection. But <a href=\"https://www.theverge.com/23513418/bring-back-personal-blogging\"
86
+ target=\"_blank\">this recent piece</a> at <i>The Verge</i> by <a href=\"https://moniquejudge.com/\"
87
+ target=\"_blank\">Monique Judge</a> convinced me that blogging could (again)
88
+ have a place in the future.</div><div><br /><div>Here''s her summary, emphasis
89
+ mine:</div><div><blockquote>At the end of the day, we don’t know what is going
90
+ to happen next with Twitter or any of these platforms. We don’t know what
91
+ changes <a href=\"https://www.techtarget.com/whatis/definition/Web-30\" target=\"_blank\">Web
92
+ 3.0</a> is going to bring to the internet. We do know that <b>we will all
93
+ still be here, wanting to share our thoughts, talk about anything and everything,
94
+ and commune with our people</b>. Personal blogging is the simplest and fastest
95
+ way to do all of that. </blockquote></div><div>That''s what I want! A place
96
+ to write, and (if I''m lucky) a place to discuss and \"commune\" with people.
97
+ That used to happen a lot at <i>Quintessence of Dust</i>.<span></span></div></div></div><div><br
98
+ /></div><div>Okay, but why here? This blog is over 15 years old and was started
99
+ when I was a Christian believer. <a href=\"https://sfmatheson.blogspot.com/2007/08/kicking-off-my-blog.html\"
100
+ target=\"_blank\">Its founding themes</a> were anchored in a desire to help
101
+ Christians understand and enjoy biology, to help them shake free of misinformation
102
+ and dishonesty. It has twice languished through long hiatuses and was <a href=\"https://sfmatheson.blogspot.com/p/about.html\"
103
+ target=\"_blank\">remodeled</a> back in 2017 a few years after I deconverted.
104
+ Maybe it''s time to start anew? I think not, for many of those same reasons:
105
+ I''m still a biologist who loves science, still worried about misinformation,
106
+ and still rooted in the power of scientific explanation. I''m still a bardolator
107
+ and a Red Sox fan. <a href=\"https://sfmatheson.blogspot.com/p/about.html\">I''m
108
+ still me</a>, and <i>Quintessence of Dust</i> is still my blog. The new <a
109
+ href=\"https://sfmatheson.blogspot.com/p/about.html\" target=\"_blank\">About
110
+ page</a> is slightly remodeled from 2017, and hints at the next post, which
111
+ will outline some new goals and ongoing projects.</div><div><br /></div><div>A
112
+ final note on inspiration, from Imani Perry, writing in her newsletter (<a
113
+ href=\"https://newsletters.theatlantic.com/unsettled-territory/\" target=\"_blank\">Unsettled
114
+ Territory</a>) at <i>The Atlantic</i>. The piece is \"<a href=\"https://newsletters.theatlantic.com/unsettled-territory/63af3facace609003751bacc/becoming-writer-habit-journalism/\"
115
+ target=\"_blank\">Writing is a Democratic Art</a>.\" It''s for subscribers
116
+ only but here is her challenge:</div><div><blockquote>Thinking and writing
117
+ at a faster pace stretched me and gave me greater confidence. Sometimes I
118
+ changed my mind about what I’d written a day later. But that was okay; a newsletter
119
+ is a moment in time. Writing it each week gave me a lovely rhythm in what
120
+ has otherwise been a difficult and disorienting season in history. Feeling
121
+ stuck can get you stuck. But writing can, and should, inspire deeds.</blockquote></div>","published_at":1673233380,"updated_at":1680470227,"indexed_at":1689006804,"authors":[{"url":null,"name":"Stephen
122
+ Matheson"}],"image":"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghgBx9BU21qMDFnLxgHmnsl6TQVfb3QCwOXrC1zcXq7WH9gN8E0TcH3pTslRBG6O8mb5gcuF9JVtDlJ2je6dFcfyzKE4OD38-ftr66nBxddo892_NkyuevrrX65ndSbwmXMaLh3F5yiqU1QIj8JtA8FLkKOcHOEVwVafz0rzh7PejbFzp3XT25nQxc/s320/Jan%207.jpg","tags":["Introduction"],"language":"en","reference":[],"relationships":[],"blog_id":"5764g49","blog_name":"Quintessence
123
+ of Dust","blog_slug":"sfmatheson","blog":{"id":"5764g49","title":"Quintessence
124
+ of Dust","description":"<i>Quintessence of Dust</i> explores science, society,
125
+ and human nature, focusing on genetics, development, evolution, neuroscience,
126
+ systems biology, and topics related to scientific literacy. I occasionally
127
+ discuss intelligent design, creationism, science denial, and other political/social
128
+ influences on scientific literacy. Additional topics: philosophy, baseball,
129
+ scientific culture, and Shakespeare. My main theme is <b><u>scientific explanation</u></b>.","language":"en","favicon":null,"feed_url":"http://sfmatheson.blogspot.com/feeds/posts/default","home_page_url":"http://sfmatheson.blogspot.com","user_id":"656f9875-3304-4056-935b-b29429e14222","created_at":"2023-04-18","feed_format":"application/atom+xml","license":"https://creativecommons.org/licenses/by/4.0/legalcode","generator":"Blogger
130
+ 7.00","category":"socialSciences","prefix":"10.59350","modified_at":"2023-09-11T17:46:56+00:00","version":"https://jsonfeed.org/version/1.1","current_feed_url":null,"status":"active","issn":null,"backlog":0,"authors":null,"plan":"Team","slug":"sfmatheson","use_mastodon":false,"api":false,"funding":null,"archive_prefix":null,"use_api":null,"relative_url":null,"canonical_url":null}}'
131
+ recorded_at: Sun, 01 Oct 2023 12:54:48 GMT
132
+ recorded_with: VCR 6.2.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://rogue-scholar.org/api/posts/2b22bbba-bcba-4072-94cc-3f88442fff55
6
+ body:
7
+ encoding: ASCII-8BIT
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: 404
19
+ message: Not Found
20
+ headers:
21
+ Age:
22
+ - '0'
23
+ Cache-Control:
24
+ - public, max-age=0, must-revalidate
25
+ Content-Length:
26
+ - '28'
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Sun, 01 Oct 2023 12:54:48 GMT
31
+ Etag:
32
+ - '"jtxxi9yf69s"'
33
+ Server:
34
+ - Vercel
35
+ Strict-Transport-Security:
36
+ - max-age=63072000
37
+ X-Matched-Path:
38
+ - "/api/posts/[[...params]]"
39
+ X-Vercel-Cache:
40
+ - MISS
41
+ X-Vercel-Id:
42
+ - fra1::iad1::6plz2-1696164888551-86b03621bd39
43
+ Connection:
44
+ - close
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"message":"Post not found"}'
48
+ recorded_at: Sun, 01 Oct 2023 12:54:48 GMT
49
+ recorded_with: VCR 6.2.0
@@ -541,4 +541,16 @@ describe Commonmeta::Metadata, vcr: true do
541
541
  expect(response).to eq("10.54900")
542
542
  end
543
543
  end
544
+
545
+ context "get blog_id for json_feed item id", vcr: true do
546
+ it "by blog post id" do
547
+ response = subject.get_json_feed_blog_id("1898d2d7-4d87-4487-96c4-3073cf99e9a5")
548
+ expect(response).to eq("sfmatheson")
549
+ end
550
+
551
+ it "not found" do
552
+ response = subject.get_doi_prefix_by_json_feed_item_id("2b22bbba-bcba-4072-94cc-3f88442fff55")
553
+ expect(response).to eq(nil)
554
+ end
555
+ end
544
556
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmeta-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.3
4
+ version: 3.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
@@ -811,6 +811,8 @@ files:
811
811
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/find_from_format_by_ID/datacite.yml
812
812
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/find_from_format_by_ID/datacite_doi_http.yml
813
813
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/find_from_format_by_ID/unknown_DOI_registration_agency.yml
814
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_blog_id_for_json_feed_item_id/by_blog_post_id.yml
815
+ - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_blog_id_for_json_feed_item_id/not_found.yml
814
816
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_cff_metadata/cff-converter-python.yml
815
817
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_cff_metadata/ruby-cff.yml
816
818
  - spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_cff_metadata/ruby-cff_repository_url.yml