Module: WaxIiif::BaseProperties
- Includes:
- Utilities::Helpers
- Included in:
- Collection, Manifest
- Defined in:
- lib/wax_iiif/base_properties.rb
Overview
Add within, service, seeAlso, viewingHint fields
Module BaseProperties provides the set of properties that are shared across all IIIF types.
It is not a comprehensive list (yet), but it does handle most of the shared types. It does not include any types that have class-based restrictions.
It also performs some basic sanity checking on (some of) the fields, and provides utility classes that are applicable across the fields.
Instance Attribute Summary collapse
-
#attribution ⇒ String
A human-readable label, typically used for attribution or credit.
-
#description ⇒ String
The long-form description of this record.
-
#id ⇒ String
The URI for this record.
-
#label ⇒ String
The human-readable label for this record.
-
#license ⇒ String
The URI to a resource that describes the license or rights statement associated.
-
#logo ⇒ String
The URI to an image for the logo of the institution associated with this record.
-
#metadata ⇒ Hash
A set of key/value pairs describing additional metadata for the object.
-
#related ⇒ String+
The URI to related resources.
Instance Method Summary collapse
-
#base_properties ⇒ Hash
Return the base data structure for this record as a Hash This will be in IIIF format, and should convert to JSON as JSON-LD nicely.
-
#save ⇒ Void
Save the JSON representation of this record to disk.
-
#type ⇒ String
The type of resource provided by this record.
Methods included from Utilities::Helpers
#escape_yaml, #generate_build_location, #generate_id, #generate_image_location, #get_data_path, #save_to_disk
Instance Attribute Details
#attribution ⇒ String
Returns a human-readable label, typically used for attribution or credit.
34 35 36 |
# File 'lib/wax_iiif/base_properties.rb', line 34 def attribution @attribution end |
#description ⇒ String
Returns The long-form description of this record.
28 29 30 |
# File 'lib/wax_iiif/base_properties.rb', line 28 def description @description end |
#id ⇒ String
Returns The URI for this record.
25 26 27 |
# File 'lib/wax_iiif/base_properties.rb', line 25 def id @id end |
#label ⇒ String
Returns The human-readable label for this record.
22 23 24 |
# File 'lib/wax_iiif/base_properties.rb', line 22 def label @label end |
#license ⇒ String
Returns The URI to a resource that describes the license or rights statement associated.
40 41 42 |
# File 'lib/wax_iiif/base_properties.rb', line 40 def license @license end |
#logo ⇒ String
Returns The URI to an image for the logo of the institution associated with this record.
37 38 39 |
# File 'lib/wax_iiif/base_properties.rb', line 37 def logo @logo end |
#metadata ⇒ Hash
Returns A set of key/value pairs describing additional metadata for the object.
31 32 33 |
# File 'lib/wax_iiif/base_properties.rb', line 31 def @metadata end |
#related ⇒ String+
Returns The URI to related resources. Can be both a string or an array.
43 44 45 |
# File 'lib/wax_iiif/base_properties.rb', line 43 def @related end |
Instance Method Details
#base_properties ⇒ Hash
Return the base data structure for this record as a Hash This will be in IIIF format, and should convert to JSON as JSON-LD nicely.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/wax_iiif/base_properties.rb', line 65 def base_properties obj = { '@context' => PRESENTATION_CONTEXT, '@id' => self.id, '@type' => self.type, 'label' => self.label } obj['attribution'] = self.attribution if self.attribution obj['logo'] = self.logo if self.logo obj['description'] = self.description if self.description obj['attribution'] = self.attribution if self.attribution obj['license'] = self.license if self.license obj['related'] = self. if self. obj['metadata'] = self. if self. obj end |
#save ⇒ Void
Save the JSON representation of this record to disk
86 87 88 |
# File 'lib/wax_iiif/base_properties.rb', line 86 def save save_to_disk(JSON.parse(self.to_json)) end |
#type ⇒ String
The type of resource provided by this record.
48 49 50 |
# File 'lib/wax_iiif/base_properties.rb', line 48 def type self.class::TYPE end |