Module: Zeus::LogsInterface

Includes:
RestInterface
Included in:
APIClient
Defined in:
lib/zeus/api_client/logs_interface.rb

Overview

Interface for dealing with logs api calls

Instance Method Summary collapse

Instance Method Details

#get_logs(name, options = {}) ⇒ Zeus::APIClient::Result

get logs

Parameters:

  • name (String)

    a log name

  • options (Hash) (defaults to: {})

    can contain: @param [String] attribute_name Name of the attribute within

    the log to be searched.
    

    @param [String] pattern a factor for filtering by name @param [String] from_date a factor for filtering by start timestamp @param [String] to_date a factor for filtering by end timestamp @param [Integer] offset a factor for filtering by metrics name @param [Integer] limit a maximum number of returning values

Returns:

  • (Zeus::APIClient::Result)


49
50
51
52
53
54
55
# File 'lib/zeus/api_client/logs_interface.rb', line 49

def get_logs(name, options = {})
  options[:log_name] = name
  response = get("/logs/#{@access_token}", options)
  Result.new(response)
rescue => e
  Result.new(e.response)
end

#send_logs(name, logs) ⇒ Zeus::APIClient::Result

send logs

Parameters:

  • name (String)

    a log name

  • logs (Array)

    a list of hash objects

Returns:

  • (Zeus::APIClient::Result)


28
29
30
31
32
33
34
35
36
# File 'lib/zeus/api_client/logs_interface.rb', line 28

def send_logs(name, logs)
  params = { logs: logs }
  begin
    response = post("/logs/#{@access_token}/#{name}/", params)
    Result.new(response)
  rescue => e
    Result.new(e.response)
  end
end