class Loggie::Logentries::Response

Attributes

events[R]
id[R]
leql[R]
logs[R]
progress[R]

Public Class Methods

new(response) click to toggle source
# File lib/loggie/logentries/response.rb, line 6
def initialize(response)
  data = JSON.parse response.read_body

  @logs = data["logs"]
  @links = data["links"]
  @leql = data["leql"]

  if data.key?("events") # 200
    @events = data["events"]
  else # 202 for a query that successfully started but has not yet finished
    @progress = data["progress"]
    @id = data["id"]
  end
end

Public Instance Methods

events?() click to toggle source
# File lib/loggie/logentries/response.rb, line 26
def events?
  !@events.nil?
end
next_url() click to toggle source
# File lib/loggie/logentries/response.rb, line 21
def next_url
  # res.fetch("links", [{}]).first.dig("href").gsub(/\?$/, '')
  links.first["href"]
end