Module: Mogli::Model::Search

Included in:
Mogli::Model
Defined in:
lib/mogli/model/search.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) search_type (readonly)

Returns the value of attribute search_type



4
5
6
# File 'lib/mogli/model/search.rb', line 4

def search_type
  @search_type
end

Instance Method Details

- (Object) search(pattern = "", client = nil, args = {})

Raises:

  • (NoMethodError)


6
7
8
9
10
11
# File 'lib/mogli/model/search.rb', line 6

def search(pattern="", client=nil, args={})
  raise(NoMethodError.new("Can't search for #{self.to_s}")) unless search_type
  args.merge!({:q => pattern})
  args.merge!(:type => self.search_type) unless search_type == 'all'
  (client||Mogli::Client.new).get_and_map('search', self, args)
end