Class: TrophyApiClient::DeletedResource
- Inherits:
-
Object
- Object
- TrophyApiClient::DeletedResource
- Defined in:
- lib/trophy_api_client/types/deleted_resource.rb
Overview
A deleted resource represented by ID.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ String
readonly
The ID of the deleted resource.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::DeletedResource
Deserialize a JSON object to an instance of DeletedResource.
-
.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:, additional_properties: nil) ⇒ TrophyApiClient::DeletedResource constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of DeletedResource to a JSON object.
Constructor Details
#initialize(id:, additional_properties: nil) ⇒ TrophyApiClient::DeletedResource
22 23 24 25 26 |
# File 'lib/trophy_api_client/types/deleted_resource.rb', line 22 def initialize(id:, additional_properties: nil) @id = id @additional_properties = additional_properties @_field_set = { "id": id } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
12 13 14 |
# File 'lib/trophy_api_client/types/deleted_resource.rb', line 12 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns The ID of the deleted resource.
10 11 12 |
# File 'lib/trophy_api_client/types/deleted_resource.rb', line 10 def id @id end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::DeletedResource
Deserialize a JSON object to an instance of DeletedResource
32 33 34 35 36 37 |
# File 'lib/trophy_api_client/types/deleted_resource.rb', line 32 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] new(id: id, 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.
52 53 54 |
# File 'lib/trophy_api_client/types/deleted_resource.rb', line 52 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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of DeletedResource to a JSON object
42 43 44 |
# File 'lib/trophy_api_client/types/deleted_resource.rb', line 42 def to_json(*_args) @_field_set&.to_json end |