Class: Vapi::CreateTwilioPhoneNumberDto
- Inherits:
-
Object
- Object
- Vapi::CreateTwilioPhoneNumberDto
- Defined in:
- lib/vapi_server_sdk/types/create_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::CreateTwilioPhoneNumberDtoFallbackDestination
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.
-
#number ⇒ String
readonly
These are the digits of the phone number you own on your Twilio.
-
#server ⇒ Vapi::Server
readonly
This is where Vapi will send webhooks.
-
#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 the Twilio Account SID for the phone number.
-
#twilio_auth_token ⇒ String
readonly
This is the Twilio Auth Token for the phone number.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::CreateTwilioPhoneNumberDto
Deserialize a JSON object to an instance of CreateTwilioPhoneNumberDto.
-
.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(number:, twilio_account_sid:, twilio_auth_token:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) ⇒ Vapi::CreateTwilioPhoneNumberDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreateTwilioPhoneNumberDto to a JSON object.
Constructor Details
#initialize(number:, twilio_account_sid:, twilio_auth_token:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) ⇒ Vapi::CreateTwilioPhoneNumberDto
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 76 def initialize(number:, twilio_account_sid:, twilio_auth_token:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @number = number @twilio_account_sid = twilio_account_sid @twilio_auth_token = twilio_auth_token @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 @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, "number": number, "twilioAccountSid": twilio_account_sid, "twilioAuthToken": twilio_auth_token, "name": name, "assistantId": assistant_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.
43 44 45 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 43 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.
29 30 31 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 29 def assistant_id @assistant_id end |
#fallback_destination ⇒ Vapi::CreateTwilioPhoneNumberDtoFallbackDestination (readonly)
Returns This is the fallback destination an inbound call will be transferred to if:
assistantIdis not setsquadIdis 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.
16 17 18 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 16 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.
24 25 26 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 24 def name @name end |
#number ⇒ String (readonly)
Returns These are the digits of the phone number you own on your Twilio.
18 19 20 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 18 def number @number 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.
41 42 43 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 41 def server @server 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.
34 35 36 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 34 def squad_id @squad_id end |
#twilio_account_sid ⇒ String (readonly)
Returns This is the Twilio Account SID for the phone number.
20 21 22 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 20 def twilio_account_sid @twilio_account_sid end |
#twilio_auth_token ⇒ String (readonly)
Returns This is the Twilio Auth Token for the phone number.
22 23 24 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 22 def twilio_auth_token @twilio_auth_token end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CreateTwilioPhoneNumberDto
Deserialize a JSON object to an instance of CreateTwilioPhoneNumberDto
105 106 107 108 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 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 105 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::CreateTwilioPhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) end number = parsed_json["number"] twilio_account_sid = parsed_json["twilioAccountSid"] twilio_auth_token = parsed_json["twilioAuthToken"] 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 new( fallback_destination: fallback_destination, number: number, twilio_account_sid: twilio_account_sid, twilio_auth_token: twilio_auth_token, name: name, assistant_id: assistant_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.
152 153 154 155 156 157 158 159 160 161 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 152 def self.validate_raw(obj:) obj.fallback_destination.nil? || Vapi::CreateTwilioPhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) obj.number.is_a?(String) != false || raise("Passed value for field obj.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.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) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CreateTwilioPhoneNumberDto to a JSON object
142 143 144 |
# File 'lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb', line 142 def to_json(*_args) @_field_set&.to_json end |