Class: TrophyApiClient::AdminTenant
- Inherits:
-
Object
- Object
- TrophyApiClient::AdminTenant
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#created ⇒ DateTime
readonly
When the tenant was created.
-
#customer_id ⇒ String
readonly
The external customer ID for this tenant.
-
#id ⇒ String
readonly
The tenant UUID.
-
#name ⇒ String
readonly
Human-readable name for the tenant.
-
#status ⇒ TrophyApiClient::AdminTenantStatus
readonly
The lifecycle status of the tenant.
-
#updated ⇒ DateTime
readonly
When the tenant was last updated.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::AdminTenant
Deserialize a JSON object to an instance of AdminTenant.
-
.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.
Instance Method Summary collapse
- #initialize(id:, customer_id:, name:, status:, created:, updated:, additional_properties: nil) ⇒ TrophyApiClient::AdminTenant constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AdminTenant to a JSON object.
Constructor Details
#initialize(id:, customer_id:, name:, status:, created:, updated:, additional_properties: nil) ⇒ TrophyApiClient::AdminTenant
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#created ⇒ DateTime (readonly)
Returns When the tenant was created.
20 21 22 |
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 20 def created @created end |
#customer_id ⇒ String (readonly)
Returns 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 |
#id ⇒ String (readonly)
Returns The tenant UUID.
12 13 14 |
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 12 def id @id end |
#name ⇒ String (readonly)
Returns Human-readable name for the tenant.
16 17 18 |
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 16 def name @name end |
#status ⇒ TrophyApiClient::AdminTenantStatus (readonly)
Returns The lifecycle status of the tenant.
18 19 20 |
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 18 def status @status end |
#updated ⇒ DateTime (readonly)
Returns 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
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.
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
84 85 86 |
# File 'lib/trophy_api_client/types/admin_tenant.rb', line 84 def to_json(*_args) @_field_set&.to_json end |