Class: Vapi::GoogleVoicemailDetectionPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(beep_max_await_seconds: OMIT, backoff_plan: OMIT, additional_properties: nil) ⇒ Vapi::GoogleVoicemailDetectionPlan



43
44
45
46
47
48
49
50
# File 'lib/vapi_server_sdk/types/google_voicemail_detection_plan.rb', line 43

def initialize(beep_max_await_seconds: OMIT, backoff_plan: OMIT, additional_properties: nil)
  @beep_max_await_seconds = beep_max_await_seconds if beep_max_await_seconds != OMIT
  @backoff_plan = backoff_plan if backoff_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = { "beepMaxAwaitSeconds": beep_max_await_seconds, "backoffPlan": backoff_plan }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



23
24
25
# File 'lib/vapi_server_sdk/types/google_voicemail_detection_plan.rb', line 23

def additional_properties
  @additional_properties
end

#backoff_planVapi::VoicemailDetectionBackoffPlan (readonly)



21
22
23
# File 'lib/vapi_server_sdk/types/google_voicemail_detection_plan.rb', line 21

def backoff_plan
  @backoff_plan
end

#beep_max_await_secondsFloat (readonly)



19
20
21
# File 'lib/vapi_server_sdk/types/google_voicemail_detection_plan.rb', line 19

def beep_max_await_seconds
  @beep_max_await_seconds
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::GoogleVoicemailDetectionPlan

Deserialize a JSON object to an instance of GoogleVoicemailDetectionPlan



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vapi_server_sdk/types/google_voicemail_detection_plan.rb', line 56

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  beep_max_await_seconds = parsed_json["beepMaxAwaitSeconds"]
  if parsed_json["backoffPlan"].nil?
    backoff_plan = nil
  else
    backoff_plan = parsed_json["backoffPlan"].to_json
    backoff_plan = Vapi::VoicemailDetectionBackoffPlan.from_json(json_object: backoff_plan)
  end
  new(
    beep_max_await_seconds: beep_max_await_seconds,
    backoff_plan: backoff_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.


86
87
88
89
# File 'lib/vapi_server_sdk/types/google_voicemail_detection_plan.rb', line 86

def self.validate_raw(obj:)
  obj.beep_max_await_seconds&.is_a?(Float) != false || raise("Passed value for field obj.beep_max_await_seconds is not the expected type, validation failed.")
  obj.backoff_plan.nil? || Vapi::VoicemailDetectionBackoffPlan.validate_raw(obj: obj.backoff_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of GoogleVoicemailDetectionPlan to a JSON object



76
77
78
# File 'lib/vapi_server_sdk/types/google_voicemail_detection_plan.rb', line 76

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