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
-
#attributes ⇒ Hash
Key-value pair attributes belonging to the resource.
-
#id ⇒ String
The ID of the resource.
-
#namespace ⇒ String
The hierarchy namespace.
-
#type ⇒ String
The type of resource.
Instance Method Summary collapse
-
#persisted? ⇒ Boolean
A boolean indicating if the resource exists in the remote Blueprint instance.
-
#stored_id ⇒ String
The resource id the API thinks the resource has (if it has been saved).
-
#stored_type ⇒ String
The resource type the API thinks the resource has (if it has been saved).
Instance Attribute Details
#attributes ⇒ Hash
Returns key-value pair attributes belonging to the resource.
15 16 17 |
# File 'lib/talis/hierarchy/resource.rb', line 15 def attributes @attributes end |
#id ⇒ String
Returns The ID of the resource.
11 12 13 |
# File 'lib/talis/hierarchy/resource.rb', line 11 def id @id end |
#namespace ⇒ String
Returns The hierarchy namespace.
9 10 11 |
# File 'lib/talis/hierarchy/resource.rb', line 9 def namespace @namespace end |
#type ⇒ String
Returns 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
52 53 54 |
# File 'lib/talis/hierarchy/resource.rb', line 52 def persisted? !(@new_resource || @deleted) end |
#stored_id ⇒ String
The resource id the API thinks the resource has (if it has been saved)
45 46 47 |
# File 'lib/talis/hierarchy/resource.rb', line 45 def stored_id persisted? ? @original_id || id : id end |
#stored_type ⇒ String
The resource type the API thinks the resource has (if it has been saved)
39 40 41 |
# File 'lib/talis/hierarchy/resource.rb', line 39 def stored_type persisted? ? @original_type || type : type end |