Class: Vapi::User

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/user.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created_at:, updated_at:, email:, full_name: OMIT, additional_properties: nil) ⇒ Vapi::User

Parameters:

  • id (String)

    This is the unique identifier for the profile or user.

  • created_at (DateTime)

    This is the ISO 8601 date-time string of when the profile was created.

  • updated_at (DateTime)

    This is the ISO 8601 date-time string of when the profile was last updated.

  • email (String)

    This is the email of the user that is associated with the profile.

  • full_name (String) (defaults to: OMIT)

    This is the full name of the user that is associated with the profile.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/vapi_server_sdk/types/user.rb', line 34

def initialize(id:, created_at:, updated_at:, email:, full_name: OMIT, additional_properties: nil)
  @id = id
  @created_at = created_at
  @updated_at = updated_at
  @email = email
  @full_name = full_name if full_name != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "email": email,
    "fullName": full_name
  }.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



20
21
22
# File 'lib/vapi_server_sdk/types/user.rb', line 20

def additional_properties
  @additional_properties
end

#created_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the profile was created.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the profile was created.



12
13
14
# File 'lib/vapi_server_sdk/types/user.rb', line 12

def created_at
  @created_at
end

#emailString (readonly)

Returns This is the email of the user that is associated with the profile.

Returns:

  • (String)

    This is the email of the user that is associated with the profile.



16
17
18
# File 'lib/vapi_server_sdk/types/user.rb', line 16

def email
  @email
end

#full_nameString (readonly)

Returns This is the full name of the user that is associated with the profile.

Returns:

  • (String)

    This is the full name of the user that is associated with the profile.



18
19
20
# File 'lib/vapi_server_sdk/types/user.rb', line 18

def full_name
  @full_name
end

#idString (readonly)

Returns This is the unique identifier for the profile or user.

Returns:

  • (String)

    This is the unique identifier for the profile or user.



10
11
12
# File 'lib/vapi_server_sdk/types/user.rb', line 10

def id
  @id
end

#updated_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the profile was last updated.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the profile was last updated.



14
15
16
# File 'lib/vapi_server_sdk/types/user.rb', line 14

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::User

Deserialize a JSON object to an instance of User

Parameters:

  • json_object (String)

Returns:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/vapi_server_sdk/types/user.rb', line 56

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  email = parsed_json["email"]
  full_name = parsed_json["fullName"]
  new(
    id: id,
    created_at: created_at,
    updated_at: updated_at,
    email: email,
    full_name: full_name,
    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)


87
88
89
90
91
92
93
# File 'lib/vapi_server_sdk/types/user.rb', line 87

def self.validate_raw(obj:)
  obj.id.is_a?(String) != 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.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
  obj.full_name&.is_a?(String) != false || raise("Passed value for field obj.full_name is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of User to a JSON object

Returns:

  • (String)


77
78
79
# File 'lib/vapi_server_sdk/types/user.rb', line 77

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