Class: NewDemoApiClient::AccountManagerResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::AccountManagerResponse
- Defined in:
- lib/test_sdk/types/account_manager_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#email ⇒ String
readonly
The email address of the user.
-
#name ⇒ String
readonly
The name of the user.
-
#thumbnail ⇒ String
readonly
The thumbnail URL of the user.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::AccountManagerResponse
Deserialize a JSON object to an instance of AccountManagerResponse.
-
.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(name:, email:, thumbnail: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::AccountManagerResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AccountManagerResponse to a JSON object.
Constructor Details
#initialize(name:, email:, thumbnail: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::AccountManagerResponse
27 28 29 30 31 32 33 34 35 |
# File 'lib/test_sdk/types/account_manager_response.rb', line 27 def initialize(name:, email:, thumbnail: OMIT, additional_properties: nil) @name = name @email = email @thumbnail = thumbnail if thumbnail != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "email": email, "thumbnail": thumbnail }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/test_sdk/types/account_manager_response.rb', line 15 def additional_properties @additional_properties end |
#email ⇒ String (readonly)
Returns The email address of the user.
11 12 13 |
# File 'lib/test_sdk/types/account_manager_response.rb', line 11 def email @email end |
#name ⇒ String (readonly)
Returns The name of the user.
9 10 11 |
# File 'lib/test_sdk/types/account_manager_response.rb', line 9 def name @name end |
#thumbnail ⇒ String (readonly)
Returns The thumbnail URL of the user.
13 14 15 |
# File 'lib/test_sdk/types/account_manager_response.rb', line 13 def thumbnail @thumbnail end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::AccountManagerResponse
Deserialize a JSON object to an instance of AccountManagerResponse
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/test_sdk/types/account_manager_response.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] email = parsed_json["email"] thumbnail = parsed_json["thumbnail"] new( name: name, email: email, thumbnail: thumbnail, 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.
68 69 70 71 72 |
# File 'lib/test_sdk/types/account_manager_response.rb', line 68 def self.validate_raw(obj:) obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.") obj.thumbnail&.is_a?(String) != false || raise("Passed value for field obj.thumbnail is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AccountManagerResponse to a JSON object
58 59 60 |
# File 'lib/test_sdk/types/account_manager_response.rb', line 58 def to_json(*_args) @_field_set&.to_json end |