Class: Vapi::Squad

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(members:, id:, org_id:, created_at:, updated_at:, name: OMIT, members_overrides: OMIT, additional_properties: nil) ⇒ Vapi::Squad

Parameters:

  • name (String) (defaults to: OMIT)

    This is the name of the squad.

  • members (Array<Vapi::SquadMemberDto>)

    This is the list of assistants that make up the squad. The call will start with the first assistant in the list.

  • members_overrides (Vapi::AssistantOverrides) (defaults to: OMIT)

    This can be used to override all the assistants’ settings and provide values for their template variables. Both ‘membersOverrides` and `members.assistantOverrides` can be used together. First, `members.assistantOverrides` is applied. Then, `membersOverrides` is applied as a global override.

  • id (String)

    This is the unique identifier for the squad.

  • org_id (String)

    This is the unique identifier for the org that this squad belongs to.

  • created_at (DateTime)

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

  • updated_at (DateTime)

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

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(members:, id:, org_id:, created_at:, updated_at:, name: OMIT, members_overrides: OMIT,
               additional_properties: nil)
  @name = name if name != OMIT
  @members = members
  @members_overrides = members_overrides if members_overrides != OMIT
  @id = id
  @org_id = org_id
  @created_at = created_at
  @updated_at = updated_at
  @additional_properties = additional_properties
  @_field_set = {
    "name": name,
    "members": members,
    "membersOverrides": members_overrides,
    "id": id,
    "orgId": org_id,
    "createdAt": created_at,
    "updatedAt": updated_at
  }.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



31
32
33
# File 'lib/vapi_server_sdk/types/squad.rb', line 31

def additional_properties
  @additional_properties
end

#created_atDateTime (readonly)

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

Returns:

  • (DateTime)

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



27
28
29
# File 'lib/vapi_server_sdk/types/squad.rb', line 27

def created_at
  @created_at
end

#idString (readonly)

Returns This is the unique identifier for the squad.

Returns:

  • (String)

    This is the unique identifier for the squad.



23
24
25
# File 'lib/vapi_server_sdk/types/squad.rb', line 23

def id
  @id
end

#membersArray<Vapi::SquadMemberDto> (readonly)

Returns This is the list of assistants that make up the squad. The call will start with the first assistant in the list.

Returns:

  • (Array<Vapi::SquadMemberDto>)

    This is the list of assistants that make up the squad. The call will start with the first assistant in the list.



15
16
17
# File 'lib/vapi_server_sdk/types/squad.rb', line 15

def members
  @members
end

#members_overridesVapi::AssistantOverrides (readonly)

Returns This can be used to override all the assistants’ settings and provide values for their template variables. Both ‘membersOverrides` and `members.assistantOverrides` can be used together. First, `members.assistantOverrides` is applied. Then, `membersOverrides` is applied as a global override.

Returns:

  • (Vapi::AssistantOverrides)

    This can be used to override all the assistants’ settings and provide values for their template variables. Both ‘membersOverrides` and `members.assistantOverrides` can be used together. First, `members.assistantOverrides` is applied. Then, `membersOverrides` is applied as a global override.



21
22
23
# File 'lib/vapi_server_sdk/types/squad.rb', line 21

def members_overrides
  @members_overrides
end

#nameString (readonly)

Returns This is the name of the squad.

Returns:

  • (String)

    This is the name of the squad.



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

def name
  @name
end

#org_idString (readonly)

Returns This is the unique identifier for the org that this squad belongs to.

Returns:

  • (String)

    This is the unique identifier for the org that this squad belongs to.



25
26
27
# File 'lib/vapi_server_sdk/types/squad.rb', line 25

def org_id
  @org_id
end

#updated_atDateTime (readonly)

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

Returns:

  • (DateTime)

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



29
30
31
# File 'lib/vapi_server_sdk/types/squad.rb', line 29

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::Squad

Deserialize a JSON object to an instance of Squad

Parameters:

  • json_object (String)

Returns:



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/vapi_server_sdk/types/squad.rb', line 79

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  members = parsed_json["members"]&.map do |item|
    item = item.to_json
    Vapi::SquadMemberDto.from_json(json_object: item)
  end
  if parsed_json["membersOverrides"].nil?
    members_overrides = nil
  else
    members_overrides = parsed_json["membersOverrides"].to_json
    members_overrides = Vapi::AssistantOverrides.from_json(json_object: members_overrides)
  end
  id = parsed_json["id"]
  org_id = parsed_json["orgId"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  new(
    name: name,
    members: members,
    members_overrides: members_overrides,
    id: id,
    org_id: org_id,
    created_at: created_at,
    updated_at: updated_at,
    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)


122
123
124
125
126
127
128
129
130
# File 'lib/vapi_server_sdk/types/squad.rb', line 122

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.members.is_a?(Array) != false || raise("Passed value for field obj.members is not the expected type, validation failed.")
  obj.members_overrides.nil? || Vapi::AssistantOverrides.validate_raw(obj: obj.members_overrides)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_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.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Squad to a JSON object

Returns:

  • (String)


112
113
114
# File 'lib/vapi_server_sdk/types/squad.rb', line 112

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