Class: Cadenya::Types::Subject

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, info: nil) ⇒ Subject

Returns a new instance of Subject.



5279
5280
5281
5282
# File 'lib/cadenya/types.rb', line 5279

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

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



5277
5278
5279
# File 'lib/cadenya/types.rb', line 5277

def info
  @info
end

#metadataObject (readonly)

Returns the value of attribute metadata.



5277
5278
5279
# File 'lib/cadenya/types.rb', line 5277

def 
  @metadata
end

Class Method Details

.from_json(data) ⇒ Object



5284
5285
5286
5287
5288
5289
# File 'lib/cadenya/types.rb', line 5284

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

Instance Method Details

#to_hObject



5291
5292
5293
5294
5295
5296
# File 'lib/cadenya/types.rb', line 5291

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