Class: NewDemoApiClient::UserWithPermissionsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/user_with_permissions_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, email:, id:, thumbnail: OMIT, created_at: OMIT, updated_at: OMIT, is_archived: OMIT, super_user: OMIT, api_key_final_characters: OMIT, groups: OMIT, permissions_by_group: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::UserWithPermissionsResponse

Parameters:

  • name (String)
  • email (String)

    The email address of the user

  • thumbnail (String) (defaults to: OMIT)

    The thumbnail URL of the user

  • id (Integer)
  • created_at (DateTime) (defaults to: OMIT)
  • updated_at (DateTime) (defaults to: OMIT)
  • is_archived (Boolean) (defaults to: OMIT)
  • super_user (Boolean) (defaults to: OMIT)
  • api_key_final_characters (String) (defaults to: OMIT)
  • groups (Array<NewDemoApiClient::GroupResponse>) (defaults to: OMIT)
  • permissions_by_group (Hash{String => Array}) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 53

def initialize(name:, email:, id:, thumbnail: OMIT, created_at: OMIT, updated_at: OMIT, is_archived: OMIT,
               super_user: OMIT, api_key_final_characters: OMIT, groups: OMIT, permissions_by_group: OMIT, additional_properties: nil)
  @name = name
  @email = email
  @thumbnail = thumbnail if thumbnail != OMIT
  @id = id
  @created_at = created_at if created_at != OMIT
  @updated_at = updated_at if updated_at != OMIT
  @is_archived = is_archived if is_archived != OMIT
  @super_user = super_user if super_user != OMIT
  @api_key_final_characters = api_key_final_characters if api_key_final_characters != OMIT
  @groups = groups if groups != OMIT
  @permissions_by_group = permissions_by_group if permissions_by_group != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "name": name,
    "email": email,
    "thumbnail": thumbnail,
    "id": id,
    "created_at": created_at,
    "updated_at": updated_at,
    "is_archived": is_archived,
    "super_user": super_user,
    "api_key_final_characters": api_key_final_characters,
    "groups": groups,
    "permissions_by_group": permissions_by_group
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



33
34
35
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 33

def additional_properties
  @additional_properties
end

#api_key_final_charactersString (readonly)

Returns:

  • (String)


27
28
29
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 27

def api_key_final_characters
  @api_key_final_characters
end

#created_atDateTime (readonly)

Returns:

  • (DateTime)


19
20
21
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 19

def created_at
  @created_at
end

#emailString (readonly)

Returns The email address of the user.

Returns:

  • (String)

    The email address of the user



13
14
15
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 13

def email
  @email
end

#groupsArray<NewDemoApiClient::GroupResponse> (readonly)



29
30
31
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 29

def groups
  @groups
end

#idInteger (readonly)

Returns:

  • (Integer)


17
18
19
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 17

def id
  @id
end

#is_archivedBoolean (readonly)

Returns:

  • (Boolean)


23
24
25
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 23

def is_archived
  @is_archived
end

#nameString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 11

def name
  @name
end

#permissions_by_groupHash{String => Array} (readonly)

Returns:

  • (Hash{String => Array})


31
32
33
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 31

def permissions_by_group
  @permissions_by_group
end

#super_userBoolean (readonly)

Returns:

  • (Boolean)


25
26
27
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 25

def super_user
  @super_user
end

#thumbnailString (readonly)

Returns The thumbnail URL of the user.

Returns:

  • (String)

    The thumbnail URL of the user



15
16
17
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 15

def thumbnail
  @thumbnail
end

#updated_atDateTime (readonly)

Returns:

  • (DateTime)


21
22
23
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 21

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::UserWithPermissionsResponse

Deserialize a JSON object to an instance of UserWithPermissionsResponse

Parameters:

  • json_object (String)

Returns:



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 88

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"]
  id = parsed_json["id"]
  created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?)
  updated_at = (DateTime.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?)
  is_archived = parsed_json["is_archived"]
  super_user = parsed_json["super_user"]
  api_key_final_characters = parsed_json["api_key_final_characters"]
  groups = parsed_json["groups"]&.map do |item|
    item = item.to_json
    NewDemoApiClient::GroupResponse.from_json(json_object: item)
  end
  permissions_by_group = parsed_json["permissions_by_group"]&.transform_values do |value|
    value&.map do |item|
      item = item.to_json
      NewDemoApiClient::PermissionModel.from_json(json_object: item)
    end
  end
  new(
    name: name,
    email: email,
    thumbnail: thumbnail,
    id: id,
    created_at: created_at,
    updated_at: updated_at,
    is_archived: is_archived,
    super_user: super_user,
    api_key_final_characters: api_key_final_characters,
    groups: groups,
    permissions_by_group: permissions_by_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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 139

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.")
  obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at&.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.is_archived&.is_a?(Boolean) != false || raise("Passed value for field obj.is_archived is not the expected type, validation failed.")
  obj.super_user&.is_a?(Boolean) != false || raise("Passed value for field obj.super_user is not the expected type, validation failed.")
  obj.api_key_final_characters&.is_a?(String) != false || raise("Passed value for field obj.api_key_final_characters is not the expected type, validation failed.")
  obj.groups&.is_a?(Array) != false || raise("Passed value for field obj.groups is not the expected type, validation failed.")
  obj.permissions_by_group&.is_a?(Hash) != false || raise("Passed value for field obj.permissions_by_group is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of UserWithPermissionsResponse to a JSON object

Returns:

  • (String)


129
130
131
# File 'lib/test_sdk/types/user_with_permissions_response.rb', line 129

def to_json(*_args)
  @_field_set&.to_json
end