Module: Splunker::Models::Finders::ClassMethods
- Defined in:
- lib/splunker/models/finders.rb
Instance Method Summary collapse
- #find(*arguments) ⇒ Object
- #find_all(options = {}) ⇒ Object
- #find_by_id(object_id, options = {}) ⇒ Object
- #where(options = {}) ⇒ Object
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) = arguments.slice!(0) || {} case scope when :all find_all() when :first find_all().first else find_by_id(scope, ) end end |
#find_all(options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/splunker/models/finders.rb', line 22 def find_all(={}) raise NotImplemented, "Not yet implemented!" self.client.get @service_path, 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, ={}) object_path = "#{@service_path}/#{escape_object_id(object_id)}" self.new(self.client.get(object_path, )) end |
#where(options = {}) ⇒ Object
4 5 6 7 |
# File 'lib/splunker/models/finders.rb', line 4 def where(={}) raise NotImplemented, "Not yet implemented!" find(:all, ) end |