Module: FbGraph::Searchable
- Defined in:
- lib/fb_graph/searchable.rb,
lib/fb_graph/searchable/result.rb
Defined Under Namespace
Classes: Result
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.search(query, options = {}) {|collection| ... } ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/fb_graph/searchable.rb', line 3 def self.search(query, = {}) klass = .delete(:class) || FbGraph::Searchable collection = FbGraph::Collection.new( FbGraph::Node.new(:search).send(:get, .merge(:q => query)) ) yield collection if block_given? FbGraph::Searchable::Result.new(query, klass, .merge(:collection => collection)) end |
Instance Method Details
#search(query, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fb_graph/searchable.rb', line 12 def search(query, = {}) type = self.to_s.underscore.split('/').last FbGraph::Searchable.search(query, .merge(:type => type, :class => self)) do |collection| collection.map! do |obj| self.new(obj.delete(:id), obj.merge( :access_token => [:access_token] )) end end end |