Class: Vapi::CreateWebCustomerDto
- Inherits:
-
Object
- Object
- Vapi::CreateWebCustomerDto
- Defined in:
- lib/vapi_server_sdk/types/create_web_customer_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_overrides ⇒ Vapi::ChatAssistantOverrides
readonly
These are the variable values that will be used to replace template variables in the assistant messages.
-
#email ⇒ String
readonly
This is the email of the customer.
-
#extension ⇒ String
readonly
This is the extension that will be dialed after the call is answered.
-
#external_id ⇒ String
readonly
This is the external ID of the customer.
-
#name ⇒ String
readonly
This is the name of the customer.
-
#number ⇒ String
readonly
This is the number of the customer.
-
#number_e_164_check_enabled ⇒ Boolean
readonly
This is the flag to toggle the E164 check for the ‘number` field.
-
#sip_uri ⇒ String
readonly
This is the SIP URI of the customer.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::CreateWebCustomerDto
Deserialize a JSON object to an instance of CreateWebCustomerDto.
-
.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_e_164_check_enabled: OMIT, extension: OMIT, assistant_overrides: OMIT, number: OMIT, sip_uri: OMIT, name: OMIT, email: OMIT, external_id: OMIT, additional_properties: nil) ⇒ Vapi::CreateWebCustomerDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreateWebCustomerDto to a JSON object.
Constructor Details
#initialize(number_e_164_check_enabled: OMIT, extension: OMIT, assistant_overrides: OMIT, number: OMIT, sip_uri: OMIT, name: OMIT, email: OMIT, external_id: OMIT, additional_properties: nil) ⇒ Vapi::CreateWebCustomerDto
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 71 def initialize(number_e_164_check_enabled: OMIT, extension: OMIT, assistant_overrides: OMIT, number: OMIT, sip_uri: OMIT, name: OMIT, email: OMIT, external_id: OMIT, additional_properties: nil) @number_e_164_check_enabled = number_e_164_check_enabled if number_e_164_check_enabled != OMIT @extension = extension if extension != OMIT @assistant_overrides = assistant_overrides if assistant_overrides != OMIT @number = number if number != OMIT @sip_uri = sip_uri if sip_uri != OMIT @name = name if name != OMIT @email = email if email != OMIT @external_id = external_id if external_id != OMIT @additional_properties = additional_properties @_field_set = { "numberE164CheckEnabled": number_e_164_check_enabled, "extension": extension, "assistantOverrides": assistant_overrides, "number": number, "sipUri": sip_uri, "name": name, "email": email, "externalId": external_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.
40 41 42 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 40 def additional_properties @additional_properties end |
#assistant_overrides ⇒ Vapi::ChatAssistantOverrides (readonly)
Returns These are the variable values that will be used to replace template variables in the assistant messages. Only variable substitution is supported in web chat - other assistant properties cannot be overridden.
26 27 28 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 26 def assistant_overrides @assistant_overrides end |
#email ⇒ String (readonly)
Returns This is the email of the customer.
36 37 38 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 36 def email @email end |
#extension ⇒ String (readonly)
Returns This is the extension that will be dialed after the call is answered.
21 22 23 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 21 def extension @extension end |
#external_id ⇒ String (readonly)
Returns This is the external ID of the customer.
38 39 40 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 38 def external_id @external_id end |
#name ⇒ String (readonly)
Returns This is the name of the customer. This is just for your own reference. For SIP inbound calls, this is extracted from the ‘From` SIP header with format `“Display Name” <sip:username@domain>`.
34 35 36 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 34 def name @name end |
#number ⇒ String (readonly)
Returns This is the number of the customer.
28 29 30 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 28 def number @number end |
#number_e_164_check_enabled ⇒ Boolean (readonly)
Returns This is the flag to toggle the E164 check for the ‘number` field. This is an advanced property which should be used if you know your use case requires it. Use cases:
-
‘false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`.
This is useful for dialing out to non-E164 numbers on your SIP trunks.
-
‘true` (default): To allow only E164 numbers like `+14155551234`. This is
standard for PSTN calls. If ‘false`, the `number` is still required to only contain alphanumeric characters (regex: `/^+?[a-zA-Z0-9]+$/`). @default true (E164 check is enabled).
19 20 21 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 19 def number_e_164_check_enabled @number_e_164_check_enabled end |
#sip_uri ⇒ String (readonly)
Returns This is the SIP URI of the customer.
30 31 32 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 30 def sip_uri @sip_uri end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CreateWebCustomerDto
Deserialize a JSON object to an instance of CreateWebCustomerDto
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 100 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) number_e_164_check_enabled = parsed_json["numberE164CheckEnabled"] extension = parsed_json["extension"] if parsed_json["assistantOverrides"].nil? assistant_overrides = nil else assistant_overrides = parsed_json["assistantOverrides"].to_json assistant_overrides = Vapi::ChatAssistantOverrides.from_json(json_object: assistant_overrides) end number = parsed_json["number"] sip_uri = parsed_json["sipUri"] name = parsed_json["name"] email = parsed_json["email"] external_id = parsed_json["externalId"] new( number_e_164_check_enabled: number_e_164_check_enabled, extension: extension, assistant_overrides: assistant_overrides, number: number, sip_uri: sip_uri, name: name, email: email, external_id: external_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.
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 142 def self.validate_raw(obj:) obj.number_e_164_check_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.number_e_164_check_enabled is not the expected type, validation failed.") obj.extension&.is_a?(String) != false || raise("Passed value for field obj.extension is not the expected type, validation failed.") obj.assistant_overrides.nil? || Vapi::ChatAssistantOverrides.validate_raw(obj: obj.assistant_overrides) obj.number&.is_a?(String) != false || raise("Passed value for field obj.number 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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.") obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CreateWebCustomerDto to a JSON object
132 133 134 |
# File 'lib/vapi_server_sdk/types/create_web_customer_dto.rb', line 132 def to_json(*_args) @_field_set&.to_json end |