Class: Dribble::Shots
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
-
#shots ⇒ Object
readonly
Returns the value of attribute shots.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(shots, attributes = {}) ⇒ Shots
constructor
A new instance of Shots.
- #next_page ⇒ Object
Constructor Details
#initialize(shots, attributes = {}) ⇒ Shots
Returns a new instance of Shots.
5 6 7 8 9 10 11 |
# File 'lib/dribble/shots.rb', line 5 def initialize(shots, attributes={}) @shots = shots @page = attributes[:page] @pages = attributes[:pages] @per_page = attributes[:per_page] @total = attributes[:total] end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
3 4 5 |
# File 'lib/dribble/shots.rb', line 3 def page @page end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
3 4 5 |
# File 'lib/dribble/shots.rb', line 3 def pages @pages end |
#per_page ⇒ Object (readonly)
Returns the value of attribute per_page.
3 4 5 |
# File 'lib/dribble/shots.rb', line 3 def per_page @per_page end |
#shots ⇒ Object (readonly)
Returns the value of attribute shots.
3 4 5 |
# File 'lib/dribble/shots.rb', line 3 def shots @shots end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
3 4 5 |
# File 'lib/dribble/shots.rb', line 3 def total @total end |
Instance Method Details
#next_page ⇒ Object
14 15 16 17 18 19 |
# File 'lib/dribble/shots.rb', line 14 def next_page api_endpoint = self.class.to_s.split('::').last.downcase.to_sym = {:page => self.page.to_i + 1} raise Dribble::NoMorePagesAvailable.new('You are already on the last page.') if [:page] > self.pages.to_i Dribble::Shot.send(api_endpoint, ) end |