Class: Freeclimb::TranscribeWebhook

Inherits:
Webhook
  • Object
show all
Defined in:
lib/freeclimb/models/transcribe_webhook.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Webhook

openapi_discriminator_name

Constructor Details

#initialize(attributes = {}) ⇒ TranscribeWebhook

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 191

def initialize(attributes = {})
  if !attributes.is_a?(Hash)
    fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::TranscribeWebhook` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if !self.class.attribute_map.key?(k.to_sym)
      fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::TranscribeWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  # call parent's initialize
  super

  if attributes.key?(:request_type)
    self.request_type = attributes[:request_type]
  end

  if attributes.key?(:account_id)
    self. = attributes[:account_id]
  end

  if attributes.key?(:call_id)
    self.call_id = attributes[:call_id]
  end

  if attributes.key?(:from)
    self.from = attributes[:from]
  end

  if attributes.key?(:to)
    self.to = attributes[:to]
  end

  if attributes.key?(:recording_id)
    self.recording_id = attributes[:recording_id]
  end

  if attributes.key?(:recording_url)
    self.recording_url = attributes[:recording_url]
  end

  if attributes.key?(:recording_size)
    self.recording_size = attributes[:recording_size]
  end

  if attributes.key?(:recording_format)
    self.recording_format = attributes[:recording_format]
  end

  if attributes.key?(:recording_duration_ms)
    self.recording_duration_ms = attributes[:recording_duration_ms]
  end

  if attributes.key?(:term_reason)
    self.term_reason = attributes[:term_reason]
  end

  if attributes.key?(:record_term_reason)
    self.record_term_reason = attributes[:record_term_reason]
  end

  if attributes.key?(:digit)
    self.digit = attributes[:digit]
  end

  if attributes.key?(:privacy_for_logging)
    self.privacy_for_logging = attributes[:privacy_for_logging]
  end

  if attributes.key?(:privacy_for_recording)
    self.privacy_for_recording = attributes[:privacy_for_recording]
  end

  if attributes.key?(:barge_in_reason)
    self.barge_in_reason = attributes[:barge_in_reason]
  end

  if attributes.key?(:barged_in_prompt_no)
    self.barged_in_prompt_no = attributes[:barged_in_prompt_no]
  end

  if attributes.key?(:barged_in_prompt_ms)
    self.barged_in_prompt_ms = attributes[:barged_in_prompt_ms]
  end

  if attributes.key?(:barged_in_prompt_loop_no)
    self.barged_in_prompt_loop_no = attributes[:barged_in_prompt_loop_no]
  end

  if attributes.key?(:barge_in_time_ms)
    self.barge_in_time_ms = attributes[:barge_in_time_ms]
  end

  if attributes.key?(:transcript)
    self.transcript = attributes[:transcript]
  end

  if attributes.key?(:transcribe_reason)
    self.transcribe_reason = attributes[:transcribe_reason]
  end

  if attributes.key?(:transcription_duration_ms)
    self.transcription_duration_ms = attributes[:transcription_duration_ms]
  end
end

Instance Attribute Details

#account_idObject

Account ID associated with your account.



27
28
29
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 27

def 
  @account_id
end

#barge_in_reasonObject

Returns the value of attribute barge_in_reason.



66
67
68
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 66

def barge_in_reason
  @barge_in_reason
end

#barge_in_time_msObject

epoch time in ms



76
77
78
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 76

def barge_in_time_ms
  @barge_in_time_ms
end

#barged_in_prompt_loop_noObject

Returns the value of attribute barged_in_prompt_loop_no.



73
74
75
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 73

def barged_in_prompt_loop_no
  @barged_in_prompt_loop_no
end

#barged_in_prompt_msObject

duration in ms bargedInPromptNo prompt was executing until barge-in occurred.



71
72
73
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 71

def barged_in_prompt_ms
  @barged_in_prompt_ms
end

#barged_in_prompt_noObject

Returns the value of attribute barged_in_prompt_no.



68
69
70
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 68

def barged_in_prompt_no
  @barged_in_prompt_no
end

#call_idObject

Unique identifier for this Call, generated by FreeClimb



30
31
32
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 30

def call_id
  @call_id
end

#digitObject

If recordTermReason is digit, this will be the digit that was pressed. Otherwise it will be null.



58
59
60
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 58

def digit
  @digit
end

#fromObject

Phone number of the party that initiated the Call (in E.164 format).



33
34
35
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 33

def from
  @from
end

#privacy_for_loggingObject

Echo back of the privacyForLogging flag as specified in the transcribe utterance command – confirmation of logging protection has been applied. Can be used by application to know it should also apply protection when handling this request.



61
62
63
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 61

def privacy_for_logging
  @privacy_for_logging
end

#privacy_for_recordingObject

Echo back of the privacyForRecording flag as specified in the transcribe utterance command – confirmation of logging protection has been applied. Can be used by application to know it should also apply protection when handling this request.



64
65
66
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 64

def privacy_for_recording
  @privacy_for_recording
end

#record_term_reasonObject

Returns the value of attribute record_term_reason.



55
56
57
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 55

def record_term_reason
  @record_term_reason
end

#recording_duration_msObject

The duration of the recorded audio in milliseconds.



51
52
53
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 51

def recording_duration_ms
  @recording_duration_ms
end

#recording_formatObject

The media type of the recording.



48
49
50
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 48

def recording_format
  @recording_format
end

#recording_idObject

The ID of the recording. If no recording was made due to errors or the ‘saveRecording’ flag being disabled this field will be set to null.



39
40
41
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 39

def recording_id
  @recording_id
end

#recording_sizeObject

The size of the recording in bytes.



45
46
47
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 45

def recording_size
  @recording_size
end

#recording_urlObject

The URL of the recorded audio file. This URL can be used as is in a Play command to play the recording (no authentication needed). It can also be used to download the recording file via the REST API.



42
43
44
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 42

def recording_url
  @recording_url
end

#request_typeObject

The context or reason why this request is being made. Will be transcribe - The TranscribeUtterance command has completed and its actionUrl is being invoked.



24
25
26
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 24

def request_type
  @request_type
end

#term_reasonObject

Returns the value of attribute term_reason.



53
54
55
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 53

def term_reason
  @term_reason
end

#toObject

Phone number provisioned to the customer and to which this Call is directed (in E.164 format).



36
37
38
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 36

def to
  @to
end

#transcribe_reasonObject

Returns the value of attribute transcribe_reason.



81
82
83
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 81

def transcribe_reason
  @transcribe_reason
end

#transcriptObject

Transcribed text of the recording. Can be empty or null. null means there was a failure in transcribing the audio, refer to transcribeReason for detailed failure reason.



79
80
81
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 79

def transcript
  @transcript
end

#transcription_duration_msObject

The duration of the audio being transcribed in milliseconds



84
85
86
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 84

def transcription_duration_ms
  @transcription_duration_ms
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about, including the ones defined in its parent(s)



138
139
140
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 138

def self.acceptable_attributes
  attribute_map.values.concat(superclass.acceptable_attributes)
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
134
135
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 109

def self.attribute_map
  {
    request_type: :requestType,
    account_id: :accountId,
    call_id: :callId,
    from: :from,
    to: :to,
    recording_id: :recordingId,
    recording_url: :recordingUrl,
    recording_size: :recordingSize,
    recording_format: :recordingFormat,
    recording_duration_ms: :recordingDurationMs,
    term_reason: :termReason,
    record_term_reason: :recordTermReason,
    digit: :digit,
    privacy_for_logging: :privacyForLogging,
    privacy_for_recording: :privacyForRecording,
    barge_in_reason: :bargeInReason,
    barged_in_prompt_no: :bargedInPromptNo,
    barged_in_prompt_ms: :bargedInPromptMs,
    barged_in_prompt_loop_no: :bargedInPromptLoopNo,
    barge_in_time_ms: :bargeInTimeMs,
    transcript: :transcript,
    transcribe_reason: :transcribeReason,
    transcription_duration_ms: :transcriptionDurationMs
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



361
362
363
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 361

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.deserialize(payload) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 16

def self.deserialize(payload)
  return nil if payload.nil? || payload.empty?
  data = JSON.parse("[#{payload}]")[0]
  inverted_attributes = attribute_map.invert
  hash = acceptable_attributes.uniq.map { |k| [inverted_attributes[k], data[k.to_s]] }.to_h
  TranscribeWebhook.new(hash)
end

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



183
184
185
186
187
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 183

def self.openapi_all_of
  [
    :Webhook
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



172
173
174
175
176
177
178
179
180
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 172

def self.openapi_nullable
  Set.new([
    :recording_id,
    :recording_url,
    :recording_format,
    :digit,
    :transcript
  ])
end

.openapi_typesObject

Attribute type mapping.



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 143

def self.openapi_types
  {
    request_type: :String,
    account_id: :String,
    call_id: :String,
    from: :String,
    to: :String,
    recording_id: :String,
    recording_url: :String,
    recording_size: :Integer,
    recording_format: :String,
    recording_duration_ms: :Integer,
    term_reason: :TranscribeTermReason,
    record_term_reason: :RecordUtteranceTermReason,
    digit: :String,
    privacy_for_logging: :Boolean,
    privacy_for_recording: :Boolean,
    barge_in_reason: :BargeInReason,
    barged_in_prompt_no: :Integer,
    barged_in_prompt_ms: :Integer,
    barged_in_prompt_loop_no: :Integer,
    barge_in_time_ms: :Integer,
    transcript: :String,
    transcribe_reason: :TranscribeReason,
    transcription_duration_ms: :Integer
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 318

def ==(other)
  return true if equal?(other)
  self.class == other.class &&
    request_type == other.request_type &&
     == other. &&
    call_id == other.call_id &&
    from == other.from &&
    to == other.to &&
    recording_id == other.recording_id &&
    recording_url == other.recording_url &&
    recording_size == other.recording_size &&
    recording_format == other.recording_format &&
    recording_duration_ms == other.recording_duration_ms &&
    term_reason == other.term_reason &&
    record_term_reason == other.record_term_reason &&
    digit == other.digit &&
    privacy_for_logging == other.privacy_for_logging &&
    privacy_for_recording == other.privacy_for_recording &&
    barge_in_reason == other.barge_in_reason &&
    barged_in_prompt_no == other.barged_in_prompt_no &&
    barged_in_prompt_ms == other.barged_in_prompt_ms &&
    barged_in_prompt_loop_no == other.barged_in_prompt_loop_no &&
    barge_in_time_ms == other.barge_in_time_ms &&
    transcript == other.transcript &&
    transcribe_reason == other.transcribe_reason &&
    transcription_duration_ms == other.transcription_duration_ms && super
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 392

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Freeclimb.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 463

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 368

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  super
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      send(:"#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        send(:"#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      send(:"#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


348
349
350
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 348

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



354
355
356
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 354

def hash
  [request_type, , call_id, from, to, recording_id, recording_url, recording_size, recording_format, recording_duration_ms, term_reason, record_term_reason, digit, privacy_for_logging, privacy_for_recording, barge_in_reason, barged_in_prompt_no, barged_in_prompt_ms, barged_in_prompt_loop_no, barge_in_time_ms, transcript, transcribe_reason, transcription_duration_ms].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



302
303
304
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 302

def list_invalid_properties
  super
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



439
440
441
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 439

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 445

def to_hash
  hash = super
  self.class.attribute_map.each_pair do |attr, param|
    value = send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



433
434
435
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 433

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



308
309
310
311
312
313
314
# File 'lib/freeclimb/models/transcribe_webhook.rb', line 308

def valid?
  if @request_type.nil?
    false
  else
    list_invalid_properties.length == 0
  end
end