Class: Vapi::CreateCustomerDto
- Inherits:
-
Object
- Object
- Vapi::CreateCustomerDto
- Defined in:
- lib/vapi_server_sdk/types/create_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.
-
#extension ⇒ String
readonly
This is the extension that will be dialed after the call is answered.
-
#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::CreateCustomerDto
Deserialize a JSON object to an instance of CreateCustomerDto.
-
.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, number: OMIT, sip_uri: OMIT, name: OMIT, additional_properties: nil) ⇒ Vapi::CreateCustomerDto constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreateCustomerDto to a JSON object.
Constructor Details
#initialize(number_e_164_check_enabled: OMIT, extension: OMIT, number: OMIT, sip_uri: OMIT, name: OMIT, additional_properties: nil) ⇒ Vapi::CreateCustomerDto
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 55 def initialize(number_e_164_check_enabled: OMIT, extension: OMIT, number: OMIT, sip_uri: OMIT, name: 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 @number = number if number != OMIT @sip_uri = sip_uri if sip_uri != OMIT @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "numberE164CheckEnabled": number_e_164_check_enabled, "extension": extension, "number": number, "sipUri": sip_uri, "name": name }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
30 31 32 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 30 def additional_properties @additional_properties end |
#extension ⇒ String (readonly)
Returns This is the extension that will be dialed after the call is answered.
20 21 22 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 20 def extension @extension 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>`.
28 29 30 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 28 def name @name end |
#number ⇒ String (readonly)
Returns This is the number of the customer.
22 23 24 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 22 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).
18 19 20 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 18 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.
24 25 26 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 24 def sip_uri @sip_uri end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CreateCustomerDto
Deserialize a JSON object to an instance of CreateCustomerDto
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 78 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"] number = parsed_json["number"] sip_uri = parsed_json["sipUri"] name = parsed_json["name"] new( number_e_164_check_enabled: number_e_164_check_enabled, extension: extension, number: number, sip_uri: sip_uri, name: name, 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.
109 110 111 112 113 114 115 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 109 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.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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CreateCustomerDto to a JSON object
99 100 101 |
# File 'lib/vapi_server_sdk/types/create_customer_dto.rb', line 99 def to_json(*_args) @_field_set&.to_json end |