Class: Vapi::TelnyxPhoneNumber
- Inherits:
-
Object
- Object
- Vapi::TelnyxPhoneNumber
- Defined in:
- lib/vapi_server_sdk/types/telnyx_phone_number.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.
-
#created_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the phone number was created.
-
#credential_id ⇒ String
readonly
This is the credential you added in dashboard.vapi.ai/keys.
-
#fallback_destination ⇒ Vapi::TelnyxPhoneNumberFallbackDestination
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.
-
#id ⇒ String
readonly
This is the unique identifier for the phone number.
-
#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 Telnyx.
-
#org_id ⇒ String
readonly
This is the unique identifier for the org that this phone number belongs to.
-
#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.
-
#status ⇒ Vapi::TelnyxPhoneNumberStatus
readonly
This is the status of the phone number.
-
#updated_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the phone number was last updated.
-
#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::TelnyxPhoneNumber
Deserialize a JSON object to an instance of TelnyxPhoneNumber.
-
.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(id:, org_id:, created_at:, updated_at:, number:, credential_id:, fallback_destination: OMIT, hooks: OMIT, status: OMIT, name: OMIT, assistant_id: OMIT, workflow_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) ⇒ Vapi::TelnyxPhoneNumber constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TelnyxPhoneNumber to a JSON object.
Constructor Details
#initialize(id:, org_id:, created_at:, updated_at:, number:, credential_id:, fallback_destination: OMIT, hooks: OMIT, status: OMIT, name: OMIT, assistant_id: OMIT, workflow_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) ⇒ Vapi::TelnyxPhoneNumber
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 145 146 147 148 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 113 def initialize(id:, org_id:, created_at:, updated_at:, number:, credential_id:, fallback_destination: OMIT, hooks: OMIT, status: 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 @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at @status = status if status != 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 @number = number @credential_id = credential_id @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, "hooks": hooks, "id": id, "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, "status": status, "name": name, "assistantId": assistant_id, "workflowId": workflow_id, "squadId": squad_id, "server": server, "number": number, "credentialId": credential_id }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
66 67 68 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 66 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.
39 40 41 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 39 def assistant_id @assistant_id end |
#created_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the phone number was created.
27 28 29 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 27 def created_at @created_at end |
#credential_id ⇒ String (readonly)
Returns This is the credential you added in dashboard.vapi.ai/keys. This is used to configure the number to send inbound calls to Vapi, make outbound calls and do live call updates like transfers and hangups.
64 65 66 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 64 def credential_id @credential_id end |
#fallback_destination ⇒ Vapi::TelnyxPhoneNumberFallbackDestination (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.
19 20 21 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 19 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.
21 22 23 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 21 def hooks @hooks end |
#id ⇒ String (readonly)
Returns This is the unique identifier for the phone number.
23 24 25 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 23 def id @id end |
#name ⇒ String (readonly)
Returns This is the name of the phone number. This is just for your own reference.
33 34 35 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 33 def name @name end |
#number ⇒ String (readonly)
Returns These are the digits of the phone number you own on your Telnyx.
60 61 62 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 60 def number @number end |
#org_id ⇒ String (readonly)
Returns This is the unique identifier for the org that this phone number belongs to.
25 26 27 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 25 def org_id @org_id 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.
58 59 60 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 58 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`, `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.
51 52 53 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 51 def squad_id @squad_id end |
#status ⇒ Vapi::TelnyxPhoneNumberStatus (readonly)
Returns This is the status of the phone number.
31 32 33 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 31 def status @status end |
#updated_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the phone number was last updated.
29 30 31 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 29 def updated_at @updated_at 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.
45 46 47 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 45 def workflow_id @workflow_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TelnyxPhoneNumber
Deserialize a JSON object to an instance of TelnyxPhoneNumber
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 154 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::TelnyxPhoneNumberFallbackDestination.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 id = parsed_json["id"] org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) status = parsed_json["status"] 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 number = parsed_json["number"] credential_id = parsed_json["credentialId"] new( fallback_destination: fallback_destination, hooks: hooks, id: id, org_id: org_id, created_at: created_at, updated_at: updated_at, status: status, name: name, assistant_id: assistant_id, workflow_id: workflow_id, squad_id: squad_id, server: server, number: number, credential_id: credential_id, 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.
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 216 def self.validate_raw(obj:) obj.fallback_destination.nil? || Vapi::TelnyxPhoneNumberFallbackDestination.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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") obj.status&.is_a?(Vapi::TelnyxPhoneNumberStatus) != false || raise("Passed value for field obj.status 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) obj.number.is_a?(String) != false || raise("Passed value for field obj.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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TelnyxPhoneNumber to a JSON object
206 207 208 |
# File 'lib/vapi_server_sdk/types/telnyx_phone_number.rb', line 206 def to_json(*_args) @_field_set&.to_json end |