diff --git a/Gemfile.lock b/Gemfile.lock index 9a1f383a..cda8bfab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - bolognese (1.8.6) + bolognese (1.8.7) activesupport (>= 4.2.5) benchmark_methods (~> 0.7) bibtex-ruby (>= 5.1.0) @@ -41,6 +41,7 @@ GEM benchmark_methods (0.7) bibtex-ruby (5.1.4) latex-decode (~> 0.0) + bigdecimal (2.0.0) builder (3.2.4) citeproc (1.0.10) namae (~> 1.0) @@ -121,7 +122,8 @@ GEM namae (1.0.1) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - oj (3.10.8) + oj (3.10.12) + bigdecimal (>= 1.0, < 3) oj_mimic_json (1.0.1) optimist (3.0.1) postrank-uri (1.0.24) @@ -175,7 +177,7 @@ GEM rspec (~> 3) safe_yaml (1.0.5) scanf (1.0.0) - simplecov (0.18.5) + simplecov (0.19.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov-html (0.12.2) diff --git a/lib/bolognese/utils.rb b/lib/bolognese/utils.rb index 412c84e9..3abefab2 100644 --- a/lib/bolognese/utils.rb +++ b/lib/bolognese/utils.rb @@ -7,6 +7,7 @@ module Utils "https://creativecommons.org/licenses/by/2.0" => "https://creativecommons.org/licenses/by/2.0/legalcode", "https://creativecommons.org/licenses/by/2.5" => "https://creativecommons.org/licenses/by/2.5/legalcode", "https://creativecommons.org/licenses/by/3.0" => "https://creativecommons.org/licenses/by/3.0/legalcode", + "https://creativecommons.org/licenses/by/3.0/us" => "https://creativecommons.org/licenses/by/3.0/legalcode", "https://creativecommons.org/licenses/by/4.0" => "https://creativecommons.org/licenses/by/4.0/legalcode", "https://creativecommons.org/licenses/by-nc/1.0" => "https://creativecommons.org/licenses/by-nc/1.0/legalcode", "https://creativecommons.org/licenses/by-nc/2.0" => "https://creativecommons.org/licenses/by-nc/2.0/legalcode", diff --git a/lib/bolognese/version.rb b/lib/bolognese/version.rb index ccea9cc6..9789585e 100644 --- a/lib/bolognese/version.rb +++ b/lib/bolognese/version.rb @@ -1,3 +1,3 @@ module Bolognese - VERSION = "1.8.6" + VERSION = "1.8.7" end diff --git a/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/cc-by_3_0_us.yml b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/cc-by_3_0_us.yml new file mode 100644 index 00000000..49c80142 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/cc-by_3_0_us.yml @@ -0,0 +1,104 @@ +--- +http_interactions: +- request: + method: get + uri: https://doi.org/ra/10.6084 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.7.1; mailto:info@datacite.org) + Accept: + - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 + response: + status: + code: 200 + message: '' + headers: + Date: + - Fri, 21 Aug 2020 11:43:04 GMT + Content-Type: + - application/json;charset=UTF-8 + Connection: + - keep-alive + Set-Cookie: + - __cfduid=dfd6c87cff8b6f860fa122f6cddf80f0f1598010184; expires=Sun, 20-Sep-20 + 11:43:04 GMT; path=/; domain=.doi.org; HttpOnly; SameSite=Lax; Secure + Cf-Cache-Status: + - DYNAMIC + Cf-Request-Id: + - 04b26d6b940000d6e96a26c200000001 + Expect-Ct: + - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Server: + - cloudflare + Cf-Ray: + - 5c641825bf84d6e9-FRA + body: + encoding: ASCII-8BIT + string: |- + [ + { + "DOI": "10.6084", + "RA": "DataCite" + } + ] + http_version: + recorded_at: Fri, 21 Aug 2020 11:43:04 GMT +- request: + method: get + uri: https://api.datacite.org/dois/10.6084/m9.figshare.1286826.v1?include=media,client + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.7.1; mailto:info@datacite.org) + Accept: + - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 21 Aug 2020 11:43:05 GMT + Content-Type: + - application/json; charset=utf-8 + Connection: + - keep-alive + Status: + - 200 OK + X-Anonymous-Consumer: + - 'true' + Cache-Control: + - max-age=0, private, must-revalidate + Vary: + - Accept-Encoding, Origin + X-Request-Id: + - f32dc0c7-ae28-4225-aebb-690f7ed8f96f + Etag: + - W/"1053de58f4bcf558a2c6eff57d658893" + X-Runtime: + - '0.281050' + X-Powered-By: + - Phusion Passenger 6.0.6 + Server: + - nginx/1.14.0 + Phusion Passenger 6.0.6 + body: + encoding: ASCII-8BIT + string: '{"data":{"id":"10.6084/m9.figshare.1286826.v1","type":"dois","attributes":{"doi":"10.6084/m9.figshare.1286826.v1","prefix":"10.6084","suffix":"m9.figshare.1286826.v1","identifiers":[],"alternateIdentifiers":[],"creators":[{"name":"Kramer, + Bianca","nameType":"Personal","givenName":"Bianca","familyName":"Kramer","affiliation":[],"nameIdentifiers":[{"nameIdentifier":"https://orcid.org/0000-0002-5965-6560","nameIdentifierScheme":"ORCID"}]},{"name":"Bosman, + Jeroen","nameType":"Personal","givenName":"Jeroen","familyName":"Bosman","affiliation":[],"nameIdentifiers":[{"nameIdentifier":"https://orcid.org/0000-0001-5796-2727","nameIdentifierScheme":"ORCID"}]}],"titles":[{"title":"101 + Innovations in Scholarly Communication - the Changing Research Workflow"}],"publisher":"Figshare","container":{},"publicationYear":2015,"subjects":[],"contributors":[],"dates":[{"date":"2015","dateType":"Issued"}],"language":null,"types":{"ris":"DATA","bibtex":"misc","citeproc":"dataset","schemaOrg":"Dataset","resourceType":"Dataset","resourceTypeGeneral":"Dataset"},"relatedIdentifiers":[],"sizes":[],"formats":[],"version":null,"rightsList":[{"rights":"CC-BY","rightsUri":"http://creativecommons.org/licenses/by/3.0/us"}],"descriptions":[],"geoLocations":[],"fundingReferences":[],"xml":"PD94bWwgd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NTk2NS02NTYwPC9uYW1lSWRlbnRpZmllcj48L2NyZWF0b3I+PGNyZWF0b3I+PGNyZWF0b3JOYW1lPkplcm9lbiBCb3NtYW48L2NyZWF0b3JOYW1lPjxuYW1lSWRlbnRpZmllciBuYW1lSWRlbnRpZmllclNjaGVtZT0iT1JDSUQiPjAwMDAtMDAwMS01Nzk2LTI3Mjc8L25hbWVJZGVudGlmaWVyPjwvY3JlYXRvcj48L2NyZWF0b3JzPjwvcmVzb3VyY2U+","url":"https://figshare.com/articles/101_Innovations_in_Scholarly_Communication_the_Changing_Research_Workflow/1286826/1","contentUrl":null,"metadataVersion":0,"schemaVersion":"http://datacite.org/schema/kernel-3","source":null,"isActive":true,"state":"findable","reason":null,"viewCount":0,"viewsOverTime":[],"downloadCount":0,"downloadsOverTime":[],"referenceCount":0,"citationCount":0,"citationsOverTime":[],"partCount":0,"partOfCount":0,"versionCount":0,"versionOfCount":0,"created":"2016-01-19T13:15:11.000Z","registered":"2016-01-19T13:15:12.000Z","published":"2015","updated":"2020-07-27T15:52:33.000Z"},"relationships":{"client":{"data":{"id":"figshare.ars","type":"clients"}},"media":{"data":{"id":"10.6084/m9.figshare.1286826.v1","type":"media"}},"references":{"data":[]},"citations":{"data":[]},"parts":{"data":[]},"partOf":{"data":[]},"versions":{"data":[]},"versionOf":{"data":[]}}},"included":[{"id":"figshare.ars","type":"clients","attributes":{"name":"figshare + Academic Research System","symbol":"FIGSHARE.ARS","year":2016,"contactEmail":"danielduduta@figshare.com","alternateName":null,"description":"figshare + allows researchers to publish all of their research outputs in an easily citable, + sharable and discoverable manner. All file formats can be published, including + videos and datasets. Optional peer review process. figshare uses creative + commons licensing.","language":null,"clientType":"repository","domains":"figshare.com","re3data":"https://doi.org/10.17616/R3PK5R","opendoar":null,"issn":null,"url":"http://figshare.com/","created":"2016-10-12T13:42:35.000Z","updated":"2019-07-27T07:15:48.000Z","isActive":true,"hasPassword":true},"relationships":{"provider":{"data":{"id":"figshare","type":"providers"}},"prefixes":{"data":[{"id":"10.6084","type":"prefixes"}]}}}]}' + http_version: + recorded_at: Fri, 21 Aug 2020 11:43:05 GMT +recorded_with: VCR 3.0.3 diff --git a/spec/readers/datacite_reader_spec.rb b/spec/readers/datacite_reader_spec.rb index 5f1ed755..3ff4116d 100644 --- a/spec/readers/datacite_reader_spec.rb +++ b/spec/readers/datacite_reader_spec.rb @@ -295,6 +295,17 @@ {"subject"=>"FOS: Media and communications", "subjectScheme"=>"Fields of Science and Technology (FOS)", "schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf"}, {"subject"=>"Library and Information Studies"}]) end + it "cc-by 3.0 us" do + input = "10.6084/m9.figshare.1286826.v1" + subject = Bolognese::Metadata.new(input: input) + expect(subject.valid?).to be true + expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Attribution 3.0 Unported", + + "rightsIdentifier"=>"cc-by-3.0", + + "rightsIdentifierScheme"=>"SPDX", + + "rightsUri"=>"https://creativecommons.org/licenses/by/3.0/legalcode", + + "schemeUri"=>"https://spdx.org/licenses/"}]) + end + it "funding schema version 3" do input = "https://doi.org/10.5281/ZENODO.1239" subject = Bolognese::Metadata.new(input: input)