Class: Cadenya::Types::BareMetadata

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(id: nil, name: nil) ⇒ BareMetadata

Returns a new instance of BareMetadata.



1011
1012
1013
1014
# File 'lib/cadenya/types.rb', line 1011

def initialize(id: nil, name: nil)
  @id = id
  @name = name
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



1009
1010
1011
# File 'lib/cadenya/types.rb', line 1009

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



1009
1010
1011
# File 'lib/cadenya/types.rb', line 1009

def name
  @name
end

Class Method Details

.from_json(data) ⇒ Object



1016
1017
1018
1019
1020
1021
# File 'lib/cadenya/types.rb', line 1016

def self.from_json(data)
  new(
    id: data["id"],
    name: data["name"],
  )
end

Instance Method Details

#to_hObject



1023
1024
1025
1026
1027
1028
# File 'lib/cadenya/types.rb', line 1023

def to_h
  {
    id: Util.plain(@id),
    name: Util.plain(@name),
  }.reject { |_k, v| v.nil? }
end