Class: RedSnow::Sourcemap::Resource

Inherits:
NamedNode show all
Defined in:
lib/redsnow/sourcemap.rb

Overview

Resource source map node

Instance Attribute Summary collapse

Attributes inherited from NamedNode

#description, #name

Attributes inherited from Node

#collection

Instance Method Summary collapse

Constructor Details

#initialize(sourcemap) ⇒ Resource

Returns a new instance of Resource.

Parameters:

  • sourcemap (json)


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

#actionsArray<Action>

array of resource actions or nil

Returns:

  • (Array<Action>)

    the current value of actions



199
200
201
# File 'lib/redsnow/sourcemap.rb', line 199

def actions
  @actions
end

#modelPayload

model payload for the resource or nil

Returns:

  • (Payload)

    the current value of model



199
200
201
# File 'lib/redsnow/sourcemap.rb', line 199

def model
  @model
end

#parametersParameters

action-specific URI parameters or nil

Returns:

  • (Parameters)

    the current value of parameters



199
200
201
# File 'lib/redsnow/sourcemap.rb', line 199

def parameters
  @parameters
end

#uri_templateSourcemap

RFC 6570 URI template

Returns:

  • (Sourcemap)

    the current value of uri_template



199
200
201
# File 'lib/redsnow/sourcemap.rb', line 199

def uri_template
  @uri_template
end