Class: RedSnow::Resource
- Inherits:
-
NamedBlueprintNode
- Object
- BlueprintNode
- NamedBlueprintNode
- RedSnow::Resource
- Defined in:
- lib/redsnow/blueprint.rb
Overview
Resource Blueprint AST node represents 'resource section'
Instance Attribute Summary (collapse)
-
- (Array<Action>) actions
array of resource actions or nil.
-
- (String) description
inherited
from NamedBlueprintNode
description of the node.
-
- (Model) model
model payload for the resource or nil.
-
- (String) name
inherited
from NamedBlueprintNode
name of the node.
-
- (Parameters) parameters
action-specific URI parameters or nil.
-
- (String) uri_template
RFC 6570 URI template.
Instance Method Summary (collapse)
-
- (Resource) initialize(sc_resource_handle)
constructor
A new instance of Resource.
Constructor Details
- (Resource) initialize(sc_resource_handle)
Returns a new instance of Resource
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/redsnow/blueprint.rb', line 279 def initialize(sc_resource_handle) @name = RedSnow::Binding.sc_resource_name(sc_resource_handle) @description = RedSnow::Binding.sc_resource_description(sc_resource_handle) @uri_template = RedSnow::Binding.sc_resource_uritemplate(sc_resource_handle) sc_payload_handle_resource = RedSnow::Binding.sc_payload_handle_resource(sc_resource_handle) @model = Payload.new(sc_payload_handle_resource) @actions = Array.new sc_action_collection_handle = RedSnow::Binding.sc_action_collection_handle(sc_resource_handle) sc_action_collection_size = RedSnow::Binding.sc_action_collection_size(sc_action_collection_handle) if sc_action_collection_size > 0 action_size = sc_action_collection_size - 1 for index in 0..action_size do @actions << Action.new(RedSnow::Binding.sc_action_handle(sc_action_collection_handle, index)) end end @parameters = Parameters.new(RedSnow::Binding.sc_parameter_collection_handle_resource(sc_resource_handle)) end |
Instance Attribute Details
- (Array<Action>) actions
array of resource actions or nil
272 273 274 |
# File 'lib/redsnow/blueprint.rb', line 272 def actions @actions end |
- (String) description Originally defined in class NamedBlueprintNode
description of the node
- (Model) model
model payload for the resource or nil
272 273 274 |
# File 'lib/redsnow/blueprint.rb', line 272 def model @model end |
- (String) name Originally defined in class NamedBlueprintNode
name of the node
- (Parameters) parameters
action-specific URI parameters or nil
272 273 274 |
# File 'lib/redsnow/blueprint.rb', line 272 def parameters @parameters end |
- (String) uri_template
RFC 6570 URI template
272 273 274 |
# File 'lib/redsnow/blueprint.rb', line 272 def uri_template @uri_template end |