Class: IIIF::V3::Presentation::Range

Inherits:
Sequence show all
Defined in:
lib/iiif/v3/presentation/range.rb

Overview

Ranges are linked or embedded within the manifest in a structures field

Constant Summary collapse

TYPE =
'Range'.freeze
VALID_ITEM_TYPES =
[IIIF::V3::Presentation::Canvas, IIIF::V3::Presentation::Range]

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 Sequence

#prohibited_keys

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 = {}) ⇒ Range

Returns a new instance of Range.



24
25
26
27
# File 'lib/iiif/v3/presentation/range.rb', line 24

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

Instance Method Details

#array_only_keysObject

TODO: contentAnnotations: links to AnnotationCollection TODO: startCanvas: A link from a Sequence or Range to a Canvas that is contained within it



16
17
18
# File 'lib/iiif/v3/presentation/range.rb', line 16

def array_only_keys
  super + %w{ members }
end


20
21
22
# File 'lib/iiif/v3/presentation/range.rb', line 20

def legal_viewing_hint_values
  super + %w{ top }
end

#required_keysObject



9
10
11
# File 'lib/iiif/v3/presentation/range.rb', line 9

def required_keys
  super + %w{ id label }
end

#validateObject



29
30
31
32
33
34
35
36
# File 'lib/iiif/v3/presentation/range.rb', line 29

def validate
  super
  validate_list(self['items']) if self['items']
  validate_list(self['canvases']) if self['canvases']
  # TODO: Ranges must have URIs and they should be http(s) URIs.
  # TODO: contentAnnotations: links to AnnotationCollection
  # TODO: startCanvas: A link from a Sequence or Range to a Canvas that is contained within it
end