Class: Mogli::FetchingArray
- Inherits:
-
Array
- Object
- Array
- Mogli::FetchingArray
- Defined in:
- lib/mogli/fetching_array.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
Returns the value of attribute classes.
-
#client ⇒ Object
Returns the value of attribute client.
-
#next_url ⇒ Object
Returns the value of attribute next_url.
-
#previous_url ⇒ Object
Returns the value of attribute previous_url.
-
#total_count ⇒ Object
Returns the value of attribute total_count.
Instance Method Summary collapse
Instance Attribute Details
#classes ⇒ Object
Returns the value of attribute classes.
3 4 5 |
# File 'lib/mogli/fetching_array.rb', line 3 def classes @classes end |
#client ⇒ Object
Returns the value of attribute client.
3 4 5 |
# File 'lib/mogli/fetching_array.rb', line 3 def client @client end |
#next_url ⇒ Object
Returns the value of attribute next_url.
3 4 5 |
# File 'lib/mogli/fetching_array.rb', line 3 def next_url @next_url end |
#previous_url ⇒ Object
Returns the value of attribute previous_url.
3 4 5 |
# File 'lib/mogli/fetching_array.rb', line 3 def previous_url @previous_url end |
#total_count ⇒ Object
Returns the value of attribute total_count.
3 4 5 |
# File 'lib/mogli/fetching_array.rb', line 3 def total_count @total_count end |
Instance Method Details
#fetch_next ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/mogli/fetching_array.rb', line 5 def fetch_next return [] if next_url.nil? || next_url.empty? additions = client.get_and_map_url(next_url,classes) self.next_url = additions.next_url self.concat(additions) additions end |
#fetch_previous ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/mogli/fetching_array.rb', line 13 def fetch_previous return [] if previous_url.nil? || previous_url.empty? additions = client.get_and_map_url(previous_url,classes) self.previous_url = additions.previous_url self.unshift(*additions) additions end |