Class: Twilio::REST::Api::V2010::AccountContext::CallList
- Inherits:
-
ListResource
- Object
- ListResource
- Twilio::REST::Api::V2010::AccountContext::CallList
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/call.rb
Instance Method Summary collapse
-
#create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, recording_configuration_id: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, passports: :unset, byoc: :unset, call_reason: :unset, call_token: :unset, recording_track: :unset, time_limit: :unset, client_notification_url: :unset, url: :unset, twiml: :unset, application_sid: :unset) ⇒ CallInstance
Create the CallInstance.
-
#create_with_metadata(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, recording_configuration_id: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, passports: :unset, byoc: :unset, call_reason: :unset, call_token: :unset, recording_track: :unset, time_limit: :unset, client_notification_url: :unset, url: :unset, twiml: :unset, application_sid: :unset) ⇒ CallInstance
Create the CallInstanceMetadata.
-
#each ⇒ Object
When passed a block, yields CallInstance records from the API.
-
#get_page(target_url) ⇒ Page
Retrieve a single page of CallInstance records from the API.
-
#initialize(version, account_sid: nil) ⇒ CallList
constructor
Initialize the CallList.
-
#list(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Array
Lists CallInstance records from the API as a list.
-
#list_with_metadata(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Array
Array of up to limit results.
-
#page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page
Retrieve a single page of CallInstance records from the API.
-
#stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams Instance records from the API as an Enumerable.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, account_sid: nil) ⇒ CallList
Initialize the CallList
28 29 30 31 32 33 34 35 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 28 def initialize(version, account_sid: nil) super(version) # Path Solution @solution = { account_sid: account_sid } @uri = "/Accounts/#{@solution[:account_sid]}/Calls.json" end |
Instance Method Details
#create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, recording_configuration_id: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, passports: :unset, byoc: :unset, call_reason: :unset, call_token: :unset, recording_track: :unset, time_limit: :unset, client_notification_url: :unset, url: :unset, twiml: :unset, application_sid: :unset) ⇒ CallInstance
Create the CallInstance
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 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 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 168 169 170 171 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 77 def create( to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, recording_configuration_id: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, passports: :unset, byoc: :unset, call_reason: :unset, call_token: :unset, recording_track: :unset, time_limit: :unset, client_notification_url: :unset, url: :unset, twiml: :unset, application_sid: :unset ) data = Twilio::Values.of({ 'To' => to, 'From' => from, 'Method' => method, 'FallbackUrl' => fallback_url, 'FallbackMethod' => fallback_method, 'StatusCallback' => status_callback, 'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e }, 'StatusCallbackMethod' => status_callback_method, 'SendDigits' => send_digits, 'Timeout' => timeout, 'Record' => record, 'RecordingChannels' => recording_channels, 'RecordingStatusCallback' => recording_status_callback, 'RecordingStatusCallbackMethod' => recording_status_callback_method, 'RecordingConfigurationId' => recording_configuration_id, 'SipAuthUsername' => sip_auth_username, 'SipAuthPassword' => sip_auth_password, 'MachineDetection' => machine_detection, 'MachineDetectionTimeout' => machine_detection_timeout, 'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e }, 'Trim' => trim, 'CallerId' => caller_id, 'MachineDetectionSpeechThreshold' => machine_detection_speech_threshold, 'MachineDetectionSpeechEndThreshold' => machine_detection_speech_end_threshold, 'MachineDetectionSilenceTimeout' => machine_detection_silence_timeout, 'AsyncAmd' => async_amd, 'AsyncAmdStatusCallback' => async_amd_status_callback, 'AsyncAmdStatusCallbackMethod' => async_amd_status_callback_method, 'Passports' => passports, 'Byoc' => byoc, 'CallReason' => call_reason, 'CallToken' => call_token, 'RecordingTrack' => recording_track, 'TimeLimit' => time_limit, 'ClientNotificationUrl' => client_notification_url, 'Url' => url, 'Twiml' => twiml, 'ApplicationSid' => application_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.create('POST', @uri, data: data, headers: headers) CallInstance.new( @version, payload, account_sid: @solution[:account_sid], ) end |
#create_with_metadata(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, recording_configuration_id: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, passports: :unset, byoc: :unset, call_reason: :unset, call_token: :unset, recording_track: :unset, time_limit: :unset, client_notification_url: :unset, url: :unset, twiml: :unset, application_sid: :unset) ⇒ CallInstance
Create the CallInstanceMetadata
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 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 214 def ( to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, recording_configuration_id: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, passports: :unset, byoc: :unset, call_reason: :unset, call_token: :unset, recording_track: :unset, time_limit: :unset, client_notification_url: :unset, url: :unset, twiml: :unset, application_sid: :unset ) data = Twilio::Values.of({ 'To' => to, 'From' => from, 'Method' => method, 'FallbackUrl' => fallback_url, 'FallbackMethod' => fallback_method, 'StatusCallback' => status_callback, 'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e }, 'StatusCallbackMethod' => status_callback_method, 'SendDigits' => send_digits, 'Timeout' => timeout, 'Record' => record, 'RecordingChannels' => recording_channels, 'RecordingStatusCallback' => recording_status_callback, 'RecordingStatusCallbackMethod' => recording_status_callback_method, 'RecordingConfigurationId' => recording_configuration_id, 'SipAuthUsername' => sip_auth_username, 'SipAuthPassword' => sip_auth_password, 'MachineDetection' => machine_detection, 'MachineDetectionTimeout' => machine_detection_timeout, 'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e }, 'Trim' => trim, 'CallerId' => caller_id, 'MachineDetectionSpeechThreshold' => machine_detection_speech_threshold, 'MachineDetectionSpeechEndThreshold' => machine_detection_speech_end_threshold, 'MachineDetectionSilenceTimeout' => machine_detection_silence_timeout, 'AsyncAmd' => async_amd, 'AsyncAmdStatusCallback' => async_amd_status_callback, 'AsyncAmdStatusCallbackMethod' => async_amd_status_callback_method, 'Passports' => passports, 'Byoc' => byoc, 'CallReason' => call_reason, 'CallToken' => call_token, 'RecordingTrack' => recording_track, 'TimeLimit' => time_limit, 'ClientNotificationUrl' => client_notification_url, 'Url' => url, 'Twiml' => twiml, 'ApplicationSid' => application_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) call_instance = CallInstance.new( @version, response.body, account_sid: @solution[:account_sid], ) CallInstanceMetadata.new( @version, call_instance, response.headers, response.status_code ) end |
#each ⇒ Object
When passed a block, yields CallInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 445 def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) return [].each if page.nil? result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) return [].each if result.nil? result.each {|x| yield x} end |
#get_page(target_url) ⇒ Page
Retrieve a single page of CallInstance records from the API. Request is executed immediately.
506 507 508 509 510 511 512 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 506 def get_page(target_url) response = @version.domain.request( 'GET', target_url ) CallPage.new(@version, response, @solution) end |
#list(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Array
Lists CallInstance records from the API as a list.
Unlike stream(), this operation is eager and will load limit records into
memory before returning.
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 338 def list(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) self.stream( to: to, from: from, parent_call_sid: parent_call_sid, status: status, start_time: start_time, start_time_before: start_time_before, start_time_after: start_time_after, end_time: end_time, end_time_before: end_time_before, end_time_after: end_time_after, limit: limit, page_size: page_size ).entries end |
#list_with_metadata(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Array
Returns Array of up to limit results.
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 418 def (to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) params = Twilio::Values.of({ 'To' => to, 'From' => from, 'ParentCallSid' => parent_call_sid, 'Status' => status, 'StartTime' => Twilio.serialize_iso8601_datetime(start_time), 'StartTime<' => Twilio.serialize_iso8601_datetime(start_time_before), 'StartTime>' => Twilio.serialize_iso8601_datetime(start_time_after), 'EndTime' => Twilio.serialize_iso8601_datetime(end_time), 'EndTime<' => Twilio.serialize_iso8601_datetime(end_time_before), 'EndTime>' => Twilio.serialize_iso8601_datetime(end_time_after), 'PageSize' => limits[:page_size], }); headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) CallPageMetadata.new(@version, response, @solution, limits[:limit]) end |
#page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page
Retrieve a single page of CallInstance records from the API. Request is executed immediately.
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 476 def page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, page_token: :unset, page_number: :unset,page_size: :unset) params = Twilio::Values.of({ 'To' => to, 'From' => from, 'ParentCallSid' => parent_call_sid, 'Status' => status, 'StartTime' => Twilio.serialize_iso8601_datetime(start_time), 'StartTime<' => Twilio.serialize_iso8601_datetime(start_time_before), 'StartTime>' => Twilio.serialize_iso8601_datetime(start_time_after), 'EndTime' => Twilio.serialize_iso8601_datetime(end_time), 'EndTime<' => Twilio.serialize_iso8601_datetime(end_time_before), 'EndTime>' => Twilio.serialize_iso8601_datetime(end_time_after), 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) CallPage.new(@version, response, @solution) end |
#stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams Instance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 376 def stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( to: to, from: from, parent_call_sid: parent_call_sid, status: status, start_time: start_time, start_time_before: start_time_before, start_time_after: start_time_after, end_time: end_time, end_time_before: end_time_before, end_time_after: end_time_after, page_size: limits[:page_size], ) return [].each if page.nil? result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) return [].each if result.nil? result end |
#to_s ⇒ Object
Provide a user friendly representation
517 518 519 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 517 def to_s '#<Twilio.Api.V2010.CallList>' end |