Class: Twilio::REST::Version::RecordStream
- Inherits:
-
Object
- Object
- Twilio::REST::Version::RecordStream
- Includes:
- Enumerable
- Defined in:
- lib/twilio-ruby/framework/rest/version.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(page, limit: nil, page_limit: nil) ⇒ RecordStream
constructor
A new instance of RecordStream.
Constructor Details
#initialize(page, limit: nil, page_limit: nil) ⇒ RecordStream
Returns a new instance of RecordStream.
11 12 13 14 15 |
# File 'lib/twilio-ruby/framework/rest/version.rb', line 11 def initialize(page, limit: nil, page_limit: nil) @page = page @limit = limit @page_limit = page_limit end |
Instance Method Details
#each ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/twilio-ruby/framework/rest/version.rb', line 17 def each current_record = 0 current_page = 1 while @page @page.each do |record| yield record current_record += 1 return nil if @limit && @limit <= current_record end return nil if @page_limit && @page_limit <= current_page @page = @page.next_page current_page += 1 end end |