theoj 1.2.0 → 1.2.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/theoj/github.rb +1 -1
- data/lib/theoj/submission.rb +12 -5
- data/lib/theoj/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c1ad9ac2e66ed16201c855e064d879df50c722e84c9b2178ebce0951ef76c56a
         | 
| 4 | 
            +
              data.tar.gz: 93b83ab12f5d6416e3e2147a94fda33cde91b1d294df40c9f9d6a4b91f798c42
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 @)
         | 
    
        data/lib/theoj/submission.rb
    CHANGED
    
    | @@ -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( | 
| 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
    
    
    
        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. | 
| 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- | 
| 11 | 
            +
            date: 2021-11-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: octokit
         |