Class: Vapi::Monitor

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(listen_url: OMIT, control_url: OMIT, additional_properties: nil) ⇒ Vapi::Monitor

Parameters:

  • listen_url (String) (defaults to: OMIT)

    This is the URL where the assistant’s calls can be listened to in real-time. To enable, set ‘assistant.monitorPlan.listenEnabled` to `true`.

  • control_url (String) (defaults to: OMIT)

    This is the URL where the assistant’s calls can be controlled in real-time. To enable, set ‘assistant.monitorPlan.controlEnabled` to `true`.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
34
35
# File 'lib/vapi_server_sdk/types/monitor.rb', line 28

def initialize(listen_url: OMIT, control_url: OMIT, additional_properties: nil)
  @listen_url = listen_url if listen_url != OMIT
  @control_url = control_url if control_url != OMIT
  @additional_properties = additional_properties
  @_field_set = { "listenUrl": listen_url, "controlUrl": control_url }.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



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

def additional_properties
  @additional_properties
end

#control_urlString (readonly)

Returns This is the URL where the assistant’s calls can be controlled in real-time. To enable, set ‘assistant.monitorPlan.controlEnabled` to `true`.

Returns:

  • (String)

    This is the URL where the assistant’s calls can be controlled in real-time. To enable, set ‘assistant.monitorPlan.controlEnabled` to `true`.



13
14
15
# File 'lib/vapi_server_sdk/types/monitor.rb', line 13

def control_url
  @control_url
end

#listen_urlString (readonly)

Returns This is the URL where the assistant’s calls can be listened to in real-time. To enable, set ‘assistant.monitorPlan.listenEnabled` to `true`.

Returns:

  • (String)

    This is the URL where the assistant’s calls can be listened to in real-time. To enable, set ‘assistant.monitorPlan.listenEnabled` to `true`.



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

def listen_url
  @listen_url
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::Monitor

Deserialize a JSON object to an instance of Monitor

Parameters:

  • json_object (String)

Returns:



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/vapi_server_sdk/types/monitor.rb', line 41

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  listen_url = parsed_json["listenUrl"]
  control_url = parsed_json["controlUrl"]
  new(
    listen_url: listen_url,
    control_url: control_url,
    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)


66
67
68
69
# File 'lib/vapi_server_sdk/types/monitor.rb', line 66

def self.validate_raw(obj:)
  obj.listen_url&.is_a?(String) != false || raise("Passed value for field obj.listen_url is not the expected type, validation failed.")
  obj.control_url&.is_a?(String) != false || raise("Passed value for field obj.control_url is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Monitor to a JSON object

Returns:

  • (String)


56
57
58
# File 'lib/vapi_server_sdk/types/monitor.rb', line 56

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