Class: IIIF::V3::Presentation::Collection

Inherits:
AbstractResource show all
Defined in:
lib/iiif/v3/presentation/collection.rb

Constant Summary collapse

TYPE =
'Collection'.freeze

Constants inherited from AbstractResource

AbstractResource::CONTENT_RESOURCE_PROPERTIES, AbstractResource::PAGING_PROPERTIES

Constants included from HashBehaviours

HashBehaviours::SIMPLE_SELF_RETURNERS

Instance Method Summary collapse

Methods inherited from AbstractResource

#any_type_keys, from_ordered_hash, #hash_only_keys, #int_only_keys, #legal_viewing_direction_values, #numeric_only_keys, parse, #prohibited_keys, #string_only_keys, #to_json, #to_ordered_hash, #uri_only_keys

Methods included from HashBehaviours

#clear, #merge, #merge!, #reject!, #select, #select!

Constructor Details

#initialize(hsh = {}) ⇒ Collection



30
31
32
33
# File 'lib/iiif/v3/presentation/collection.rb', line 30

def initialize(hsh={})
  hsh['type'] = TYPE unless hsh.has_key? 'type'
  super(hsh)
end

Instance Method Details

#array_only_keysObject



12
13
14
# File 'lib/iiif/v3/presentation/collection.rb', line 12

def array_only_keys
  super + %w{ collections manifests }
end

TODO: paging properties Collection, AnnotationCollection, (formerly layer --> AnnotationPage???) allow; forbidden o.w.

first, last, next, prev id is URI, but may have other info total, startIndex The value must be a non-negative integer.



26
27
28
# File 'lib/iiif/v3/presentation/collection.rb', line 26

def legal_viewing_hint_values
  %w{ auto-advance together }
end

#required_keysObject



8
9
10
# File 'lib/iiif/v3/presentation/collection.rb', line 8

def required_keys
  super + %w{ id label }
end

#validateObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/iiif/v3/presentation/collection.rb', line 35

def validate
  super
  # TODO: each member of collections and manifests must be a Hash
  # TODO: each member of collections and manifests MUST have id, type, and label
  # TODO: navDate (collection or manifest only) - The value must be an xsd:dateTime literal in UTC, expressed in the form “YYYY-MM-DDThh:mm:ssZ”;  There must be at most one navDate associated with any given resource.

  # TODO: paging properties
  # Collection, AnnotationCollection, (formerly layer --> AnnotationPage???) allow;  forbidden o.w.
  # ---
  # first, last, next, prev
  #   id is URI, but may have other info
  # total, startIndex
  #   The value must be a non-negative integer.
end