Class: WorkOS::ObjectModel

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/vault/object.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  metadata: :metadata,
  name: :name,
  value: :value
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

normalize

Methods included from HashProvider

#inspect, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ ObjectModel

Returns a new instance of ObjectModel.



20
21
22
23
24
25
26
# File 'lib/workos/vault/object.rb', line 20

def initialize(json)
  hash = self.class.normalize(json)
  @id = hash[:id]
  @metadata = hash[:metadata] ? WorkOS::ObjectMetadata.new(hash[:metadata]) : nil
  @name = hash[:name]
  @value = hash[:value]
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



14
15
16
# File 'lib/workos/vault/object.rb', line 14

def id
  @id
end

#metadataObject

Returns the value of attribute metadata.



14
15
16
# File 'lib/workos/vault/object.rb', line 14

def 
  @metadata
end

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/workos/vault/object.rb', line 14

def name
  @name
end

#valueObject

Returns the value of attribute value.



14
15
16
# File 'lib/workos/vault/object.rb', line 14

def value
  @value
end