Class: IIIF::V3::Presentation::Resource

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

Overview

class for generic content resource

Direct Known Subclasses

ImageResource

Constant Summary

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, #array_only_keys, from_ordered_hash, #hash_only_keys, #initialize, #int_only_keys, #legal_viewing_direction_values, #legal_viewing_hint_values, #numeric_only_keys, parse, #string_only_keys, #to_json, #to_ordered_hash

Methods included from HashBehaviours

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

Constructor Details

This class inherits a constructor from IIIF::V3::AbstractResource

Instance Method Details

#prohibited_keysObject



11
12
13
# File 'lib/iiif/v3/presentation/resource.rb', line 11

def prohibited_keys
  super + PAGING_PROPERTIES + %w{ nav_date viewing_direction start_canvas content_annotations}
end

#required_keysObject



7
8
9
# File 'lib/iiif/v3/presentation/resource.rb', line 7

def required_keys
  super + %w{ id }
end

#uri_only_keysObject



15
16
17
# File 'lib/iiif/v3/presentation/resource.rb', line 15

def uri_only_keys
  super + %w{ id }
end

#validateObject



19
20
21
22
23
24
25
26
# File 'lib/iiif/v3/presentation/resource.rb', line 19

def validate
  super

  unless self['id'] =~ /^https?:/
    err_msg = "id must be an http(s) URI for #{self.class}"
    raise IIIF::V3::Presentation::IllegalValueError, err_msg
  end
end