Sha256: baa1454d222d22c28465a957917ad73d8ac212cf742ed3288cb0903ae59e5803

Contents?: true

Size: 637 Bytes

Versions: 3

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

require 'json'

module Cocina
  module Models
    # A digital repository object.  See https://github.com/sul-dlss-labs/taco/blob/master/maps/DRO.json
    class DRO < Dry::Struct
      attribute :externalIdentifier, Types::Strict::String
      attribute :type, Types::Strict::String
      attribute :label, Types::Strict::String

      def self.from_dynamic(d)
        DRO.new(
          externalIdentifier: d['externalIdentifier'],
          type: d['type'],
          label: d['label']
        )
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cocina-models-0.1.2 lib/cocina/models/dro.rb
cocina-models-0.1.1 lib/cocina/models/dro.rb
cocina-models-0.1.0 lib/cocina/models/dro.rb