Class: X::Topic

Inherits:
Resource show all
Defined in:
x-objects/lib/x/objects/topic.rb

Overview

A topic a space is about

The API offers no lookup of topics, so a topic is read from the response of the space that expanded it, and the class answers no finder. from_id builds one from its identifier, which a topic the response did not expand is built as too, and which compares equal to the topic it identifies, but hydrate and refresh raise UnsupportedOperation for one that is not hydrated, since there is nothing to look it up with.

Constant Summary collapse

FIELDS =

Every public topic field

A minor release may add to it the fields the API adds, so that a lookup asks for them too; see Resource#hydrated? for what that means for a resource looked up with a list of fields of its own.

%w[description id name].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Constructor Details

This class inherits a constructor from X::Resource

Instance Attribute Details

#description ⇒ String? (readonly)

What the topic is about

Examples:

Get the description

topic.description # => "All about technology"

Returns:

  • (String, nil) —

    the description



57
# File 'x-objects/lib/x/objects/topic.rb', line 57

attribute :description

#name ⇒ String? (readonly)

The name of the topic

Examples:

Get the name

topic.name # => "Technology"

Returns:

  • (String, nil) —

    the name



49
# File 'x-objects/lib/x/objects/topic.rb', line 49

attribute :name

Class Method Details

.default_params ⇒ Hash{String => Array<String>}

The default query parameters, which request every field

The API offers no lookup of topics, so they are requested by the spaces that expand them, which ask for these fields, and a topic a response included with all of them is hydrated.

Examples:

Get the default parameters

X::Topic.default_params # => {"topic.fields" => [...]}

Returns:

  • (Hash{String => Array<String>}) —

    the default query parameters



30
# File 'x-objects/lib/x/objects/topic.rb', line 30

def self.default_params = {"topic.fields" => FIELDS}