theoj 1.2.0 → 1.2.1

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: e9c9c517ea91deba2fcbca39a4098266b8b2adcf749de0c1803c0c36905d54d9
4
- data.tar.gz: 1a4877b0a9e1bb9d58ceebf7a5bbca8cdaefcc2f35a7cbe2696570c828e6d96c
3
+ metadata.gz: c1ad9ac2e66ed16201c855e064d879df50c722e84c9b2178ebce0951ef76c56a
4
+ data.tar.gz: 93b83ab12f5d6416e3e2147a94fda33cde91b1d294df40c9f9d6a4b91f798c42
5
5
  SHA512:
6
- metadata.gz: 4f6661c7163fedb8ba1248b2e1861c6a9f2c842ccfa2a4824fa42cd660ce7660c13b7097728c4078881748d3d69898a78f594717dffcfce08e6cb957e2c7a382
7
- data.tar.gz: 2c812174f9bfd07155ada8ee909dca12a10398f05c042092d014b3401efecba59f9d9c3a2213fdd626a40b06d84156eadbe675e9877ce5950ec3c991b902d159
6
+ metadata.gz: 046fc9a6df0c72d2a69bcd98c303becab7adac7eebdaff4608fbfe65e47e7e7f4ed63b951c45871eb6437c6d2900e2d3cbe5684cfcd3e9d0124a148d4a421d2d
7
+ data.tar.gz: 7a5048156f8f55f54aa3141f7073ffb13a4a8803cacd7fe520aa7c67b1590f116dd39d6986c90fe0650ac5c4b95e9c365710871a83416575992f3a025615edec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.1 (2021-11-30)
4
+
5
+ - Changed metadata dates format to ISO
6
+ - Changed editor and reviewers metadata values to github login
7
+ - Removed languages from article metadata
8
+
3
9
  ## 1.2.0 (2021-11-23)
4
10
 
5
11
  - Added reviews_repository_url to Journal
data/lib/theoj/github.rb CHANGED
@@ -52,7 +52,7 @@ module Theoj
52
52
 
53
53
  # Returns the user login (removes the @ from the username)
54
54
  def user_login(username)
55
- username.strip.sub(/^@/, "").downcase
55
+ username.to_s.strip.sub(/^@/, "").downcase
56
56
  end
57
57
 
58
58
  # Returns true if the string is a valid GitHub isername (starts with @)
@@ -1,4 +1,5 @@
1
1
  require "json"
2
+ require "date"
2
3
  require "base64"
3
4
  require "faraday"
4
5
 
@@ -56,11 +57,10 @@ module Theoj
56
57
  metadata = {
57
58
  title: paper.title,
58
59
  tags: paper.tags,
59
- languages: paper.languages,
60
60
  authors: paper.authors.collect { |a| a.to_h },
61
61
  doi: paper_doi,
62
62
  software_repository_url: review_issue.target_repository,
63
- reviewers: review_issue.reviewers.collect(&:strip),
63
+ reviewers: review_issue.reviewers.collect{|r| user_login(r)},
64
64
  volume: journal.current_volume,
65
65
  issue: journal.current_issue,
66
66
  year: journal.current_year,
@@ -76,7 +76,7 @@ module Theoj
76
76
 
77
77
  def editor_info
78
78
  editor_info = { editor: {
79
- github_user: review_issue.editor,
79
+ github_user: user_login(review_issue.editor),
80
80
  name: nil,
81
81
  url: nil,
82
82
  orcid: nil
@@ -103,8 +103,8 @@ module Theoj
103
103
  paper_lookup = Faraday.get(journal.url + "/papers/lookup/" + review_issue.issue_id.to_s)
104
104
  if paper_lookup.status == 200
105
105
  info = JSON.parse(paper_lookup.body, symbolize_names: true)
106
- dates_info[:submitted_at] = info[:submitted]
107
- dates_info[:published_at] = info[:accepted]
106
+ dates_info[:submitted_at] = format_date(info[:submitted]) if info[:submitted]
107
+ dates_info[:published_at] = format_date(info[:accepted]) if info[:accepted]
108
108
  end
109
109
  end
110
110
 
@@ -128,5 +128,12 @@ module Theoj
128
128
  def paper_doi
129
129
  journal.paper_doi_for_id(paper_id)
130
130
  end
131
+
132
+ private
133
+ def format_date(date_string)
134
+ Date.parse(date_string.to_s).strftime("%Y-%m-%d")
135
+ rescue Date::Error
136
+ nil
137
+ end
131
138
  end
132
139
  end
data/lib/theoj/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Theoj
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theoj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juanjo Bazán
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-23 00:00:00.000000000 Z
11
+ date: 2021-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit