Sha256: d1f796ecff1ca6a3f9edb8b1b793235f3cb87287ebf000cb9210a95726f23135
Contents?: true
Size: 628 Bytes
Versions: 4
Compression:
Stored size: 628 Bytes
Contents
module EsHttpClient class Page def initialize(body) @body = body end def last find_link('last') end def previous find_link('previous') end def has_entries? @body['entries'] && @body['entries'].length > 0 end def each_event(&block) @body['entries'] .reverse! .map {|e| Event.load_from(e)} .compact .select {|e| e.type !~ /^\$/ } .each {|e| yield e } end private def find_link(rel) link = @body['links'].detect { |l| l['relation'] == rel } link.nil? ? nil : link['uri'] end end end
Version data entries
4 entries across 4 versions & 1 rubygems