Module: WaxIiif::BaseProperties

Includes:
Utilities::Helpers
Included in:
Collection, Manifest
Defined in:
lib/wax_iiif/base_properties.rb

Overview

TODO:

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.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities::Helpers

#escape_yaml, #generate_build_location, #generate_id, #generate_image_location, #get_data_path, #save_to_disk

Instance Attribute Details

#attributionString

Returns a human-readable label, typically used for attribution or credit.

Returns:

  • (String)

    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

#descriptionString

Returns The long-form description of this record.

Returns:

  • (String)

    The long-form description of this record



28
29
30
# File 'lib/wax_iiif/base_properties.rb', line 28

def description
  @description
end

#idString

Returns The URI for this record.

Returns:

  • (String)

    The URI for this record



25
26
27
# File 'lib/wax_iiif/base_properties.rb', line 25

def id
  @id
end

#labelString

Returns The human-readable label for this record.

Returns:

  • (String)

    The human-readable label for this record



22
23
24
# File 'lib/wax_iiif/base_properties.rb', line 22

def label
  @label
end

#licenseString

Returns The URI to a resource that describes the license or rights statement associated.

Returns:

  • (String)

    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

#logoString

Returns The URI to an image for the logo of the institution associated with this record.

Returns:

  • (String)

    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
end

#metadataHash

Returns A set of key/value pairs describing additional metadata for the object.

Returns:

  • (Hash)

    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

Returns The URI to related resources. Can be both a string or an array.

Returns:

  • (String, Array<String>)

    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
  @related
end

Instance Method Details

#base_propertiesHash

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.

Returns:

  • (Hash)

    The base properties of this record



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. if self.
  obj['description'] = self.description if self.description
  obj['attribution'] = self.attribution if self.attribution
  obj['license'] = self.license if self.license
  obj['related'] = self.related if self.related
  obj['metadata'] = self. if self.

  obj
end

#saveVoid

Save the JSON representation of this record to disk

Returns:

  • (Void)


86
87
88
# File 'lib/wax_iiif/base_properties.rb', line 86

def save
  save_to_disk(JSON.parse(self.to_json))
end

#typeString

The type of resource provided by this record.

Returns:

  • (String)

    The type of record



48
49
50
# File 'lib/wax_iiif/base_properties.rb', line 48

def type
  self.class::TYPE
end