Class: IIIF::V3::Presentation::AnnotationPage
Constant Summary
collapse
- TYPE =
'AnnotationPage'.freeze
AbstractResource::CONTENT_RESOURCE_PROPERTIES, AbstractResource::PAGING_PROPERTIES
HashBehaviours::SIMPLE_SELF_RETURNERS
Instance Method Summary
collapse
#any_type_keys, from_ordered_hash, #hash_only_keys, #int_only_keys, #legal_viewing_direction_values, #numeric_only_keys, parse, #string_only_keys, #to_json, #to_ordered_hash
#clear, #merge, #merge!, #reject!, #select, #select!
Constructor Details
Returns a new instance of AnnotationPage.
29
30
31
32
|
# File 'lib/iiif/v3/presentation/annotation_page.rb', line 29
def initialize(hsh={})
hsh['type'] = TYPE unless hsh.has_key? 'type'
super(hsh)
end
|
Instance Method Details
#array_only_keys ⇒ Object
21
22
23
|
# File 'lib/iiif/v3/presentation/annotation_page.rb', line 21
def array_only_keys;
super + %w{ items }
end
|
#legal_viewing_hint_values ⇒ Object
25
26
27
|
# File 'lib/iiif/v3/presentation/annotation_page.rb', line 25
def legal_viewing_hint_values
super + %w{ none }
end
|
#prohibited_keys ⇒ Object
12
13
14
15
|
# File 'lib/iiif/v3/presentation/annotation_page.rb', line 12
def prohibited_keys
super + CONTENT_RESOURCE_PROPERTIES +
%w{ first last total nav_date viewing_direction start_canvas content_annotations }
end
|
#required_keys ⇒ Object
8
9
10
|
# File 'lib/iiif/v3/presentation/annotation_page.rb', line 8
def required_keys
super + %w{ id }
end
|
#uri_only_keys ⇒ Object
17
18
19
|
# File 'lib/iiif/v3/presentation/annotation_page.rb', line 17
def uri_only_keys
super + %w{ id }
end
|
#validate ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/iiif/v3/presentation/annotation_page.rb', line 34
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
items = self['items']
if items && items.any?
unless items.all? { |entry| entry.instance_of?(IIIF::V3::Presentation::Annotation) }
err_msg = 'All entries in the items list must be a IIIF::V3::Presentation::Annotation'
raise IIIF::V3::Presentation::IllegalValueError, err_msg
end
end
end
|