Class: Cadenya::Types::SubjectReference

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, external_id: nil, name: nil) ⇒ SubjectReference

Returns a new instance of SubjectReference.



5348
5349
5350
5351
5352
# File 'lib/cadenya/types.rb', line 5348

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

Instance Attribute Details

#external_idObject (readonly)

Returns the value of attribute external_id.



5346
5347
5348
# File 'lib/cadenya/types.rb', line 5346

def external_id
  @external_id
end

#idObject (readonly)

Returns the value of attribute id.



5346
5347
5348
# File 'lib/cadenya/types.rb', line 5346

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5346
5347
5348
# File 'lib/cadenya/types.rb', line 5346

def name
  @name
end

Class Method Details

.from_json(data) ⇒ Object



5354
5355
5356
5357
5358
5359
5360
# File 'lib/cadenya/types.rb', line 5354

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

Instance Method Details

#to_hObject



5362
5363
5364
5365
5366
5367
5368
# File 'lib/cadenya/types.rb', line 5362

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