Class: DribbbleBucketApi::ShotCollection
- Inherits:
-
Array
- Object
- Array
- DribbbleBucketApi::ShotCollection
- Defined in:
- lib/dribbble_bucket_api/shot_collection.rb
Instance Attribute Summary collapse
-
#current_page ⇒ Object
Returns the value of attribute current_page.
-
#total_entries ⇒ Object
Returns the value of attribute total_entries.
-
#total_pages ⇒ Object
Returns the value of attribute total_pages.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#current_page ⇒ Object
Returns the value of attribute current_page.
19 20 21 |
# File 'lib/dribbble_bucket_api/shot_collection.rb', line 19 def current_page @current_page end |
#total_entries ⇒ Object
Returns the value of attribute total_entries.
19 20 21 |
# File 'lib/dribbble_bucket_api/shot_collection.rb', line 19 def total_entries @total_entries end |
#total_pages ⇒ Object
Returns the value of attribute total_pages.
19 20 21 |
# File 'lib/dribbble_bucket_api/shot_collection.rb', line 19 def total_pages @total_pages end |
Class Method Details
.retrieve(options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dribbble_bucket_api/shot_collection.rb', line 6 def self.retrieve() # load the page response = PublicSite.new.bucket_contents({ page: 1 }.merge()) # create the new array new(response.shots).tap do |arr| arr.total_entries = response.total_entries arr.total_pages = response.total_pages arr.current_page = response.current_page end end |
Instance Method Details
#next_page ⇒ Object
21 22 23 |
# File 'lib/dribbble_bucket_api/shot_collection.rb', line 21 def next_page current_page + 1 end |
#prev_page ⇒ Object
25 26 27 |
# File 'lib/dribbble_bucket_api/shot_collection.rb', line 25 def prev_page [current_page - 1, 1].max end |