lib/cocina/models/dro.rb in cocina-models-0.4.0 vs lib/cocina/models/dro.rb in cocina-models-0.4.1

- old
+ new

@@ -33,11 +33,11 @@ end attribute :externalIdentifier, Types::Strict::String attribute :type, Types::Strict::String attribute :label, Types::Strict::String - attribute :version, Types::Strict::Integer + attribute :version, Types::Coercible::Integer attribute(:access, Access.default { Access.new }) attribute(:administrative, Administrative.default { Administrative.new }) attribute(:identification, Identification.default { Identification.new }) attribute(:structural, Structural.default { Structural.new }) @@ -46,13 +46,12 @@ externalIdentifier: dyn['externalIdentifier'], type: dyn['type'], label: dyn['label'], version: dyn['version'] } - if dyn['access'] - access = { - embargoReleaseDate: dyn['access']['embargoReleaseDate'] - } + if (access_params = dyn['access']) + access = {} + access[:embargoReleaseDate] = access_params['embargoReleaseDate'] if access_params['embargoReleaseDate'] params[:access] = access end DRO.new(params) end