diff --git a/Gemfile.lock b/Gemfile.lock index 48ee813cd..e5c9f406c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,7 +60,7 @@ GEM audited (4.10.0) activerecord (>= 4.2, < 6.2) aws-eventstream (1.1.1) - aws-partitions (1.444.0) + aws-partitions (1.446.0) aws-sdk-core (3.114.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) @@ -102,7 +102,7 @@ GEM latex-decode (~> 0.0) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) - bolognese (1.9.4) + bolognese (1.9.5) activesupport (>= 4.2.5) benchmark_methods (~> 0.7) bibtex-ruby (>= 5.1.0) @@ -156,7 +156,7 @@ GEM commonmarker (0.17.13) ruby-enum (~> 0.5) concurrent-ruby (1.1.8) - connection_pool (2.2.4) + connection_pool (2.2.5) countries (2.1.4) i18n_data (~> 0.8.0) money (~> 6.9) @@ -296,7 +296,7 @@ GEM jsonlint (0.3.0) oj (~> 3) optimist (~> 3) - jwt (2.2.2) + jwt (2.2.3) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -374,7 +374,7 @@ GEM nokogiri (1.11.3) mini_portile2 (~> 2.5.0) racc (~> 1.4) - oj (3.11.3) + oj (3.11.5) oj_mimic_json (1.0.1) optimist (3.0.1) pandoc-ruby (2.1.4) @@ -385,7 +385,7 @@ GEM addressable (>= 2.4.0) nokogiri (>= 1.8.0) public_suffix (>= 2.0.0, < 2.1) - premailer (1.14.2) + premailer (1.14.3) addressable css_parser (>= 1.6.0) htmlentities (>= 4.0.0) @@ -496,7 +496,7 @@ GEM rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) rspec-support (3.9.4) - rubocop (1.12.1) + rubocop (1.13.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) diff --git a/app/controllers/datacite_dois_controller.rb b/app/controllers/datacite_dois_controller.rb index f8dc277b5..d30374299 100644 --- a/app/controllers/datacite_dois_controller.rb +++ b/app/controllers/datacite_dois_controller.rb @@ -1112,6 +1112,7 @@ def safe_params dates identifiers relatedIdentifiers + relatedItems fundingReferences geoLocations rightsList diff --git a/app/models/doi.rb b/app/models/doi.rb index 250680217..9e8f7624a 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -121,7 +121,7 @@ class Doi < ApplicationRecord validate :check_landing_page, if: :landing_page? validate :check_identifiers, if: :identifiers? validate :check_related_identifiers, if: :related_identifiers? - # validate :check_related_items, if: :related_items? + validate :check_related_items, if: :related_items? validate :check_funding_references, if: :funding_references? validate :check_geo_locations, if: :geo_locations? validate :check_language, if: :language? @@ -1656,15 +1656,6 @@ def identifier normalize_doi(doi, sandbox: !Rails.env.production?) end - # disable virtual attributes when database has been migrated - def related_items=(value) - write_attribute(:related_items, value) if has_attribute?(:related_items) - end - - def related_items - read_attribute(:related_items) if has_attribute?(:related_items) - end - def client_id client.symbol.downcase if client.present? end diff --git a/spec/factories/default.rb b/spec/factories/default.rb index 2a46e0dfd..b177dbc13 100644 --- a/spec/factories/default.rb +++ b/spec/factories/default.rb @@ -232,6 +232,22 @@ }, ] end + related_items do + [ + { + "firstPage" => "249", + "lastPage" => "264", + "publicationYear" => "2018", + "relatedItemIdentifier" => + { "__content__" => "10.1016/j.physletb.2017.11.044", + "relatedItemIdentifierType" => "DOI" }, + "relatedItemType" => "Journal", + "relationType" => "IsPublishedIn", + "titles" => { "title" => "Physics letters / B" }, + "volume" => "776" + } + ] + end schema_version { "http://datacite.org/schema/kernel-4" } source { "test" } type { "DataciteDoi" }