Class: Bandwidth::CallCallback

Inherits:
BaseModel show all
Defined in:
lib/bandwidth/voice_lib/voice/models/call_callback.rb

Overview

This object represents all possible fields that may be included in callbacks related to call events, including events that come from BXML verbs

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(event_type = nil, event_time = nil, account_id = nil, application_id = nil, from = nil, to = nil, direction = nil, call_id = nil, call_url = nil, start_time = nil, answer_time = nil, transfer_caller_id = nil, transfer_to = nil, cause = nil, error_message = nil, error_id = nil, end_time = nil, digit = nil, parent_call_id = nil, recording_id = nil, duration = nil, file_format = nil, media_url = nil, tag = nil, channels = nil, status = nil, digits = nil, terminating_digit = nil, transcription = nil, diversion = nil) ⇒ CallCallback



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
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 210

def initialize(event_type = nil,
               event_time = nil,
                = nil,
               application_id = nil,
               from = nil,
               to = nil,
               direction = nil,
               call_id = nil,
               call_url = nil,
               start_time = nil,
               answer_time = nil,
               transfer_caller_id = nil,
               transfer_to = nil,
               cause = nil,
               error_message = nil,
               error_id = nil,
               end_time = nil,
               digit = nil,
               parent_call_id = nil,
               recording_id = nil,
               duration = nil,
               file_format = nil,
               media_url = nil,
               tag = nil,
               channels = nil,
               status = nil,
               digits = nil,
               terminating_digit = nil,
               transcription = nil,
               diversion = nil)
  @event_type = event_type unless event_type == SKIP
  @event_time = event_time unless event_time == SKIP
  @account_id =  unless  == SKIP
  @application_id = application_id unless application_id == SKIP
  @from = from unless from == SKIP
  @to = to unless to == SKIP
  @direction = direction unless direction == SKIP
  @call_id = call_id unless call_id == SKIP
  @call_url = call_url unless call_url == SKIP
  @start_time = start_time unless start_time == SKIP
  @answer_time = answer_time unless answer_time == SKIP
  @transfer_caller_id = transfer_caller_id unless transfer_caller_id == SKIP
  @transfer_to = transfer_to unless transfer_to == SKIP
  @cause = cause unless cause == SKIP
  @error_message = error_message unless error_message == SKIP
  @error_id = error_id unless error_id == SKIP
  @end_time = end_time unless end_time == SKIP
  @digit = digit unless digit == SKIP
  @parent_call_id = parent_call_id unless parent_call_id == SKIP
  @recording_id = recording_id unless recording_id == SKIP
  @duration = duration unless duration == SKIP
  @file_format = file_format unless file_format == SKIP
  @media_url = media_url unless media_url == SKIP
  @tag = tag unless tag == SKIP
  @channels = channels unless channels == SKIP
  @status = status unless status == SKIP
  @digits = digits unless digits == SKIP
  @terminating_digit = terminating_digit unless terminating_digit == SKIP
  @transcription = transcription unless transcription == SKIP
  @diversion = diversion unless diversion == SKIP
end

Instance Attribute Details

#account_idString

TODO: Write general description for this method



23
24
25
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 23

def 
  @account_id
end

#answer_timeString

TODO: Write general description for this method



55
56
57
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 55

def answer_time
  @answer_time
end

#application_idString

TODO: Write general description for this method



27
28
29
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 27

def application_id
  @application_id
end

#call_idString

TODO: Write general description for this method



43
44
45
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 43

def call_id
  @call_id
end

#call_urlString

TODO: Write general description for this method



47
48
49
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 47

def call_url
  @call_url
end

#causeString

TODO: Write general description for this method



67
68
69
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 67

def cause
  @cause
end

#channelsInteger

TODO: Write general description for this method



111
112
113
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 111

def channels
  @channels
end

#digitString

TODO: Write general description for this method



83
84
85
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 83

def digit
  @digit
end

#digitsString

TODO: Write general description for this method



119
120
121
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 119

def digits
  @digits
end

#directionString

TODO: Write general description for this method



39
40
41
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 39

def direction
  @direction
end

#diversionDiversion

TODO: Write general description for this method



131
132
133
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 131

def diversion
  @diversion
end

#durationString

TODO: Write general description for this method



95
96
97
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 95

def duration
  @duration
end

#end_timeString

TODO: Write general description for this method



79
80
81
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 79

def end_time
  @end_time
end

#error_idString

TODO: Write general description for this method



75
76
77
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 75

def error_id
  @error_id
end

#error_messageString

TODO: Write general description for this method



71
72
73
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 71

def error_message
  @error_message
end

#event_timeString

TODO: Write general description for this method



19
20
21
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 19

def event_time
  @event_time
end

#event_typeString

TODO: Write general description for this method



15
16
17
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 15

def event_type
  @event_type
end

#file_formatString

TODO: Write general description for this method



99
100
101
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 99

def file_format
  @file_format
end

#fromString

TODO: Write general description for this method



31
32
33
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 31

def from
  @from
end

#media_urlString

TODO: Write general description for this method



103
104
105
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 103

def media_url
  @media_url
end

#parent_call_idString

TODO: Write general description for this method



87
88
89
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 87

def parent_call_id
  @parent_call_id
end

#recording_idString

TODO: Write general description for this method



91
92
93
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 91

def recording_id
  @recording_id
end

#start_timeString

TODO: Write general description for this method



51
52
53
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 51

def start_time
  @start_time
end

#statusString

TODO: Write general description for this method



115
116
117
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 115

def status
  @status
end

#tagString

TODO: Write general description for this method



107
108
109
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 107

def tag
  @tag
end

#terminating_digitString

TODO: Write general description for this method



123
124
125
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 123

def terminating_digit
  @terminating_digit
end

#toString

TODO: Write general description for this method



35
36
37
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 35

def to
  @to
end

#transcriptionTranscription

TODO: Write general description for this method



127
128
129
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 127

def transcription
  @transcription
end

#transfer_caller_idString

TODO: Write general description for this method



59
60
61
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 59

def transfer_caller_id
  @transfer_caller_id
end

#transfer_toString

TODO: Write general description for this method



63
64
65
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 63

def transfer_to
  @transfer_to
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 273

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
  event_time = hash.key?('eventTime') ? hash['eventTime'] : SKIP
   = hash.key?('accountId') ? hash['accountId'] : SKIP
  application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
  from = hash.key?('from') ? hash['from'] : SKIP
  to = hash.key?('to') ? hash['to'] : SKIP
  direction = hash.key?('direction') ? hash['direction'] : SKIP
  call_id = hash.key?('callId') ? hash['callId'] : SKIP
  call_url = hash.key?('callUrl') ? hash['callUrl'] : SKIP
  start_time = hash.key?('startTime') ? hash['startTime'] : SKIP
  answer_time = hash.key?('answerTime') ? hash['answerTime'] : SKIP
  transfer_caller_id =
    hash.key?('transferCallerId') ? hash['transferCallerId'] : SKIP
  transfer_to = hash.key?('transferTo') ? hash['transferTo'] : SKIP
  cause = hash.key?('cause') ? hash['cause'] : SKIP
  error_message = hash.key?('errorMessage') ? hash['errorMessage'] : SKIP
  error_id = hash.key?('errorId') ? hash['errorId'] : SKIP
  end_time = hash.key?('endTime') ? hash['endTime'] : SKIP
  digit = hash.key?('digit') ? hash['digit'] : SKIP
  parent_call_id = hash.key?('parentCallId') ? hash['parentCallId'] : SKIP
  recording_id = hash.key?('recordingId') ? hash['recordingId'] : SKIP
  duration = hash.key?('duration') ? hash['duration'] : SKIP
  file_format = hash.key?('fileFormat') ? hash['fileFormat'] : SKIP
  media_url = hash.key?('mediaUrl') ? hash['mediaUrl'] : SKIP
  tag = hash.key?('tag') ? hash['tag'] : SKIP
  channels = hash.key?('channels') ? hash['channels'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  digits = hash.key?('digits') ? hash['digits'] : SKIP
  terminating_digit =
    hash.key?('terminatingDigit') ? hash['terminatingDigit'] : SKIP
  transcription = Transcription.from_hash(hash['transcription']) if hash['transcription']
  diversion = Diversion.from_hash(hash['diversion']) if hash['diversion']

  # Create object from extracted values.

  CallCallback.new(event_type,
                   event_time,
                   ,
                   application_id,
                   from,
                   to,
                   direction,
                   call_id,
                   call_url,
                   start_time,
                   answer_time,
                   transfer_caller_id,
                   transfer_to,
                   cause,
                   error_message,
                   error_id,
                   end_time,
                   digit,
                   parent_call_id,
                   recording_id,
                   duration,
                   file_format,
                   media_url,
                   tag,
                   channels,
                   status,
                   digits,
                   terminating_digit,
                   transcription,
                   diversion)
end

.namesObject

A mapping from model property names to API property names.



134
135
136
137
138
139
140
141
142
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
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 134

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['event_type'] = 'eventType'
  @_hash['event_time'] = 'eventTime'
  @_hash['account_id'] = 'accountId'
  @_hash['application_id'] = 'applicationId'
  @_hash['from'] = 'from'
  @_hash['to'] = 'to'
  @_hash['direction'] = 'direction'
  @_hash['call_id'] = 'callId'
  @_hash['call_url'] = 'callUrl'
  @_hash['start_time'] = 'startTime'
  @_hash['answer_time'] = 'answerTime'
  @_hash['transfer_caller_id'] = 'transferCallerId'
  @_hash['transfer_to'] = 'transferTo'
  @_hash['cause'] = 'cause'
  @_hash['error_message'] = 'errorMessage'
  @_hash['error_id'] = 'errorId'
  @_hash['end_time'] = 'endTime'
  @_hash['digit'] = 'digit'
  @_hash['parent_call_id'] = 'parentCallId'
  @_hash['recording_id'] = 'recordingId'
  @_hash['duration'] = 'duration'
  @_hash['file_format'] = 'fileFormat'
  @_hash['media_url'] = 'mediaUrl'
  @_hash['tag'] = 'tag'
  @_hash['channels'] = 'channels'
  @_hash['status'] = 'status'
  @_hash['digits'] = 'digits'
  @_hash['terminating_digit'] = 'terminatingDigit'
  @_hash['transcription'] = 'transcription'
  @_hash['diversion'] = 'diversion'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



206
207
208
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 206

def nullables
  []
end

#optionalsObject

An array for optional fields



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/bandwidth/voice_lib/voice/models/call_callback.rb', line 170

def optionals
  %w[
    event_type
    event_time
    account_id
    application_id
    from
    to
    direction
    call_id
    call_url
    start_time
    answer_time
    transfer_caller_id
    transfer_to
    cause
    error_message
    error_id
    end_time
    digit
    parent_call_id
    recording_id
    duration
    file_format
    media_url
    tag
    channels
    status
    digits
    terminating_digit
    transcription
    diversion
  ]
end