Module: IiifS3::BaseProperties
- Includes:
- Utilities::Helpers
- Included in:
- Collection, Manifest
- Defined in:
- lib/iiif_s3/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 ⇒ Object
@return [String] The long-form description of this record.
-
#id ⇒ Object
Returns the value of attribute id.
-
#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 and to S3 (if enabled).
-
#type ⇒ String
The type of resource provided by this record.
Methods included from Utilities::Helpers
#add_default_redirect, #add_file_to_s3, #generate_build_location, #generate_id, #generate_image_location, #get_data_path, #get_s3_key, #save_to_disk
Instance Attribute Details
#attribution ⇒ String
Returns a human-readable label, typically used for attribution or credit.
34 35 36 |
# File 'lib/iiif_s3/base_properties.rb', line 34 def attribution @attribution end |
#description ⇒ Object
@return [String] The long-form description of this record
|
|
# File 'lib/iiif_s3/base_properties.rb', line 26
|
#id ⇒ Object
Returns the value of attribute id.
25 26 27 |
# File 'lib/iiif_s3/base_properties.rb', line 25 def id @id end |
#label ⇒ String
Returns The human-readable label for this record.
22 23 24 |
# File 'lib/iiif_s3/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/iiif_s3/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/iiif_s3/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/iiif_s3/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/iiif_s3/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/iiif_s3/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 and to S3 (if enabled).
86 87 88 |
# File 'lib/iiif_s3/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/iiif_s3/base_properties.rb', line 48 def type self.class::TYPE end |