Class: RedSnow::Sourcemap::Resource
- Defined in:
- lib/redsnow/sourcemap.rb
Overview
Resource source map node
Instance Attribute Summary collapse
-
#actions ⇒ Array<Action>
array of resource actions or nil.
-
#model ⇒ Payload
model payload for the resource or nil.
-
#parameters ⇒ Parameters
action-specific URI parameters or nil.
-
#uri_template ⇒ Sourcemap
RFC 6570 URI template.
Attributes inherited from NamedNode
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(sourcemap) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
#initialize(sourcemap) ⇒ Resource
Returns a new instance of Resource.
206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/redsnow/sourcemap.rb', line 206 def initialize(sourcemap) return if sourcemap.nil? super(sourcemap) @uri_template = SourceMap.new(sourcemap['uriTemplate']) @model = Payload.new(sourcemap['model']) @parameters = Parameters.new(sourcemap['parameters']) @actions = [] sourcemap.key?('actions') && sourcemap['actions'].each do |action| @actions << Action.new(action) end end |
Instance Attribute Details
#actions ⇒ Array<Action>
array of resource actions or nil
199 200 201 |
# File 'lib/redsnow/sourcemap.rb', line 199 def actions @actions end |
#model ⇒ Payload
model payload for the resource or nil
199 200 201 |
# File 'lib/redsnow/sourcemap.rb', line 199 def model @model end |
#parameters ⇒ Parameters
action-specific URI parameters or nil
199 200 201 |
# File 'lib/redsnow/sourcemap.rb', line 199 def parameters @parameters end |
#uri_template ⇒ Sourcemap
RFC 6570 URI template
199 200 201 |
# File 'lib/redsnow/sourcemap.rb', line 199 def uri_template @uri_template end |