Class: Vapi::SipAuthentication
- Inherits:
-
Object
- Object
- Vapi::SipAuthentication
- Defined in:
- lib/vapi_server_sdk/types/sip_authentication.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#password ⇒ String
readonly
This will be expected to generate the ‘response` field of the `authorization` header of the SIP INVITE, through digest authentication.
-
#realm ⇒ String
readonly
This will be expected in the ‘realm` field of the `authorization` header of the SIP INVITE.
-
#username ⇒ String
readonly
This will be expected in the ‘username` field of the `authorization` header of the SIP INVITE.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::SipAuthentication
Deserialize a JSON object to an instance of SipAuthentication.
-
.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(username:, password:, realm: OMIT, additional_properties: nil) ⇒ Vapi::SipAuthentication constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of SipAuthentication to a JSON object.
Constructor Details
#initialize(username:, password:, realm: OMIT, additional_properties: nil) ⇒ Vapi::SipAuthentication
33 34 35 36 37 38 39 40 41 |
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 33 def initialize(username:, password:, realm: OMIT, additional_properties: nil) @realm = realm if realm != OMIT @username = username @password = password @additional_properties = additional_properties @_field_set = { "realm": realm, "username": username, "password": password }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 18 def additional_properties @additional_properties end |
#password ⇒ String (readonly)
Returns This will be expected to generate the ‘response` field of the `authorization` header of the SIP INVITE, through digest authentication.
16 17 18 |
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 16 def password @password end |
#realm ⇒ String (readonly)
Returns This will be expected in the ‘realm` field of the `authorization` header of the SIP INVITE. Defaults to sip.vapi.ai.
10 11 12 |
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 10 def realm @realm end |
#username ⇒ String (readonly)
Returns This will be expected in the ‘username` field of the `authorization` header of the SIP INVITE.
13 14 15 |
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 13 def username @username end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::SipAuthentication
Deserialize a JSON object to an instance of SipAuthentication
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) realm = parsed_json["realm"] username = parsed_json["username"] password = parsed_json["password"] new( realm: realm, username: username, password: password, 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.
74 75 76 77 78 |
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 74 def self.validate_raw(obj:) obj.realm&.is_a?(String) != false || raise("Passed value for field obj.realm is not the expected type, validation failed.") obj.username.is_a?(String) != false || raise("Passed value for field obj.username is not the expected type, validation failed.") obj.password.is_a?(String) != false || raise("Passed value for field obj.password is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of SipAuthentication to a JSON object
64 65 66 |
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 64 def to_json(*_args) @_field_set&.to_json end |