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,
lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb
Defined Under Namespace
Classes: FeedbackSummaryContext, FeedbackSummaryInstance, FeedbackSummaryList, FeedbackSummaryPage
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, 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, byoc: :unset, call_reason: :unset, url: :unset, twiml: :unset, application_sid: :unset) ⇒ CallInstance
Create the CallInstance.
-
#each ⇒ Object
When passed a block, yields CallInstance records from the API.
-
#feedback_summaries(sid = :unset) ⇒ FeedbackSummaryList, FeedbackSummaryContext
Access the feedback_summaries.
-
#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_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Array
Lists CallInstance records from the API as a list.
-
#page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :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_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams CallInstance 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
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 22 def initialize(version, account_sid: nil) super(version) # Path Solution @solution = {account_sid: account_sid} @uri = "/Accounts/#{@solution[:account_sid]}/Calls.json" # Components @feedback_summaries = nil 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, 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, byoc: :unset, call_reason: :unset, url: :unset, twiml: :unset, application_sid: :unset) ⇒ CallInstance
Create the CallInstance
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 155 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, 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, byoc: :unset, call_reason: :unset, url: :unset, twiml: :unset, application_sid: :unset) data = Twilio::Values.of({ 'To' => to, 'From' => from, 'Url' => url, 'Twiml' => twiml, 'ApplicationSid' => application_sid, '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, '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, 'Byoc' => byoc, 'CallReason' => call_reason, }) payload = @version.create('POST', @uri, data: data) CallInstance.new(@version, payload, account_sid: @solution[:account_sid], ) 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.
289 290 291 292 293 294 295 296 297 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 289 def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]).each {|x| yield x} end |
#feedback_summaries(sid = :unset) ⇒ FeedbackSummaryList, FeedbackSummaryContext
Access the feedback_summaries
362 363 364 365 366 367 368 369 370 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 362 def feedback_summaries(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return FeedbackSummaryContext.new(@version, @solution[:account_sid], sid, ) end @feedback_summaries ||= FeedbackSummaryList.new(@version, account_sid: @solution[:account_sid], ) end |
#get_page(target_url) ⇒ Page
Retrieve a single page of CallInstance records from the API. Request is executed immediately.
348 349 350 351 352 353 354 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 348 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_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :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.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 222 def list(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :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_before: start_time_before, start_time: start_time, start_time_after: start_time_after, end_time_before: end_time_before, end_time: end_time, end_time_after: end_time_after, limit: limit, page_size: page_size ).entries end |
#page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :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.
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 321 def page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :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_before), 'StartTime' => Twilio.serialize_iso8601_datetime(start_time), 'StartTime>' => Twilio.serialize_iso8601_datetime(start_time_after), 'EndTime<' => Twilio.serialize_iso8601_datetime(end_time_before), 'EndTime' => Twilio.serialize_iso8601_datetime(end_time), 'EndTime>' => Twilio.serialize_iso8601_datetime(end_time_after), 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) response = @version.page('GET', @uri, params: params) CallPage.new(@version, response, @solution) end |
#stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :unset, end_time_after: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams CallInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 265 def stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time_before: :unset, start_time: :unset, start_time_after: :unset, end_time_before: :unset, end_time: :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_before: start_time_before, start_time: start_time, start_time_after: start_time_after, end_time_before: end_time_before, end_time: end_time, end_time_after: end_time_after, page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end |
#to_s ⇒ Object
Provide a user friendly representation
374 375 376 |
# File 'lib/twilio-ruby/rest/api/v2010/account/call.rb', line 374 def to_s '#<Twilio.Api.V2010.CallList>' end |