Class: Vapi::ImportTwilioPhoneNumberDto
- Inherits:
-
Object
- Object
- Vapi::ImportTwilioPhoneNumberDto
- Defined in:
- lib/vapi_server_sdk/types/import_twilio_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.
-
#fallback_destination ⇒ Vapi::ImportTwilioPhoneNumberDtoFallbackDestination
readonly
This is the fallback destination an inbound call will be transferred to if: 1.
-
#hooks ⇒ Array<Vapi::PhoneNumberHookCallRinging>
readonly
This is the hooks that will be used for incoming calls to this phone number.
-
#name ⇒ String
readonly
This is the name of the phone number.
-
#server ⇒ Vapi::Server
readonly
This is where Vapi will send webhooks.
-
#sms_enabled ⇒ Boolean
readonly
Controls whether Vapi sets the messaging webhook URL on the Twilio number during import.
-
#squad_id ⇒ String
readonly
This is the squad that will be used for incoming calls to this phone number.
-
#twilio_account_sid ⇒ String
readonly
This is your Twilio Account SID that will be used to handle this phone number.
-
#twilio_api_key ⇒ String
readonly
This is the Twilio API Key that will be used to handle this phone number.
-
#twilio_api_secret ⇒ String
readonly
This is the Twilio API Secret that will be used to handle this phone number.
-
#twilio_auth_token ⇒ String
readonly
This is the Twilio Auth Token that will be used to handle this phone number.
-
#twilio_phone_number ⇒ String
readonly
These are the digits of the phone number you own on your Twilio.
-
#workflow_id ⇒ String
readonly
This is the workflow that will be used for incoming calls to this phone number.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ImportTwilioPhoneNumberDto
Deserialize a JSON object to an instance of ImportTwilioPhoneNumberDto.
-
.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(twilio_phone_number:, twilio_account_sid:, fallback_destination: OMIT, hooks: OMIT, sms_enabled: OMIT, twilio_auth_token: OMIT, twilio_api_key: OMIT, twilio_api_secret: OMIT, name: OMIT, assistant_id: OMIT, workflow_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) ⇒ Vapi::ImportTwilioPhoneNumberDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ImportTwilioPhoneNumberDto to a JSON object.
Constructor Details
#initialize(twilio_phone_number:, twilio_account_sid:, fallback_destination: OMIT, hooks: OMIT, sms_enabled: OMIT, twilio_auth_token: OMIT, twilio_api_key: OMIT, twilio_api_secret: OMIT, name: OMIT, assistant_id: OMIT, workflow_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) ⇒ Vapi::ImportTwilioPhoneNumberDto
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 145 146 147 148 149 150 151 152 153 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 120 def initialize(twilio_phone_number:, twilio_account_sid:, fallback_destination: OMIT, hooks: OMIT, sms_enabled: OMIT, twilio_auth_token: OMIT, twilio_api_key: OMIT, twilio_api_secret: OMIT, name: OMIT, assistant_id: OMIT, workflow_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @hooks = hooks if hooks != OMIT @sms_enabled = sms_enabled if sms_enabled != OMIT @twilio_phone_number = twilio_phone_number @twilio_account_sid = twilio_account_sid @twilio_auth_token = twilio_auth_token if twilio_auth_token != OMIT @twilio_api_key = twilio_api_key if twilio_api_key != OMIT @twilio_api_secret = twilio_api_secret if twilio_api_secret != OMIT @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @workflow_id = workflow_id if workflow_id != OMIT @squad_id = squad_id if squad_id != OMIT @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, "hooks": hooks, "smsEnabled": sms_enabled, "twilioPhoneNumber": twilio_phone_number, "twilioAccountSid": twilio_account_sid, "twilioAuthToken": twilio_auth_token, "twilioApiKey": twilio_api_key, "twilioApiSecret": twilio_api_secret, "name": name, "assistantId": assistant_id, "workflowId": workflow_id, "squadId": squad_id, "server": server }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
68 69 70 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 68 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`, `squadId` nor `workflowId` 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.
47 48 49 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 47 def assistant_id @assistant_id end |
#fallback_destination ⇒ Vapi::ImportTwilioPhoneNumberDtoFallbackDestination (readonly)
Returns This is the fallback destination an inbound call will be transferred to if:
-
‘assistantId` is not set
-
‘squadId` is not set
-
and, ‘assistant-request` message to the `serverUrl` fails
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/import_twilio_phone_number_dto.rb', line 17 def fallback_destination @fallback_destination end |
#hooks ⇒ Array<Vapi::PhoneNumberHookCallRinging> (readonly)
Returns This is the hooks that will be used for incoming calls to this phone number.
19 20 21 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 19 def hooks @hooks end |
#name ⇒ String (readonly)
Returns This is the name of the phone number. This is just for your own reference.
41 42 43 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 41 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.
66 67 68 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 66 def server @server end |
#sms_enabled ⇒ Boolean (readonly)
Returns Controls whether Vapi sets the messaging webhook URL on the Twilio number during import. If set to ‘false`, Vapi will not update the Twilio messaging URL, leaving it as is. If `true` or omitted (default), Vapi will configure both the voice and messaging URLs. @default true.
27 28 29 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 27 def sms_enabled @sms_enabled end |
#squad_id ⇒ String (readonly)
Returns This is the squad that will be used for incoming calls to this phone number. If neither ‘assistantId`, `squadId`, nor `workflowId` 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.
59 60 61 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 59 def squad_id @squad_id end |
#twilio_account_sid ⇒ String (readonly)
Returns This is your Twilio Account SID that will be used to handle this phone number.
31 32 33 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 31 def twilio_account_sid @twilio_account_sid end |
#twilio_api_key ⇒ String (readonly)
Returns This is the Twilio API Key that will be used to handle this phone number. If AuthToken is provided, this will be ignored.
36 37 38 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 36 def twilio_api_key @twilio_api_key end |
#twilio_api_secret ⇒ String (readonly)
Returns This is the Twilio API Secret that will be used to handle this phone number. If AuthToken is provided, this will be ignored.
39 40 41 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 39 def twilio_api_secret @twilio_api_secret end |
#twilio_auth_token ⇒ String (readonly)
Returns This is the Twilio Auth Token that will be used to handle this phone number.
33 34 35 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 33 def twilio_auth_token @twilio_auth_token end |
#twilio_phone_number ⇒ String (readonly)
Returns These are the digits of the phone number you own on your Twilio.
29 30 31 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 29 def twilio_phone_number @twilio_phone_number end |
#workflow_id ⇒ String (readonly)
Returns This is the workflow that will be used for incoming calls to this phone number. If neither ‘assistantId`, `squadId`, nor `workflowId` 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.
53 54 55 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 53 def workflow_id @workflow_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ImportTwilioPhoneNumberDto
Deserialize a JSON object to an instance of ImportTwilioPhoneNumberDto
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 159 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::ImportTwilioPhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) end hooks = parsed_json["hooks"]&.map do |item| item = item.to_json Vapi::PhoneNumberHookCallRinging.from_json(json_object: item) end sms_enabled = parsed_json["smsEnabled"] twilio_phone_number = parsed_json["twilioPhoneNumber"] twilio_account_sid = parsed_json["twilioAccountSid"] twilio_auth_token = parsed_json["twilioAuthToken"] twilio_api_key = parsed_json["twilioApiKey"] twilio_api_secret = parsed_json["twilioApiSecret"] name = parsed_json["name"] assistant_id = parsed_json["assistantId"] workflow_id = parsed_json["workflowId"] 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 new( fallback_destination: fallback_destination, hooks: hooks, sms_enabled: sms_enabled, twilio_phone_number: twilio_phone_number, twilio_account_sid: twilio_account_sid, twilio_auth_token: twilio_auth_token, twilio_api_key: twilio_api_key, twilio_api_secret: twilio_api_secret, name: name, assistant_id: assistant_id, workflow_id: workflow_id, squad_id: squad_id, server: server, 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.
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 219 def self.validate_raw(obj:) obj.fallback_destination.nil? || Vapi::ImportTwilioPhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) obj.hooks&.is_a?(Array) != false || raise("Passed value for field obj.hooks is not the expected type, validation failed.") obj.sms_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.sms_enabled is not the expected type, validation failed.") obj.twilio_phone_number.is_a?(String) != false || raise("Passed value for field obj.twilio_phone_number is not the expected type, validation failed.") obj.twilio_account_sid.is_a?(String) != false || raise("Passed value for field obj.twilio_account_sid is not the expected type, validation failed.") obj.twilio_auth_token&.is_a?(String) != false || raise("Passed value for field obj.twilio_auth_token is not the expected type, validation failed.") obj.twilio_api_key&.is_a?(String) != false || raise("Passed value for field obj.twilio_api_key is not the expected type, validation failed.") obj.twilio_api_secret&.is_a?(String) != false || raise("Passed value for field obj.twilio_api_secret is not the expected type, validation failed.") 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.workflow_id&.is_a?(String) != false || raise("Passed value for field obj.workflow_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) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ImportTwilioPhoneNumberDto to a JSON object
209 210 211 |
# File 'lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb', line 209 def to_json(*_args) @_field_set&.to_json end |