Class: FbGraph2::Searchable::Result
- Inherits:
-
Collection
- Object
- Array
- Collection
- FbGraph2::Searchable::Result
- Defined in:
- lib/fb_graph2/searchable/result.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#collection ⇒ Object
Returns the value of attribute collection.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#options ⇒ Object
Returns the value of attribute options.
-
#query ⇒ Object
Returns the value of attribute query.
Attributes inherited from Collection
#after, #before, #summary, #total_count
Instance Method Summary collapse
-
#initialize(query, access_token, klass, options = {}) ⇒ Result
constructor
A new instance of Result.
- #next(_options_ = {}) ⇒ Object
- #previous(_options_ = {}) ⇒ Object
Constructor Details
#initialize(query, access_token, klass, options = {}) ⇒ Result
Returns a new instance of Result.
6 7 8 9 10 11 12 13 |
# File 'lib/fb_graph2/searchable/result.rb', line 6 def initialize(query, access_token, klass, = {}) @klass = klass @access_token = access_token @query = query @options = @collection = .delete(:collection) || Collection.new replace @collection end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/fb_graph2/searchable/result.rb', line 4 def access_token @access_token end |
#collection ⇒ Object
Returns the value of attribute collection.
4 5 6 |
# File 'lib/fb_graph2/searchable/result.rb', line 4 def collection @collection end |
#klass ⇒ Object
Returns the value of attribute klass.
4 5 6 |
# File 'lib/fb_graph2/searchable/result.rb', line 4 def klass @klass end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/fb_graph2/searchable/result.rb', line 4 def @options end |
#query ⇒ Object
Returns the value of attribute query.
4 5 6 |
# File 'lib/fb_graph2/searchable/result.rb', line 4 def query @query end |
Instance Method Details
#next(_options_ = {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/fb_graph2/searchable/result.rb', line 15 def next( = {}) if collection.next.present? klass.search query, access_token, .merge().merge(collection.next) else self.class.new query, access_token, klass end end |
#previous(_options_ = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/fb_graph2/searchable/result.rb', line 23 def previous( = {}) if collection.previous.present? klass.search query, access_token, .merge().merge(collection.previous) else self.class.new query, access_token, klass end end |