Class: Cocina::Models::DRO

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/cocina/models/dro.rb

Overview

Defined Under Namespace

Classes: Access, Administrative, Identification, ReleaseTag, Structural

Class Method Summary collapse

Class Method Details

.from_dynamic(dyn) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cocina/models/dro.rb', line 44

def self.from_dynamic(dyn)
  params = {
    externalIdentifier: dyn['externalIdentifier'],
    type: dyn['type'],
    label: dyn['label'],
    version: dyn['version']
  }
  if (access_params = dyn['access'])
    access = {}
    access[:embargoReleaseDate] = access_params['embargoReleaseDate'] if access_params['embargoReleaseDate']
    params[:access] = access
  end

  DRO.new(params)
end

.from_json(json) ⇒ Object



60
61
62
# File 'lib/cocina/models/dro.rb', line 60

def self.from_json(json)
  from_dynamic(JSON.parse(json))
end