Class: Atum::Core::Schema::ResourceSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/atum/core/schema/resource_schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema, definition, name) ⇒ ResourceSchema

Instantiate a resource schema.

Parameters:

  • schema (ApiSchema)

    The whole document’s schema

  • name (String)

    The name of the resource to identify in the schema.



11
12
13
14
15
# File 'lib/atum/core/schema/resource_schema.rb', line 11

def initialize(schema, definition, name)
  @schema = schema
  @name = name
  @definition = definition
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/atum/core/schema/resource_schema.rb', line 5

def name
  @name
end

Instance Method Details

Get a schema for a named link.

Parameters:

  • name (String)

    The name of the link.

Raises:

  • (SchemaError)

    Raised if an unknown link name is provided.



25
26
27
28
29
# File 'lib/atum/core/schema/resource_schema.rb', line 25

def link_schema_for(name)
  link_schema = link_schema_hash[name]
  raise SchemaError, "Unknown link '#{name}'." unless link_schema
  link_schema
end

The link schema children that are part of this resource schema.

Returns:

  • (Array<LinkSchema>)

    The link schema children.



34
35
36
# File 'lib/atum/core/schema/resource_schema.rb', line 34

def link_schemas
  link_schema_hash.values
end