Class: Vapi::CreateVapiPhoneNumberDto
- Inherits:
-
Object
- Object
- Vapi::CreateVapiPhoneNumberDto
- Defined in:
- lib/vapi_server_sdk/types/create_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::CreateVapiPhoneNumberDtoFallbackDestination
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.
-
#number_desired_area_code ⇒ String
readonly
This is the area code of the phone number to purchase.
-
#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.
-
#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::CreateVapiPhoneNumberDto
Deserialize a JSON object to an instance of CreateVapiPhoneNumberDto.
-
.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, hooks: OMIT, number_desired_area_code: OMIT, sip_uri: OMIT, authentication: OMIT, name: OMIT, assistant_id: OMIT, workflow_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) ⇒ Vapi::CreateVapiPhoneNumberDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreateVapiPhoneNumberDto to a JSON object.
Constructor Details
#initialize(fallback_destination: OMIT, hooks: OMIT, number_desired_area_code: OMIT, sip_uri: OMIT, authentication: OMIT, name: OMIT, assistant_id: OMIT, workflow_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) ⇒ Vapi::CreateVapiPhoneNumberDto
104 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 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 104 def initialize(fallback_destination: OMIT, hooks: OMIT, number_desired_area_code: OMIT, sip_uri: OMIT, authentication: 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 @number_desired_area_code = number_desired_area_code if number_desired_area_code != OMIT @sip_uri = sip_uri if sip_uri != OMIT @authentication = authentication if authentication != 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, "numberDesiredAreaCode": number_desired_area_code, "sipUri": sip_uri, "authentication": authentication, "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.
59 60 61 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 59 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.
38 39 40 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 38 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.
30 31 32 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 30 def authentication @authentication end |
#fallback_destination ⇒ Vapi::CreateVapiPhoneNumberDtoFallbackDestination (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.
18 19 20 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 18 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.
20 21 22 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 20 def hooks @hooks end |
#name ⇒ String (readonly)
Returns This is the name of the phone number. This is just for your own reference.
32 33 34 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 32 def name @name end |
#number_desired_area_code ⇒ String (readonly)
Returns This is the area code of the phone number to purchase.
22 23 24 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 22 def number_desired_area_code @number_desired_area_code 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.
57 58 59 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 57 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.
26 27 28 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 26 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`, `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.
50 51 52 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 50 def squad_id @squad_id 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.
44 45 46 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 44 def workflow_id @workflow_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CreateVapiPhoneNumberDto
Deserialize a JSON object to an instance of CreateVapiPhoneNumberDto
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 137 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::CreateVapiPhoneNumberDtoFallbackDestination.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 number_desired_area_code = parsed_json["numberDesiredAreaCode"] 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 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, number_desired_area_code: number_desired_area_code, sip_uri: sip_uri, authentication: authentication, 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.
196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 196 def self.validate_raw(obj:) obj.fallback_destination.nil? || Vapi::CreateVapiPhoneNumberDtoFallbackDestination.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.number_desired_area_code&.is_a?(String) != false || raise("Passed value for field obj.number_desired_area_code is not the expected type, validation failed.") 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) 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 CreateVapiPhoneNumberDto to a JSON object
186 187 188 |
# File 'lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb', line 186 def to_json(*_args) @_field_set&.to_json end |