Class: Cadenya::Types::Widget

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata: nil, spec: nil, info: nil, state: nil) ⇒ Widget

Returns a new instance of Widget.



7281
7282
7283
7284
7285
7286
# File 'lib/cadenya/types.rb', line 7281

def initialize(metadata: nil, spec: nil, info: nil, state: nil)
  @metadata = 
  @spec = spec
  @info = info
  @state = state
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



7279
7280
7281
# File 'lib/cadenya/types.rb', line 7279

def info
  @info
end

#metadataObject (readonly)

Returns the value of attribute metadata.



7279
7280
7281
# File 'lib/cadenya/types.rb', line 7279

def 
  @metadata
end

#specObject (readonly)

Returns the value of attribute spec.



7279
7280
7281
# File 'lib/cadenya/types.rb', line 7279

def spec
  @spec
end

#stateObject (readonly)

Returns the value of attribute state.



7279
7280
7281
# File 'lib/cadenya/types.rb', line 7279

def state
  @state
end

Class Method Details

.from_json(data) ⇒ Object



7288
7289
7290
7291
7292
7293
7294
7295
# File 'lib/cadenya/types.rb', line 7288

def self.from_json(data)
  new(
    metadata: data["metadata"].nil? ? nil : Types::ResourceMetadata.from_json(data["metadata"]),
    spec: data["spec"].nil? ? nil : Types::WidgetSpec.from_json(data["spec"]),
    info: data["info"].nil? ? nil : Types::WidgetInfo.from_json(data["info"]),
    state: data["state"],
  )
end

Instance Method Details

#to_hObject



7297
7298
7299
7300
7301
7302
7303
7304
# File 'lib/cadenya/types.rb', line 7297

def to_h
  {
    metadata: Util.plain(@metadata),
    spec: Util.plain(@spec),
    info: Util.plain(@info),
    state: Util.plain(@state),
  }.reject { |_k, v| v.nil? }
end