Class: Vapi::ImportVonagePhoneNumberDto
- Inherits:
-
Object
- Object
- Vapi::ImportVonagePhoneNumberDto
- Defined in:
- lib/vapi_server_sdk/types/import_vonage_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.
-
#credential_id ⇒ String
readonly
This is the credential that is used to make outgoing calls, and do operations like call transfer and hang up.
-
#fallback_destination ⇒ Vapi::ImportVonagePhoneNumberDtoFallbackDestination
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_url ⇒ String
readonly
This is the server URL where messages will be sent for calls on this number.
-
#server_url_secret ⇒ String
readonly
This is the secret Vapi will send with every message to your server.
-
#squad_id ⇒ String
readonly
This is the squad that will be used for incoming calls to this phone number.
-
#vonage_phone_number ⇒ String
readonly
These are the digits of the phone number you own on your Vonage.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ImportVonagePhoneNumberDto
Deserialize a JSON object to an instance of ImportVonagePhoneNumberDto.
-
.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(vonage_phone_number:, credential_id:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) ⇒ Vapi::ImportVonagePhoneNumberDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ImportVonagePhoneNumberDto to a JSON object.
Constructor Details
#initialize(vonage_phone_number:, credential_id:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) ⇒ Vapi::ImportVonagePhoneNumberDto
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 83 def initialize(vonage_phone_number:, credential_id:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @vonage_phone_number = vonage_phone_number @credential_id = credential_id @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT @server_url = server_url if server_url != OMIT @server_url_secret = server_url_secret if server_url_secret != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, "vonagePhoneNumber": vonage_phone_number, "credentialId": credential_id, "name": name, "assistantId": assistant_id, "squadId": squad_id, "serverUrl": server_url, "serverUrlSecret": server_url_secret }.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/import_vonage_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.
29 30 31 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 29 def assistant_id @assistant_id end |
#credential_id ⇒ String (readonly)
Returns This is the credential that is used to make outgoing calls, and do operations like call transfer and hang up. You can add the Vonage Credential in the Provider Credentials page on the dashboard to get the credentialId.
22 23 24 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 22 def credential_id @credential_id end |
#fallback_destination ⇒ Vapi::ImportVonagePhoneNumberDtoFallbackDestination (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.
15 16 17 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 15 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/import_vonage_phone_number_dto.rb', line 24 def name @name end |
#server_url ⇒ String (readonly)
Returns This is the server URL where messages will be sent for calls on this number. This includes the ‘assistant-request` message. You can see the shape of the messages sent in `ServerMessage`. This overrides the `org.serverUrl`. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.
40 41 42 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 40 def server_url @server_url end |
#server_url_secret ⇒ String (readonly)
Returns This is the secret Vapi will send with every message to your server. It’s sent as a header called x-vapi-secret. Same precedence logic as serverUrl.
44 45 46 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 44 def server_url_secret @server_url_secret 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/import_vonage_phone_number_dto.rb', line 34 def squad_id @squad_id end |
#vonage_phone_number ⇒ String (readonly)
Returns These are the digits of the phone number you own on your Vonage.
17 18 19 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 17 def vonage_phone_number @vonage_phone_number end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ImportVonagePhoneNumberDto
Deserialize a JSON object to an instance of ImportVonagePhoneNumberDto
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 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 112 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::ImportVonagePhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) end vonage_phone_number = parsed_json["vonagePhoneNumber"] credential_id = parsed_json["credentialId"] name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] server_url = parsed_json["serverUrl"] server_url_secret = parsed_json["serverUrlSecret"] new( fallback_destination: fallback_destination, vonage_phone_number: vonage_phone_number, credential_id: credential_id, name: name, assistant_id: assistant_id, squad_id: squad_id, server_url: server_url, server_url_secret: server_url_secret, 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.
154 155 156 157 158 159 160 161 162 163 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 154 def self.validate_raw(obj:) obj.fallback_destination.nil? || Vapi::ImportVonagePhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) obj.vonage_phone_number.is_a?(String) != false || raise("Passed value for field obj.vonage_phone_number is not the expected type, validation failed.") obj.credential_id.is_a?(String) != false || raise("Passed value for field obj.credential_id 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_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ImportVonagePhoneNumberDto to a JSON object
144 145 146 |
# File 'lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb', line 144 def to_json(*_args) @_field_set&.to_json end |