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