Class: Vapi::SipAuthentication

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/sip_authentication.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username:, password:, realm: OMIT, additional_properties: nil) ⇒ Vapi::SipAuthentication

Parameters:

  • realm (String) (defaults to: OMIT)

    This will be expected in the ‘realm` field of the `authorization` header of the SIP INVITE. Defaults to sip.vapi.ai.

  • username (String)

    This will be expected in the ‘username` field of the `authorization` header of the SIP INVITE.

  • password (String)

    This will be expected to generate the ‘response` field of the `authorization` header of the SIP INVITE, through digest authentication.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#passwordString (readonly)

Returns This will be expected to generate the ‘response` field of the `authorization` header of the SIP INVITE, through digest authentication.

Returns:

  • (String)

    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

#realmString (readonly)

Returns This will be expected in the ‘realm` field of the `authorization` header of the SIP INVITE. Defaults to sip.vapi.ai.

Returns:

  • (String)

    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

#usernameString (readonly)

Returns This will be expected in the ‘username` field of the `authorization` header of the SIP INVITE.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


64
65
66
# File 'lib/vapi_server_sdk/types/sip_authentication.rb', line 64

def to_json(*_args)
  @_field_set&.to_json
end