Class: Vapi::AnalyticsQueryResult
- Inherits:
-
Object
- Object
- Vapi::AnalyticsQueryResult
- Defined in:
- lib/vapi_server_sdk/types/analytics_query_result.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#name ⇒ String
readonly
This is the unique key for the query.
-
#result ⇒ Array<Hash{String => Object}>
readonly
This is the result of the query, a list of unique groups with result of their aggregations.
-
#time_range ⇒ Vapi::TimeRange
readonly
This is the time range for the query.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::AnalyticsQueryResult
Deserialize a JSON object to an instance of AnalyticsQueryResult.
-
.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(name:, time_range:, result:, additional_properties: nil) ⇒ Vapi::AnalyticsQueryResult constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AnalyticsQueryResult to a JSON object.
Constructor Details
#initialize(name:, time_range:, result:, additional_properties: nil) ⇒ Vapi::AnalyticsQueryResult
46 47 48 49 50 51 52 |
# File 'lib/vapi_server_sdk/types/analytics_query_result.rb', line 46 def initialize(name:, time_range:, result:, additional_properties: nil) @name = name @time_range = time_range @result = result @additional_properties = additional_properties @_field_set = { "name": name, "timeRange": time_range, "result": result } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
25 26 27 |
# File 'lib/vapi_server_sdk/types/analytics_query_result.rb', line 25 def additional_properties @additional_properties end |
#name ⇒ String (readonly)
Returns This is the unique key for the query.
10 11 12 |
# File 'lib/vapi_server_sdk/types/analytics_query_result.rb', line 10 def name @name end |
#result ⇒ Array<Hash{String => Object}> (readonly)
Returns This is the result of the query, a list of unique groups with result of their aggregations. Example: “result”: [ { “date”: “2023-01-01”, “assistantId”: “123”, “endedReason”: “customer-ended-call”, “sumDuration”: 120, “avgCost”: 10.5 }, { “date”: “2023-01-02”, “assistantId”: “123”, “endedReason”: “customer-did-not-give-microphone-permission”, “sumDuration”: 0, “avgCost”: 0 }, // Additional results ].
23 24 25 |
# File 'lib/vapi_server_sdk/types/analytics_query_result.rb', line 23 def result @result end |
#time_range ⇒ Vapi::TimeRange (readonly)
Returns This is the time range for the query.
12 13 14 |
# File 'lib/vapi_server_sdk/types/analytics_query_result.rb', line 12 def time_range @time_range end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::AnalyticsQueryResult
Deserialize a JSON object to an instance of AnalyticsQueryResult
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vapi_server_sdk/types/analytics_query_result.rb', line 58 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] if parsed_json["timeRange"].nil? time_range = nil else time_range = parsed_json["timeRange"].to_json time_range = Vapi::TimeRange.from_json(json_object: time_range) end result = parsed_json["result"] new( name: name, time_range: time_range, result: result, 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.
90 91 92 93 94 |
# File 'lib/vapi_server_sdk/types/analytics_query_result.rb', line 90 def self.validate_raw(obj:) obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") Vapi::TimeRange.validate_raw(obj: obj.time_range) obj.result.is_a?(Array) != false || raise("Passed value for field obj.result is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AnalyticsQueryResult to a JSON object
80 81 82 |
# File 'lib/vapi_server_sdk/types/analytics_query_result.rb', line 80 def to_json(*_args) @_field_set&.to_json end |