Module: Talis::Hierarchy::Resource::Helpers

Included in:
Talis::Hierarchy::Resource
Defined in:
lib/talis/hierarchy/resource.rb

Overview

The methods defined within this module are available to instances of, and the class itself that extends Talis::Hierarchy::Resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesHash

Returns key-value pair attributes belonging to the resource.

Returns:

  • (Hash)

    key-value pair attributes belonging to the resource.



15
16
17
# File 'lib/talis/hierarchy/resource.rb', line 15

def attributes
  @attributes
end

#idString

Returns The ID of the resource.

Returns:

  • (String)

    The ID of the resource.



11
12
13
# File 'lib/talis/hierarchy/resource.rb', line 11

def id
  @id
end

#namespaceString

Returns The hierarchy namespace.

Returns:

  • (String)

    The hierarchy namespace.



9
10
11
# File 'lib/talis/hierarchy/resource.rb', line 9

def namespace
  @namespace
end

#typeString

Returns The type of resource.

Returns:

  • (String)

    The type of resource.



13
14
15
# File 'lib/talis/hierarchy/resource.rb', line 13

def type
  @type
end

Instance Method Details

#persisted?Boolean

A boolean indicating if the resource exists in the remote Blueprint instance

Returns:

  • (Boolean)


52
53
54
# File 'lib/talis/hierarchy/resource.rb', line 52

def persisted?
  !(@new_resource || @deleted)
end

#stored_idString

The resource id the API thinks the resource has (if it has been saved)

Returns:

  • (String)


45
46
47
# File 'lib/talis/hierarchy/resource.rb', line 45

def stored_id
  persisted? ? @original_id || id : id
end

#stored_typeString

The resource type the API thinks the resource has (if it has been saved)

Returns:

  • (String)


39
40
41
# File 'lib/talis/hierarchy/resource.rb', line 39

def stored_type
  persisted? ? @original_type || type : type
end