Class: NewDemoApiClient::UserRoleResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::UserRoleResponse
- Defined in:
- lib/test_sdk/types/user_role_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #group ⇒ NewDemoApiClient::GroupResponse readonly
- #user ⇒ NewDemoApiClient::UserWithPermissionsResponse readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::UserRoleResponse
Deserialize a JSON object to an instance of UserRoleResponse.
-
.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(user:, group:, additional_properties: nil) ⇒ NewDemoApiClient::UserRoleResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of UserRoleResponse to a JSON object.
Constructor Details
#initialize(user:, group:, additional_properties: nil) ⇒ NewDemoApiClient::UserRoleResponse
26 27 28 29 30 31 |
# File 'lib/test_sdk/types/user_role_response.rb', line 26 def initialize(user:, group:, additional_properties: nil) @user = user @group = group @additional_properties = additional_properties @_field_set = { "user": user, "group": group } 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/user_role_response.rb', line 15 def additional_properties @additional_properties end |
#group ⇒ NewDemoApiClient::GroupResponse (readonly)
13 14 15 |
# File 'lib/test_sdk/types/user_role_response.rb', line 13 def group @group end |
#user ⇒ NewDemoApiClient::UserWithPermissionsResponse (readonly)
11 12 13 |
# File 'lib/test_sdk/types/user_role_response.rb', line 11 def user @user end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::UserRoleResponse
Deserialize a JSON object to an instance of UserRoleResponse
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/test_sdk/types/user_role_response.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["user"].nil? user = nil else user = parsed_json["user"].to_json user = NewDemoApiClient::UserWithPermissionsResponse.from_json(json_object: user) end if parsed_json["group"].nil? group = nil else group = parsed_json["group"].to_json group = NewDemoApiClient::GroupResponse.from_json(json_object: group) end new( user: user, group: group, 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.
72 73 74 75 |
# File 'lib/test_sdk/types/user_role_response.rb', line 72 def self.validate_raw(obj:) NewDemoApiClient::UserWithPermissionsResponse.validate_raw(obj: obj.user) NewDemoApiClient::GroupResponse.validate_raw(obj: obj.group) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of UserRoleResponse to a JSON object
62 63 64 |
# File 'lib/test_sdk/types/user_role_response.rb', line 62 def to_json(*_args) @_field_set&.to_json end |