Class: Loggly::Event

Inherits:
RemoteModel show all
Defined in:
lib/loggly/models/event.rb

Constant Summary collapse

METADATA_KEYS =
{
  :total_count => :total_events,
  :current_page => :page,
}

Constants inherited from RemoteModel

RemoteModel::DEFAULT_RESOURCE_ATTRIBUTES

Instance Attribute Summary

Attributes included from RemoteModel::ClassMethods

#resource_attributes

Attributes inherited from Model

#attributes, #response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RemoteModel::ClassMethods

#all, #collection_name, #create!, #find, #index_method, #path_base, #path_ext, #prepare_params, #set_resource_attributes, #where

Methods inherited from Model

#to_hash, #to_json, #to_log

Methods included from Model::ClassMethods

#from_hash, #from_json

Methods included from Logging

#init_logger, #logger, #logger=

Constructor Details

#initialize(attributes = {}) ⇒ Event

Returns a new instance of Event.



18
19
20
# File 'lib/loggly/models/event.rb', line 18

def initialize(attributes = {})
  super
end

Class Method Details

.all(conditions = {}, options = {}, &callback) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/loggly/models/event.rb', line 22

def self.all(conditions = {}, options = {}, &callback)
  conditions[:order] ||= "desc"
  conditions[:from] ||= "-24h"
  conditions[:until] ||= "now"

  unless rsid = options[:rsid]
    search = Search.create!(conditions, options)
    rsid = search.attributes.id
  end

  super({:rsid => rsid}, options, &callback)
end