Class: NewDemoApiClient::CategoriesMetadataResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::CategoriesMetadataResponse
- Defined in:
- lib/test_sdk/types/categories_metadata_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#major ⇒ Array<NewDemoApiClient::CategoryMetadata>
readonly
A list of major benchmark categories.
-
#minor ⇒ Array<NewDemoApiClient::CategoryMetadata>
readonly
A list of minor benchmark categories.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::CategoriesMetadataResponse
Deserialize a JSON object to an instance of CategoriesMetadataResponse.
-
.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(major:, minor:, additional_properties: nil) ⇒ NewDemoApiClient::CategoriesMetadataResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CategoriesMetadataResponse to a JSON object.
Constructor Details
#initialize(major:, minor:, additional_properties: nil) ⇒ NewDemoApiClient::CategoriesMetadataResponse
25 26 27 28 29 30 |
# File 'lib/test_sdk/types/categories_metadata_response.rb', line 25 def initialize(major:, minor:, additional_properties: nil) @major = major @minor = minor @additional_properties = additional_properties @_field_set = { "major": major, "minor": minor } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
14 15 16 |
# File 'lib/test_sdk/types/categories_metadata_response.rb', line 14 def additional_properties @additional_properties end |
#major ⇒ Array<NewDemoApiClient::CategoryMetadata> (readonly)
Returns A list of major benchmark categories.
10 11 12 |
# File 'lib/test_sdk/types/categories_metadata_response.rb', line 10 def major @major end |
#minor ⇒ Array<NewDemoApiClient::CategoryMetadata> (readonly)
Returns A list of minor benchmark categories.
12 13 14 |
# File 'lib/test_sdk/types/categories_metadata_response.rb', line 12 def minor @minor end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::CategoriesMetadataResponse
Deserialize a JSON object to an instance of CategoriesMetadataResponse
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/test_sdk/types/categories_metadata_response.rb', line 36 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) major = parsed_json["major"]&.map do |item| item = item.to_json NewDemoApiClient::CategoryMetadata.from_json(json_object: item) end minor = parsed_json["minor"]&.map do |item| item = item.to_json NewDemoApiClient::CategoryMetadata.from_json(json_object: item) end new( major: major, minor: minor, 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.
67 68 69 70 |
# File 'lib/test_sdk/types/categories_metadata_response.rb', line 67 def self.validate_raw(obj:) obj.major.is_a?(Array) != false || raise("Passed value for field obj.major is not the expected type, validation failed.") obj.minor.is_a?(Array) != false || raise("Passed value for field obj.minor is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CategoriesMetadataResponse to a JSON object
57 58 59 |
# File 'lib/test_sdk/types/categories_metadata_response.rb', line 57 def to_json(*_args) @_field_set&.to_json end |