Module: Confluence::Findable

Included in:
Attachment, BlogEntry, Page, Space, User
Defined in:
lib/confluence/findable.rb

Instance Method Summary collapse

Instance Method Details

#find(args) ⇒ Object

Finds records by the given criteria.

Parameters

args<Hash>

The search arguments.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/confluence/findable.rb', line 7

def find(args)
  if args.has_key?(:all) && !respond_to?(:find_all)
    raise "Cannot find all #{self.class.name.downcase}s, find by criteria instead."
  end

  begin
    case args
    when :all
      find_all
    when Hash
      find_criteria(args)
    end
  rescue Confluence::Error
  end
end