module Cloudflare::Paginate
Public Instance Methods
each(page: 1, per_page: 50, **parameters) { |represent(metadata, attributes)| ... }
click to toggle source
# File lib/cloudflare/paginate.rb, line 11 def each(page: 1, per_page: 50, **parameters) return to_enum(:each, page: page, per_page: per_page, **parameters) unless block_given? while true resource = @resource.with(parameters: {page: page, per_page: per_page, **parameters}) response = self.class.get(resource) break if response.empty? response.results.each do |attributes| yield represent(response.metadata, attributes) end page += 1 # Was this the last page? break if response.results.size < per_page end end
empty?()
click to toggle source
# File lib/cloudflare/paginate.rb, line 32 def empty? self.value.empty? end
find_by_id(id)
click to toggle source
# File lib/cloudflare/paginate.rb, line 36 def find_by_id(id) representation.new(@resource.with(path: "#{id}/")) end