Class: Vapi::TranscriberCost

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transcriber:, minutes:, cost:, additional_properties: nil) ⇒ Vapi::TranscriberCost

Parameters:

  • transcriber (Hash{String => Object})

    This is the transcriber that was used during the call. This matches one of the below:

  • minutes (Float)

    This is the minutes of ‘transcriber` usage. This should match `call.endedAt` - `call.startedAt` for single assistant calls, while squad calls will have multiple transcriber costs one for each assistant that was used.

  • cost (Float)

    This is the cost of the component in USD.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



45
46
47
48
49
50
51
# File 'lib/vapi_server_sdk/types/transcriber_cost.rb', line 45

def initialize(transcriber:, minutes:, cost:, additional_properties: nil)
  @transcriber = transcriber
  @minutes = minutes
  @cost = cost
  @additional_properties = additional_properties
  @_field_set = { "transcriber": transcriber, "minutes": minutes, "cost": cost }
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



24
25
26
# File 'lib/vapi_server_sdk/types/transcriber_cost.rb', line 24

def additional_properties
  @additional_properties
end

#costFloat (readonly)

Returns This is the cost of the component in USD.

Returns:

  • (Float)

    This is the cost of the component in USD.



22
23
24
# File 'lib/vapi_server_sdk/types/transcriber_cost.rb', line 22

def cost
  @cost
end

#minutesFloat (readonly)

Returns This is the minutes of ‘transcriber` usage. This should match `call.endedAt` - `call.startedAt` for single assistant calls, while squad calls will have multiple transcriber costs one for each assistant that was used.

Returns:

  • (Float)

    This is the minutes of ‘transcriber` usage. This should match `call.endedAt` - `call.startedAt` for single assistant calls, while squad calls will have multiple transcriber costs one for each assistant that was used.



20
21
22
# File 'lib/vapi_server_sdk/types/transcriber_cost.rb', line 20

def minutes
  @minutes
end

#transcriberHash{String => Object} (readonly)

Returns This is the transcriber that was used during the call. This matches one of the below:

Returns:

  • (Hash{String => Object})

    This is the transcriber that was used during the call. This matches one of the below:



16
17
18
# File 'lib/vapi_server_sdk/types/transcriber_cost.rb', line 16

def transcriber
  @transcriber
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TranscriberCost

Deserialize a JSON object to an instance of TranscriberCost

Parameters:

  • json_object (String)

Returns:



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

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


84
85
86
87
88
# File 'lib/vapi_server_sdk/types/transcriber_cost.rb', line 84

def self.validate_raw(obj:)
  obj.transcriber.is_a?(Hash) != false || raise("Passed value for field obj.transcriber is not the expected type, validation failed.")
  obj.minutes.is_a?(Float) != false || raise("Passed value for field obj.minutes is not the expected type, validation failed.")
  obj.cost.is_a?(Float) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TranscriberCost to a JSON object

Returns:

  • (String)


74
75
76
# File 'lib/vapi_server_sdk/types/transcriber_cost.rb', line 74

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