Class: Vapi::Metrics

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(org_id:, range_start:, range_end:, bill:, bill_within_billing_limit:, bill_daily_breakdown:, call_active:, call_active_within_concurrency_limit:, call_minutes:, call_minutes_daily_breakdown:, call_minutes_average:, call_minutes_average_daily_breakdown:, call_count:, call_count_daily_breakdown:, additional_properties: nil) ⇒ Vapi::Metrics

Parameters:

  • org_id (String)
  • range_start (String)
  • range_end (String)
  • bill (Float)
  • bill_within_billing_limit (Boolean)
  • bill_daily_breakdown (Hash{String => Object})
  • call_active (Float)
  • call_active_within_concurrency_limit (Boolean)
  • call_minutes (Float)
  • call_minutes_daily_breakdown (Hash{String => Object})
  • call_minutes_average (Float)
  • call_minutes_average_daily_breakdown (Hash{String => Object})
  • call_count (Float)
  • call_count_daily_breakdown (Hash{String => Object})
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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
85
86
87
88
89
90
91
92
93
# File 'lib/vapi_server_sdk/types/metrics.rb', line 60

def initialize(org_id:, range_start:, range_end:, bill:, bill_within_billing_limit:, bill_daily_breakdown:,
               call_active:, call_active_within_concurrency_limit:, call_minutes:, call_minutes_daily_breakdown:, call_minutes_average:, call_minutes_average_daily_breakdown:, call_count:, call_count_daily_breakdown:, additional_properties: nil)
  @org_id = org_id
  @range_start = range_start
  @range_end = range_end
  @bill = bill
  @bill_within_billing_limit = bill_within_billing_limit
  @bill_daily_breakdown = bill_daily_breakdown
  @call_active = call_active
  @call_active_within_concurrency_limit = call_active_within_concurrency_limit
  @call_minutes = call_minutes
  @call_minutes_daily_breakdown = call_minutes_daily_breakdown
  @call_minutes_average = call_minutes_average
  @call_minutes_average_daily_breakdown = call_minutes_average_daily_breakdown
  @call_count = call_count
  @call_count_daily_breakdown = call_count_daily_breakdown
  @additional_properties = additional_properties
  @_field_set = {
    "orgId": org_id,
    "rangeStart": range_start,
    "rangeEnd": range_end,
    "bill": bill,
    "billWithinBillingLimit": bill_within_billing_limit,
    "billDailyBreakdown": bill_daily_breakdown,
    "callActive": call_active,
    "callActiveWithinConcurrencyLimit": call_active_within_concurrency_limit,
    "callMinutes": call_minutes,
    "callMinutesDailyBreakdown": call_minutes_daily_breakdown,
    "callMinutesAverage": call_minutes_average,
    "callMinutesAverageDailyBreakdown": call_minutes_average_daily_breakdown,
    "callCount": call_count,
    "callCountDailyBreakdown": call_count_daily_breakdown
  }
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



37
38
39
# File 'lib/vapi_server_sdk/types/metrics.rb', line 37

def additional_properties
  @additional_properties
end

#billFloat (readonly)

Returns:

  • (Float)


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

def bill
  @bill
end

#bill_daily_breakdownHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


19
20
21
# File 'lib/vapi_server_sdk/types/metrics.rb', line 19

def bill_daily_breakdown
  @bill_daily_breakdown
end

#bill_within_billing_limitBoolean (readonly)

Returns:

  • (Boolean)


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

def bill_within_billing_limit
  @bill_within_billing_limit
end

#call_activeFloat (readonly)

Returns:

  • (Float)


21
22
23
# File 'lib/vapi_server_sdk/types/metrics.rb', line 21

def call_active
  @call_active
end

#call_active_within_concurrency_limitBoolean (readonly)

Returns:

  • (Boolean)


23
24
25
# File 'lib/vapi_server_sdk/types/metrics.rb', line 23

def call_active_within_concurrency_limit
  @call_active_within_concurrency_limit
end

#call_countFloat (readonly)

Returns:

  • (Float)


33
34
35
# File 'lib/vapi_server_sdk/types/metrics.rb', line 33

def call_count
  @call_count
end

#call_count_daily_breakdownHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


35
36
37
# File 'lib/vapi_server_sdk/types/metrics.rb', line 35

def call_count_daily_breakdown
  @call_count_daily_breakdown
end

#call_minutesFloat (readonly)

Returns:

  • (Float)


25
26
27
# File 'lib/vapi_server_sdk/types/metrics.rb', line 25

def call_minutes
  @call_minutes
end

#call_minutes_averageFloat (readonly)

Returns:

  • (Float)


29
30
31
# File 'lib/vapi_server_sdk/types/metrics.rb', line 29

def call_minutes_average
  @call_minutes_average
end

#call_minutes_average_daily_breakdownHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


31
32
33
# File 'lib/vapi_server_sdk/types/metrics.rb', line 31

def call_minutes_average_daily_breakdown
  @call_minutes_average_daily_breakdown
end

#call_minutes_daily_breakdownHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


27
28
29
# File 'lib/vapi_server_sdk/types/metrics.rb', line 27

def call_minutes_daily_breakdown
  @call_minutes_daily_breakdown
end

#org_idString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/vapi_server_sdk/types/metrics.rb', line 9

def org_id
  @org_id
end

#range_endString (readonly)

Returns:

  • (String)


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

def range_end
  @range_end
end

#range_startString (readonly)

Returns:

  • (String)


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

def range_start
  @range_start
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::Metrics

Deserialize a JSON object to an instance of Metrics

Parameters:

  • json_object (String)

Returns:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/vapi_server_sdk/types/metrics.rb', line 99

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  org_id = parsed_json["orgId"]
  range_start = parsed_json["rangeStart"]
  range_end = parsed_json["rangeEnd"]
  bill = parsed_json["bill"]
  bill_within_billing_limit = parsed_json["billWithinBillingLimit"]
  bill_daily_breakdown = parsed_json["billDailyBreakdown"]
  call_active = parsed_json["callActive"]
  call_active_within_concurrency_limit = parsed_json["callActiveWithinConcurrencyLimit"]
  call_minutes = parsed_json["callMinutes"]
  call_minutes_daily_breakdown = parsed_json["callMinutesDailyBreakdown"]
  call_minutes_average = parsed_json["callMinutesAverage"]
  call_minutes_average_daily_breakdown = parsed_json["callMinutesAverageDailyBreakdown"]
  call_count = parsed_json["callCount"]
  call_count_daily_breakdown = parsed_json["callCountDailyBreakdown"]
  new(
    org_id: org_id,
    range_start: range_start,
    range_end: range_end,
    bill: bill,
    bill_within_billing_limit: bill_within_billing_limit,
    bill_daily_breakdown: bill_daily_breakdown,
    call_active: call_active,
    call_active_within_concurrency_limit: call_active_within_concurrency_limit,
    call_minutes: call_minutes,
    call_minutes_daily_breakdown: call_minutes_daily_breakdown,
    call_minutes_average: call_minutes_average,
    call_minutes_average_daily_breakdown: call_minutes_average_daily_breakdown,
    call_count: call_count,
    call_count_daily_breakdown: call_count_daily_breakdown,
    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)


148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/vapi_server_sdk/types/metrics.rb', line 148

def self.validate_raw(obj:)
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
  obj.range_start.is_a?(String) != false || raise("Passed value for field obj.range_start is not the expected type, validation failed.")
  obj.range_end.is_a?(String) != false || raise("Passed value for field obj.range_end is not the expected type, validation failed.")
  obj.bill.is_a?(Float) != false || raise("Passed value for field obj.bill is not the expected type, validation failed.")
  obj.bill_within_billing_limit.is_a?(Boolean) != false || raise("Passed value for field obj.bill_within_billing_limit is not the expected type, validation failed.")
  obj.bill_daily_breakdown.is_a?(Hash) != false || raise("Passed value for field obj.bill_daily_breakdown is not the expected type, validation failed.")
  obj.call_active.is_a?(Float) != false || raise("Passed value for field obj.call_active is not the expected type, validation failed.")
  obj.call_active_within_concurrency_limit.is_a?(Boolean) != false || raise("Passed value for field obj.call_active_within_concurrency_limit is not the expected type, validation failed.")
  obj.call_minutes.is_a?(Float) != false || raise("Passed value for field obj.call_minutes is not the expected type, validation failed.")
  obj.call_minutes_daily_breakdown.is_a?(Hash) != false || raise("Passed value for field obj.call_minutes_daily_breakdown is not the expected type, validation failed.")
  obj.call_minutes_average.is_a?(Float) != false || raise("Passed value for field obj.call_minutes_average is not the expected type, validation failed.")
  obj.call_minutes_average_daily_breakdown.is_a?(Hash) != false || raise("Passed value for field obj.call_minutes_average_daily_breakdown is not the expected type, validation failed.")
  obj.call_count.is_a?(Float) != false || raise("Passed value for field obj.call_count is not the expected type, validation failed.")
  obj.call_count_daily_breakdown.is_a?(Hash) != false || raise("Passed value for field obj.call_count_daily_breakdown is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Metrics to a JSON object

Returns:

  • (String)


138
139
140
# File 'lib/vapi_server_sdk/types/metrics.rb', line 138

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