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
-
#actions ⇒ Array<Action>
array of resource actions or nil.
-
#model ⇒ Model
model payload for the resource or nil.
-
#parameters ⇒ Parameters
action-specific URI parameters or nil.
-
#uri_template ⇒ String
RFC 6570 URI template.
Attributes inherited from NamedBlueprintNode
Instance Method Summary collapse
-
#initialize(sc_resource_handle) ⇒ Resource
constructor
A new instance of Resource.
Methods inherited from NamedBlueprintNode
Constructor Details
#initialize(sc_resource_handle) ⇒ Resource
Returns a new instance of Resource.
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/redsnow/blueprint.rb', line 339 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 sc_action_handle = RedSnow::Binding.sc_action_handle(sc_action_collection_handle, index) @actions << Action.new(sc_action_handle) end end @parameters = Parameters.new(RedSnow::Binding.sc_parameter_collection_handle_resource(sc_resource_handle)) end |
Instance Attribute Details
#actions ⇒ Array<Action>
array of resource actions or nil
331 332 333 |
# File 'lib/redsnow/blueprint.rb', line 331 def actions @actions end |
#model ⇒ Model
model payload for the resource or nil
331 332 333 |
# File 'lib/redsnow/blueprint.rb', line 331 def model @model end |
#parameters ⇒ Parameters
action-specific URI parameters or nil
331 332 333 |
# File 'lib/redsnow/blueprint.rb', line 331 def parameters @parameters end |
#uri_template ⇒ String
RFC 6570 URI template
331 332 333 |
# File 'lib/redsnow/blueprint.rb', line 331 def uri_template @uri_template end |