Class: Vapi::UpdateVapiPhoneNumberDto
- Inherits:
-
Object
- Object
- Vapi::UpdateVapiPhoneNumberDto
- Defined in:
- lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#assistant_id ⇒ String
readonly
This is the assistant that will be used for incoming calls to this phone number.
-
#authentication ⇒ Vapi::SipAuthentication
readonly
This enables authentication for incoming SIP INVITE requests to the
sipUri. -
#fallback_destination ⇒ Vapi::UpdateVapiPhoneNumberDtoFallbackDestination
readonly
This is the fallback destination an inbound call will be transferred to if: 1.
-
#name ⇒ String
readonly
This is the name of the phone number.
-
#server ⇒ Vapi::Server
readonly
This is where Vapi will send webhooks.
-
#sip_uri ⇒ String
readonly
This is the SIP URI of the phone number.
-
#squad_id ⇒ String
readonly
This is the squad that will be used for incoming calls to this phone number.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::UpdateVapiPhoneNumberDto
Deserialize a JSON object to an instance of UpdateVapiPhoneNumberDto.
-
.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(fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, sip_uri: OMIT, authentication: OMIT, additional_properties: nil) ⇒ Vapi::UpdateVapiPhoneNumberDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of UpdateVapiPhoneNumberDto to a JSON object.
Constructor Details
#initialize(fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, sip_uri: OMIT, authentication: OMIT, additional_properties: nil) ⇒ Vapi::UpdateVapiPhoneNumberDto
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 82 def initialize(fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, sip_uri: OMIT, authentication: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT @server = server if server != OMIT @sip_uri = sip_uri if sip_uri != OMIT @authentication = authentication if authentication != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, "name": name, "assistantId": assistant_id, "squadId": squad_id, "server": server, "sipUri": sip_uri, "authentication": authentication }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
46 47 48 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 46 def additional_properties @additional_properties end |
#assistant_id ⇒ String (readonly)
Returns This is the assistant that will be used for incoming calls to this phone number. If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.
24 25 26 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 24 def assistant_id @assistant_id end |
#authentication ⇒ Vapi::SipAuthentication (readonly)
Returns This enables authentication for incoming SIP INVITE requests to the sipUri. If not set, any username/password to the 401 challenge of the SIP INVITE will be accepted.
44 45 46 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 44 def authentication @authentication end |
#fallback_destination ⇒ Vapi::UpdateVapiPhoneNumberDtoFallbackDestination (readonly)
Returns This is the fallback destination an inbound call will be transferred to if:
-
assistantIdis not set -
squadIdis not set -
and,
assistant-requestmessage to theserverUrlfails
If this is not set and above conditions are met, the inbound call is hung up with an error message.
17 18 19 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 17 def fallback_destination @fallback_destination end |
#name ⇒ String (readonly)
Returns This is the name of the phone number. This is just for your own reference.
19 20 21 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 19 def name @name end |
#server ⇒ Vapi::Server (readonly)
Returns This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. The order of precedence is:
-
assistant.server
-
phoneNumber.server
-
org.server.
36 37 38 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 36 def server @server end |
#sip_uri ⇒ String (readonly)
Returns This is the SIP URI of the phone number. You can SIP INVITE this. The assistant attached to this number will answer. This is case-insensitive.
40 41 42 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 40 def sip_uri @sip_uri end |
#squad_id ⇒ String (readonly)
Returns This is the squad that will be used for incoming calls to this phone number. If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.
29 30 31 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 29 def squad_id @squad_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::UpdateVapiPhoneNumberDto
Deserialize a JSON object to an instance of UpdateVapiPhoneNumberDto
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 109 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["fallbackDestination"].nil? fallback_destination = nil else fallback_destination = parsed_json["fallbackDestination"].to_json fallback_destination = Vapi::UpdateVapiPhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) end name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] if parsed_json["server"].nil? server = nil else server = parsed_json["server"].to_json server = Vapi::Server.from_json(json_object: server) end sip_uri = parsed_json["sipUri"] if parsed_json["authentication"].nil? authentication = nil else authentication = parsed_json["authentication"].to_json authentication = Vapi::SipAuthentication.from_json(json_object: authentication) end new( fallback_destination: fallback_destination, name: name, assistant_id: assistant_id, squad_id: squad_id, server: server, sip_uri: sip_uri, authentication: authentication, 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.
159 160 161 162 163 164 165 166 167 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 159 def self.validate_raw(obj:) obj.fallback_destination.nil? || Vapi::UpdateVapiPhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.sip_uri&.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.") obj.authentication.nil? || Vapi::SipAuthentication.validate_raw(obj: obj.authentication) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of UpdateVapiPhoneNumberDto to a JSON object
149 150 151 |
# File 'lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb', line 149 def to_json(*_args) @_field_set&.to_json end |