lib/collective/collectors/newrelic.rb
def paged(path, json_key, max_pages=3)
      Enumerator.new do |yielder|
        page = 1
        resp = get path, page: page
        while resp.body[json_key].length > 0 && page <= max_pages do
          resp.body[json_key].each { |obj| yielder.yield obj }
          page += 1
          resp = get path, page: page
        end
      end
    end
# Pages through items specified by `json_key` and yields them one at a time
Pages through items specified by `json_key` and yields them one at a time
Pages through items specified by ` json_key ` and yields them one at a time
def paged(path, json_key, max_pages=3)
      Enumerator.new do |yielder|
        page = 1
        resp = get path, page: page
        while resp.body[json_key].length > 0 && page <= max_pages do
          resp.body[json_key].each { |obj| yielder.yield obj }
          page += 1
          resp = get path, page: page
        end
      end
    end
def paged ( path , json_key , max_pages = 3 ) Enumerator . new do | yielder | page = 1 resp = get path , page : page while resp . body [ json_key ] . length > 0 && page <= max_pages do resp . body [ json_key ] . each { | obj | yielder . yield obj } page += 1 resp = get path , page : page end end end
Pages through items specified by `json_key` and yields them one at a time
Pages through items specified by ` json_key ` and yields them one at a time
path
json_key
max_pages