Class: Vapi::Squad
- Inherits:
-
Object
- Object
- Vapi::Squad
- Defined in:
- lib/vapi_server_sdk/types/squad.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#created_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the squad was created.
-
#id ⇒ String
readonly
This is the unique identifier for the squad.
-
#members ⇒ Array<Vapi::SquadMemberDto>
readonly
This is the list of assistants that make up the squad.
-
#members_overrides ⇒ Vapi::AssistantOverrides
readonly
This can be used to override all the assistants’ settings and provide values for their template variables.
-
#name ⇒ String
readonly
This is the name of the squad.
-
#org_id ⇒ String
readonly
This is the unique identifier for the org that this squad belongs to.
-
#updated_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the squad was last updated.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Squad
Deserialize a JSON object to an instance of Squad.
-
.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(members:, id:, org_id:, created_at:, updated_at:, name: OMIT, members_overrides: OMIT, additional_properties: nil) ⇒ Vapi::Squad constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Squad to a JSON object.
Constructor Details
#initialize(members:, id:, org_id:, created_at:, updated_at:, name: OMIT, members_overrides: OMIT, additional_properties: nil) ⇒ Vapi::Squad
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_properties ⇒ OpenStruct (readonly)
Returns 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_at ⇒ DateTime (readonly)
Returns 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 |
#id ⇒ String (readonly)
Returns 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 |
#members ⇒ Array<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.
15 16 17 |
# File 'lib/vapi_server_sdk/types/squad.rb', line 15 def members @members end |
#members_overrides ⇒ Vapi::AssistantOverrides (readonly)
21 22 23 |
# File 'lib/vapi_server_sdk/types/squad.rb', line 21 def members_overrides @members_overrides end |
#name ⇒ String (readonly)
Returns 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_id ⇒ String (readonly)
Returns 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_at ⇒ DateTime (readonly)
Returns 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
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.
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
112 113 114 |
# File 'lib/vapi_server_sdk/types/squad.rb', line 112 def to_json(*_args) @_field_set&.to_json end |