class Twilio::REST::Api::V2010::AccountContext::CallContext::NotificationList

Public Class Methods

new(version, account_sid: nil, call_sid: nil) click to toggle source

Initialize the NotificationList @param [Version] version Version that contains the resource @param [String] account_sid The SID of the

{Account}[https://www.twilio.com/docs/iam/api/account] that created the Call
Notification resource.

@param [String] call_sid The SID of the

{Call}[https://www.twilio.com/docs/voice/api/call-resource] the Call
Notification resource is associated with.

@return [NotificationList] NotificationList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/api/v2010/account/call/notification.rb
26 def initialize(version, account_sid: nil, call_sid: nil)
27   super(version)
28 
29   # Path Solution
30   @solution = {account_sid: account_sid, call_sid: call_sid}
31   @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Notifications.json"
32 end

Public Instance Methods

each() { |x| ... } click to toggle source

When passed a block, yields NotificationInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.

    # File lib/twilio-ruby/rest/api/v2010/account/call/notification.rb
 97 def each
 98   limits = @version.read_limits
 99 
100   page = self.page(page_size: limits[:page_size], )
101 
102   @version.stream(page,
103                   limit: limits[:limit],
104                   page_limit: limits[:page_limit]).each {|x| yield x}
105 end
get_page(target_url) click to toggle source

Retrieve a single page of NotificationInstance records from the API. Request is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page of NotificationInstance

    # File lib/twilio-ruby/rest/api/v2010/account/call/notification.rb
141 def get_page(target_url)
142   response = @version.domain.request(
143       'GET',
144       target_url
145   )
146   NotificationPage.new(@version, response, @solution)
147 end
list(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, limit: nil, page_size: nil) click to toggle source

Lists NotificationInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] log Only read notifications of the specified log level. Can be:

`0` to read only ERROR notifications or `1` to read only WARNING notifications.
By default, all notifications are read.

@param [Time] message_date_before Filter by date @param [Time] message_date Filter by date @param [Time] message_date_after Filter by date @param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit.  Default is no limit

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records.  If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Array] Array of up to limit results

   # File lib/twilio-ruby/rest/api/v2010/account/call/notification.rb
51 def list(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, limit: nil, page_size: nil)
52   self.stream(
53       log: log,
54       message_date_before: message_date_before,
55       message_date: message_date,
56       message_date_after: message_date_after,
57       limit: limit,
58       page_size: page_size
59   ).entries
60 end
page(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of NotificationInstance records from the API. Request is executed immediately. @param [String] log Only read notifications of the specified log level. Can be:

`0` to read only ERROR notifications or `1` to read only WARNING notifications.
By default, all notifications are read.

@param [Time] message_date_before Filter by date @param [Time] message_date Filter by date @param [Time] message_date_after Filter by date @param [String] page_token PageToken provided by the API @param [Integer] page_number Page Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page of NotificationInstance

    # File lib/twilio-ruby/rest/api/v2010/account/call/notification.rb
120 def page(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
121   params = Twilio::Values.of({
122       'Log' => log,
123       'MessageDate<' => Twilio.serialize_iso8601_date(message_date_before),
124       'MessageDate' => Twilio.serialize_iso8601_date(message_date),
125       'MessageDate>' => Twilio.serialize_iso8601_date(message_date_after),
126       'PageToken' => page_token,
127       'Page' => page_number,
128       'PageSize' => page_size,
129   })
130 
131   response = @version.page('GET', @uri, params: params)
132 
133   NotificationPage.new(@version, response, @solution)
134 end
stream(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, limit: nil, page_size: nil) click to toggle source

Streams NotificationInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] log Only read notifications of the specified log level. Can be:

`0` to read only ERROR notifications or `1` to read only WARNING notifications.
By default, all notifications are read.

@param [Time] message_date_before Filter by date @param [Time] message_date Filter by date @param [Time] message_date_after Filter by date @param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit. Default is no limit.

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records. If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Enumerable] Enumerable that will yield up to limit results

   # File lib/twilio-ruby/rest/api/v2010/account/call/notification.rb
79 def stream(log: :unset, message_date_before: :unset, message_date: :unset, message_date_after: :unset, limit: nil, page_size: nil)
80   limits = @version.read_limits(limit, page_size)
81 
82   page = self.page(
83       log: log,
84       message_date_before: message_date_before,
85       message_date: message_date,
86       message_date_after: message_date_after,
87       page_size: limits[:page_size],
88   )
89 
90   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
91 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/api/v2010/account/call/notification.rb
151 def to_s
152   '#<Twilio.Api.V2010.NotificationList>'
153 end