Module: Splunker::Models::Finders::ClassMethods

Defined in:
lib/splunker/models/finders.rb

Instance Method Summary collapse

Instance Method Details

#find(*arguments) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/splunker/models/finders.rb', line 9

def find(*arguments)
  scope = arguments.slice!(0)
  options = arguments.slice!(0) || {}
  case scope
    when :all
      find_all(options)
    when :first 
      find_all(options).first
    else
      find_by_id(scope, options)
    end
end

#find_all(options = {}) ⇒ Object

Raises:

  • (NotImplemented)


22
23
24
25
# File 'lib/splunker/models/finders.rb', line 22

def find_all(options={})
  raise NotImplemented, "Not yet implemented!"
  self.client.get @service_path, options
end

#find_by_id(object_id, options = {}) ⇒ Object



27
28
29
30
# File 'lib/splunker/models/finders.rb', line 27

def find_by_id(object_id, options={})
  object_path = "#{@service_path}/#{escape_object_id(object_id)}"
  self.new(self.client.get(object_path, options))
end

#where(options = {}) ⇒ Object

Raises:

  • (NotImplemented)


4
5
6
7
# File 'lib/splunker/models/finders.rb', line 4

def where(options={})
  raise NotImplemented, "Not yet implemented!"
  find(:all, options)
end