class EsHttpClient::Page
Public Class Methods
new(body)
click to toggle source
# File lib/es_http_client/page.rb, line 5 def initialize(body) @body = body end
Public Instance Methods
each_event() { |e| ... }
click to toggle source
# File lib/es_http_client/page.rb, line 21 def each_event(&block) @body['entries'] .reverse! .map {|e| Event.load_from(e)} .compact .select {|e| e.type !~ /^\$/ } .each {|e| yield e } end
has_entries?()
click to toggle source
# File lib/es_http_client/page.rb, line 17 def has_entries? @body['entries'] && @body['entries'].length > 0 end
last()
click to toggle source
# File lib/es_http_client/page.rb, line 9 def last find_link('last') end
previous()
click to toggle source
# File lib/es_http_client/page.rb, line 13 def previous find_link('previous') end
Private Instance Methods
find_link(rel)
click to toggle source
# File lib/es_http_client/page.rb, line 32 def find_link(rel) link = @body['links'].detect { |l| l['relation'] == rel } link.nil? ? nil : link['uri'] end