Class: IIIF::Presentation::Annotation
- Inherits:
-
AbstractResource
- Object
- Service
- AbstractResource
- IIIF::Presentation::Annotation
- Defined in:
- lib/iiif/presentation/annotation.rb
Constant Summary collapse
- TYPE =
'oa:Annotation'
Constants included from HashBehaviours
HashBehaviours::SIMPLE_SELF_RETURNERS
Instance Method Summary collapse
- #abstract_resource_only_keys ⇒ Object
-
#initialize(hsh = {}) ⇒ Annotation
constructor
A new instance of Annotation.
- #required_keys ⇒ Object
Methods inherited from AbstractResource
#any_type_keys, #array_only_keys, #hash_only_keys, #int_only_keys, #legal_viewing_direction_values, #string_only_keys, #to_ordered_hash
Methods inherited from Service
#any_type_keys, #array_only_keys, from_ordered_hash, #hash_only_keys, #int_only_keys, parse, #string_only_keys, #to_json, #to_ordered_hash, #validate
Methods included from HashBehaviours
#clear, #merge, #merge!, #reject!, #select, #select!
Constructor Details
#initialize(hsh = {}) ⇒ Annotation
Returns a new instance of Annotation.
17 18 19 20 21 |
# File 'lib/iiif/presentation/annotation.rb', line 17 def initialize(hsh={}) hsh['@type'] = TYPE unless hsh.has_key? '@type' hsh['motivation'] = 'sc:painting' unless hsh.has_key? 'motivation' super(hsh) end |
Instance Method Details
#abstract_resource_only_keys ⇒ Object
13 14 15 |
# File 'lib/iiif/presentation/annotation.rb', line 13 def abstract_resource_only_keys super + [ { key: 'resource', type: IIIF::Presentation::Resource } ] end |
#required_keys ⇒ Object
9 10 11 |
# File 'lib/iiif/presentation/annotation.rb', line 9 def required_keys super + %w{ motivation } end |