Class: Vapi::TransportCost
- Inherits:
-
Object
- Object
- Vapi::TransportCost
- Defined in:
- lib/vapi_server_sdk/types/transport_cost.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#cost ⇒ Float
readonly
This is the cost of the component in USD.
-
#minutes ⇒ Float
readonly
This is the minutes of ‘transport` usage.
- #provider ⇒ Vapi::TransportCostProvider readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::TransportCost
Deserialize a JSON object to an instance of TransportCost.
-
.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.
Instance Method Summary collapse
- #initialize(minutes:, cost:, provider: OMIT, additional_properties: nil) ⇒ Vapi::TransportCost constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TransportCost to a JSON object.
Constructor Details
#initialize(minutes:, cost:, provider: OMIT, additional_properties: nil) ⇒ Vapi::TransportCost
30 31 32 33 34 35 36 37 38 |
# File 'lib/vapi_server_sdk/types/transport_cost.rb', line 30 def initialize(minutes:, cost:, provider: OMIT, additional_properties: nil) @provider = provider if provider != OMIT @minutes = minutes @cost = cost @additional_properties = additional_properties @_field_set = { "provider": provider, "minutes": minutes, "cost": cost }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/vapi_server_sdk/types/transport_cost.rb', line 17 def additional_properties @additional_properties end |
#cost ⇒ Float (readonly)
Returns This is the cost of the component in USD.
15 16 17 |
# File 'lib/vapi_server_sdk/types/transport_cost.rb', line 15 def cost @cost end |
#minutes ⇒ Float (readonly)
Returns This is the minutes of ‘transport` usage. This should match `call.endedAt` - `call.startedAt`.
13 14 15 |
# File 'lib/vapi_server_sdk/types/transport_cost.rb', line 13 def minutes @minutes end |
#provider ⇒ Vapi::TransportCostProvider (readonly)
10 11 12 |
# File 'lib/vapi_server_sdk/types/transport_cost.rb', line 10 def provider @provider end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TransportCost
Deserialize a JSON object to an instance of TransportCost
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vapi_server_sdk/types/transport_cost.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] minutes = parsed_json["minutes"] cost = parsed_json["cost"] new( provider: provider, 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.
71 72 73 74 75 |
# File 'lib/vapi_server_sdk/types/transport_cost.rb', line 71 def self.validate_raw(obj:) obj.provider&.is_a?(Vapi::TransportCostProvider) != false || raise("Passed value for field obj.provider 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 TransportCost to a JSON object
61 62 63 |
# File 'lib/vapi_server_sdk/types/transport_cost.rb', line 61 def to_json(*_args) @_field_set&.to_json end |