Class: Vapi::SipTrunkOutboundAuthenticationPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_password: OMIT, auth_username: OMIT, sip_register_plan: OMIT, additional_properties: nil) ⇒ Vapi::SipTrunkOutboundAuthenticationPlan



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/vapi_server_sdk/types/sip_trunk_outbound_authentication_plan.rb', line 30

def initialize(auth_password: OMIT, auth_username: OMIT, sip_register_plan: OMIT, additional_properties: nil)
  @auth_password = auth_password if auth_password != OMIT
  @auth_username = auth_username if auth_username != OMIT
  @sip_register_plan = sip_register_plan if sip_register_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "authPassword": auth_password,
    "authUsername": auth_username,
    "sipRegisterPlan": sip_register_plan
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



17
18
19
# File 'lib/vapi_server_sdk/types/sip_trunk_outbound_authentication_plan.rb', line 17

def additional_properties
  @additional_properties
end

#auth_passwordString (readonly)



10
11
12
# File 'lib/vapi_server_sdk/types/sip_trunk_outbound_authentication_plan.rb', line 10

def auth_password
  @auth_password
end

#auth_usernameString (readonly)



12
13
14
# File 'lib/vapi_server_sdk/types/sip_trunk_outbound_authentication_plan.rb', line 12

def auth_username
  @auth_username
end

#sip_register_planVapi::SipTrunkOutboundSipRegisterPlan (readonly)



15
16
17
# File 'lib/vapi_server_sdk/types/sip_trunk_outbound_authentication_plan.rb', line 15

def sip_register_plan
  @sip_register_plan
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::SipTrunkOutboundAuthenticationPlan

Deserialize a JSON object to an instance of SipTrunkOutboundAuthenticationPlan



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vapi_server_sdk/types/sip_trunk_outbound_authentication_plan.rb', line 48

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  auth_password = parsed_json["authPassword"]
  auth_username = parsed_json["authUsername"]
  if parsed_json["sipRegisterPlan"].nil?
    sip_register_plan = nil
  else
    sip_register_plan = parsed_json["sipRegisterPlan"].to_json
    sip_register_plan = Vapi::SipTrunkOutboundSipRegisterPlan.from_json(json_object: sip_register_plan)
  end
  new(
    auth_password: auth_password,
    auth_username: auth_username,
    sip_register_plan: sip_register_plan,
    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.


80
81
82
83
84
# File 'lib/vapi_server_sdk/types/sip_trunk_outbound_authentication_plan.rb', line 80

def self.validate_raw(obj:)
  obj.auth_password&.is_a?(String) != false || raise("Passed value for field obj.auth_password is not the expected type, validation failed.")
  obj.auth_username&.is_a?(String) != false || raise("Passed value for field obj.auth_username is not the expected type, validation failed.")
  obj.sip_register_plan.nil? || Vapi::SipTrunkOutboundSipRegisterPlan.validate_raw(obj: obj.sip_register_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of SipTrunkOutboundAuthenticationPlan to a JSON object



70
71
72
# File 'lib/vapi_server_sdk/types/sip_trunk_outbound_authentication_plan.rb', line 70

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