Class: Urbanairship::Common::PageIterator

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Urbanairship::Common, Loggable
Defined in:
lib/urbanairship/common.rb

Constant Summary

Constants included from Urbanairship::Common

CONTENT_TYPE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loggable

create_logger, logger, #logger

Methods included from Urbanairship::Common

#apid_path, #channel_path, #compact_helper, #create_and_send_path, #custom_events_path, #device_token_path, #experiments_path, #lists_path, #named_users_path, #open_channel_path, #pipelines_path, #push_path, #reports_path, #required, #schedules_path, #segments_path, #tag_lists_path, #try_helper

Constructor Details

#initialize(client: required('client')) ⇒ PageIterator

Returns a new instance of PageIterator.



160
161
162
163
164
165
166
167
# File 'lib/urbanairship/common.rb', line 160

def initialize(client: required('client'))
  @client = client
  @count = 0
  @data_attribute = nil
  @data_list = nil
  @next_page_path = nil
  @next_page_url = nil
end

Instance Attribute Details

#data_attributeObject

Returns the value of attribute data_attribute.



158
159
160
# File 'lib/urbanairship/common.rb', line 158

def data_attribute
  @data_attribute
end

Instance Method Details

#countObject



180
181
182
# File 'lib/urbanairship/common.rb', line 180

def count
  @count
end

#eachObject



169
170
171
172
173
174
175
176
177
178
# File 'lib/urbanairship/common.rb', line 169

def each
  while @next_page_path || @next_page_url
    load_page

    @data_list.each do |value|
      @count += 1
      yield value
    end
  end
end