Class: Cadenya::Types::WidgetInfo

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(dns_label: nil, host: nil, agent: nil, created_by: nil) ⇒ WidgetInfo

Returns a new instance of WidgetInfo.



7310
7311
7312
7313
7314
7315
# File 'lib/cadenya/types.rb', line 7310

def initialize(dns_label: nil, host: nil, agent: nil, created_by: nil)
  @dns_label = dns_label
  @host = host
  @agent = agent
  @created_by = created_by
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



7308
7309
7310
# File 'lib/cadenya/types.rb', line 7308

def agent
  @agent
end

#created_byObject (readonly)

Returns the value of attribute created_by.



7308
7309
7310
# File 'lib/cadenya/types.rb', line 7308

def created_by
  @created_by
end

#dns_labelObject (readonly)

Returns the value of attribute dns_label.



7308
7309
7310
# File 'lib/cadenya/types.rb', line 7308

def dns_label
  @dns_label
end

#hostObject (readonly)

Returns the value of attribute host.



7308
7309
7310
# File 'lib/cadenya/types.rb', line 7308

def host
  @host
end

Class Method Details

.from_json(data) ⇒ Object



7317
7318
7319
7320
7321
7322
7323
7324
# File 'lib/cadenya/types.rb', line 7317

def self.from_json(data)
  new(
    dns_label: data["dnsLabel"],
    host: data["host"],
    agent: data["agent"].nil? ? nil : Types::BareMetadata.from_json(data["agent"]),
    created_by: data["createdBy"].nil? ? nil : Types::Profile.from_json(data["createdBy"]),
  )
end

Instance Method Details

#to_hObject



7326
7327
7328
7329
7330
7331
7332
7333
# File 'lib/cadenya/types.rb', line 7326

def to_h
  {
    dns_label: Util.plain(@dns_label),
    host: Util.plain(@host),
    agent: Util.plain(@agent),
    created_by: Util.plain(@created_by),
  }.reject { |_k, v| v.nil? }
end