Class: Vapi::AnalyticsQuery
- Inherits:
-
Object
- Object
- Vapi::AnalyticsQuery
- Defined in:
- lib/vapi_server_sdk/types/analytics_query.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#group_by ⇒ Array<Vapi::AnalyticsQueryGroupByItem>
readonly
This is the list of columns you want to group by.
-
#name ⇒ String
readonly
This is the name of the query.
-
#operations ⇒ Array<Vapi::AnalyticsOperation>
readonly
This is the list of operations you want to perform.
-
#table ⇒ String
readonly
This is the table you want to query.
-
#time_range ⇒ Vapi::TimeRange
readonly
This is the time range for the query.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::AnalyticsQuery
Deserialize a JSON object to an instance of AnalyticsQuery.
-
.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(table:, name:, operations:, group_by: OMIT, time_range: OMIT, additional_properties: nil) ⇒ Vapi::AnalyticsQuery constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AnalyticsQuery to a JSON object.
Constructor Details
#initialize(table:, name:, operations:, group_by: OMIT, time_range: OMIT, additional_properties: nil) ⇒ Vapi::AnalyticsQuery
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 38 def initialize(table:, name:, operations:, group_by: OMIT, time_range: OMIT, additional_properties: nil) @table = table @group_by = group_by if group_by != OMIT @name = name @time_range = time_range if time_range != OMIT @operations = operations @additional_properties = additional_properties @_field_set = { "table": table, "groupBy": group_by, "name": name, "timeRange": time_range, "operations": operations }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 23 def additional_properties @additional_properties end |
#group_by ⇒ Array<Vapi::AnalyticsQueryGroupByItem> (readonly)
Returns This is the list of columns you want to group by.
14 15 16 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 14 def group_by @group_by end |
#name ⇒ String (readonly)
Returns This is the name of the query. This will be used to identify the query in the response.
17 18 19 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 17 def name @name end |
#operations ⇒ Array<Vapi::AnalyticsOperation> (readonly)
Returns This is the list of operations you want to perform.
21 22 23 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 21 def operations @operations end |
#table ⇒ String (readonly)
Returns This is the table you want to query.
12 13 14 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 12 def table @table end |
#time_range ⇒ Vapi::TimeRange (readonly)
Returns This is the time range for the query.
19 20 21 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 19 def time_range @time_range end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::AnalyticsQuery
Deserialize a JSON object to an instance of AnalyticsQuery
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 60 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) table = parsed_json["table"] group_by = parsed_json["groupBy"] 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 operations = parsed_json["operations"]&.map do |item| item = item.to_json Vapi::AnalyticsOperation.from_json(json_object: item) end new( table: table, group_by: group_by, name: name, time_range: time_range, operations: operations, 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.
99 100 101 102 103 104 105 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 99 def self.validate_raw(obj:) obj.table.is_a?(String) != false || raise("Passed value for field obj.table is not the expected type, validation failed.") obj.group_by&.is_a?(Array) != false || raise("Passed value for field obj.group_by is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.time_range.nil? || Vapi::TimeRange.validate_raw(obj: obj.time_range) obj.operations.is_a?(Array) != false || raise("Passed value for field obj.operations is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AnalyticsQuery to a JSON object
89 90 91 |
# File 'lib/vapi_server_sdk/types/analytics_query.rb', line 89 def to_json(*_args) @_field_set&.to_json end |