Class: Vapi::AnalyticsOperation

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation:, column:, alias_: OMIT, additional_properties: nil) ⇒ Vapi::AnalyticsOperation

Parameters:

  • operation (Vapi::AnalyticsOperationOperation)

    This is the aggregation operation you want to perform.

  • column (Vapi::AnalyticsOperationColumn)

    This is the columns you want to perform the aggregation operation on.

  • alias_ (String) (defaults to: OMIT)

    This is the alias for column name returned. Defaults to ‘$#operation$#column`.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
36
37
# File 'lib/vapi_server_sdk/types/analytics_operation.rb', line 29

def initialize(operation:, column:, alias_: OMIT, additional_properties: nil)
  @operation = operation
  @column = column
  @alias_ = alias_ if alias_ != OMIT
  @additional_properties = additional_properties
  @_field_set = { "operation": operation, "column": column, "alias": alias_ }.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



17
18
19
# File 'lib/vapi_server_sdk/types/analytics_operation.rb', line 17

def additional_properties
  @additional_properties
end

#alias_String (readonly)

Returns This is the alias for column name returned. Defaults to ‘$#operation$#column`.

Returns:

  • (String)

    This is the alias for column name returned. Defaults to ‘$#operation$#column`.



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

def alias_
  @alias_
end

#columnVapi::AnalyticsOperationColumn (readonly)

Returns This is the columns you want to perform the aggregation operation on.

Returns:



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

def column
  @column
end

#operationVapi::AnalyticsOperationOperation (readonly)

Returns This is the aggregation operation you want to perform.

Returns:



11
12
13
# File 'lib/vapi_server_sdk/types/analytics_operation.rb', line 11

def operation
  @operation
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::AnalyticsOperation

Deserialize a JSON object to an instance of AnalyticsOperation

Parameters:

  • json_object (String)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/vapi_server_sdk/types/analytics_operation.rb', line 43

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


70
71
72
73
74
# File 'lib/vapi_server_sdk/types/analytics_operation.rb', line 70

def self.validate_raw(obj:)
  obj.operation.is_a?(Vapi::AnalyticsOperationOperation) != false || raise("Passed value for field obj.operation is not the expected type, validation failed.")
  obj.column.is_a?(Vapi::AnalyticsOperationColumn) != false || raise("Passed value for field obj.column is not the expected type, validation failed.")
  obj.alias_&.is_a?(String) != false || raise("Passed value for field obj.alias_ is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AnalyticsOperation to a JSON object

Returns:

  • (String)


60
61
62
# File 'lib/vapi_server_sdk/types/analytics_operation.rb', line 60

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