Class: NewDemoApiClient::AccountManagerResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/account_manager_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:, thumbnail: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::AccountManagerResponse

Parameters:

  • name (String)

    The name of the user

  • email (String)

    The email address of the user

  • thumbnail (String) (defaults to: OMIT)

    The thumbnail URL of the user

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#emailString (readonly)

Returns The email address of the user.

Returns:

  • (String)

    The email address of the user



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

def email
  @email
end

#nameString (readonly)

Returns The name of the user.

Returns:

  • (String)

    The name of the user



9
10
11
# File 'lib/test_sdk/types/account_manager_response.rb', line 9

def name
  @name
end

#thumbnailString (readonly)

Returns The thumbnail URL of the user.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


58
59
60
# File 'lib/test_sdk/types/account_manager_response.rb', line 58

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