Class: Aspire::Object::ListSection

Inherits:
ListBase show all
Includes:
Properties
Defined in:
lib/aspire/object/list.rb

Overview

Represents a reading list section in the Aspire API

Constant Summary

Constants included from Properties

Properties::AIISO_CODE, Properties::AIISO_NAME, Properties::CREATED, Properties::DESCRIPTION, Properties::HAS_CREATOR, Properties::HAS_OWNER, Properties::LAST_PUBLISHED, Properties::LAST_UPDATED, Properties::NAME, Properties::PUBLISHED_BY, Properties::USED_BY

Constants inherited from ListBase

Aspire::Object::ListBase::KEY_PREFIX

Constants inherited from Base

Base::STRIP_HTML

Constants included from Util

Util::LD_API_URI

Instance Attribute Summary collapse

Attributes inherited from ListBase

#entries, #parent

Attributes inherited from Base

#factory, #uri

Instance Method Summary collapse

Methods inherited from ListBase

#each, #each_item, #each_section, #get_entries, #items, #length, #parent_list, #parent_lists, #parent_section, #parent_sections, #parents, #parents_include?, #sections

Methods inherited from Base

#get_boolean, #get_date, #get_property

Methods included from Util

#child_url?, #duration, #id_from_uri, #item?, #linked_data, #linked_data_path, #list?, #list_url?, #module?, #parent_url?, #parse_url, #resource?, #section?, #url_for_comparison, #url_path, #user?

Constructor Details

#initialize(uri, factory, parent = nil, json: nil, ld: nil) ⇒ void

Initialises a new ListSection instance

Parameters:

  • uri (String)

    the URI of the object

  • factory (Aspire::Object::Factory)

    a factory returning ListBase subclass instances

  • parent (Aspire::Object::ListBase) (defaults to: nil)

    this object’s parent object

  • json (Hash) (defaults to: nil)

    the parsed JSON data from the Aspire JSON API

  • ld (Hash) (defaults to: nil)

    the parsed JSON data from the Aspire linked data API



575
576
577
578
579
580
# File 'lib/aspire/object/list.rb', line 575

def initialize(uri, factory, parent = nil, json: nil, ld: nil)
  super(uri, factory, parent, json: json, ld: ld)
  section_ld = linked_data(uri, ld)
  self.description = get_property(DESCRIPTION, section_ld)
  self.name = get_property(NAME, section_ld)
end

Instance Attribute Details

#descriptionString

Returns the reading list section description.

Returns:

  • (String)

    the reading list section description



561
562
563
# File 'lib/aspire/object/list.rb', line 561

def description
  @description
end

#nameString

Returns the reading list section name.

Returns:

  • (String)

    the reading list section name



565
566
567
# File 'lib/aspire/object/list.rb', line 565

def name
  @name
end

Instance Method Details

#to_sString

Returns a string representation of the ListSection instance (the section

name)

Returns:

  • (String)

    the string representation of the ListSection instance



585
586
587
# File 'lib/aspire/object/list.rb', line 585

def to_s
  name || super
end