Sha256: a60d53d5e91c3ac872d24a4ee57686a8e667debc54c5107489421a75b68c0207
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
module FieldView class ListObject < Requestable attr_accessor :limit attr_reader :data, :last_http_status, :next_token, :listable include Enumerable def initialize(listable, auth_token, data, http_status, next_token: nil, limit: 100) @listable = listable @data = data @last_http_status = http_status @next_token = next_token @limit = 100 super(auth_token) end def each(&blk) self.data.each(&blk) end def next_page!() return if !self.more_pages?() new_list = @listable.list(auth_token, limit: self.limit, next_token: self.next_token) initialize(new_list.listable, new_list.auth_token, new_list.data, new_list.last_http_status, next_token: new_list.next_token, limit: new_list.limit) end # alias for more_pages def has_more?() return self.more_pages?() end def more_pages?() return Util.http_status_is_more_in_list?(self.last_http_status) end def restart!() @last_http_status = nil @next_token = nil next_page!() end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fieldview-0.0.6 | lib/fieldview/list_object.rb |
fieldview-0.0.5 | lib/fieldview/list_object.rb |
fieldview-0.0.3 | lib/fieldview/list_object.rb |
fieldview-0.0.2 | lib/fieldview/list_object.rb |