Class: TrophyApiClient::AdminTenant

Inherits:
Object
  • Object
show all
Defined in:
lib/trophy_api_client/types/admin_tenant.rb

Overview

A tenant in a multi-tenant environment.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, customer_id:, name:, status:, created:, updated:, additional_properties: nil) ⇒ TrophyApiClient::AdminTenant

Parameters:

  • id (String)

    The tenant UUID.

  • customer_id (String)

    The external customer ID for this tenant.

  • name (String)

    Human-readable name for the tenant.

  • status (TrophyApiClient::AdminTenantStatus)

    The lifecycle status of the tenant.

  • created (DateTime)

    When the tenant was created.

  • updated (DateTime)

    When the tenant was last updated.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 39

def initialize(id:, customer_id:, name:, status:, created:, updated:, additional_properties: nil)
  @id = id
  @customer_id = customer_id
  @name = name
  @status = status
  @created = created
  @updated = updated
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "customerId": customer_id,
    "name": name,
    "status": status,
    "created": created,
    "updated": updated
  }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



24
25
26
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 24

def additional_properties
  @additional_properties
end

#createdDateTime (readonly)

Returns When the tenant was created.

Returns:

  • (DateTime)

    When the tenant was created.



20
21
22
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 20

def created
  @created
end

#customer_idString (readonly)

Returns The external customer ID for this tenant.

Returns:

  • (String)

    The external customer ID for this tenant.



14
15
16
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 14

def customer_id
  @customer_id
end

#idString (readonly)

Returns The tenant UUID.

Returns:

  • (String)

    The tenant UUID.



12
13
14
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 12

def id
  @id
end

#nameString (readonly)

Returns Human-readable name for the tenant.

Returns:

  • (String)

    Human-readable name for the tenant.



16
17
18
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 16

def name
  @name
end

#statusTrophyApiClient::AdminTenantStatus (readonly)

Returns The lifecycle status of the tenant.

Returns:



18
19
20
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 18

def status
  @status
end

#updatedDateTime (readonly)

Returns When the tenant was last updated.

Returns:

  • (DateTime)

    When the tenant was last updated.



22
23
24
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 22

def updated
  @updated
end

Class Method Details

.from_json(json_object:) ⇒ TrophyApiClient::AdminTenant

Deserialize a JSON object to an instance of AdminTenant

Parameters:

  • json_object (String)

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 61

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  customer_id = parsed_json["customerId"]
  name = parsed_json["name"]
  status = parsed_json["status"]
  created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
  updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
  new(
    id: id,
    customer_id: customer_id,
    name: name,
    status: status,
    created: created,
    updated: updated,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


94
95
96
97
98
99
100
101
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 94

def self.validate_raw(obj:)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.customer_id.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.status.is_a?(TrophyApiClient::AdminTenantStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
  obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AdminTenant to a JSON object

Returns:

  • (String)


84
85
86
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 84

def to_json(*_args)
  @_field_set&.to_json
end