Sha256: e114229ebd61e334d5d165e4d97a756f872b653b3c88f6d08806c9b02f1d6505

Contents?: true

Size: 858 Bytes

Versions: 6

Compression:

Stored size: 858 Bytes

Contents

module Dribble
  class Shots
    attr_reader :shots, :page, :pages, :per_page, :total
    
    def initialize(shots, attributes={})
      @shots    = shots
      @page     = attributes[:page]
      @pages    = attributes[:pages]
      @per_page = attributes[:per_page]
      @total    = attributes[:total]
    end
    
    
    def next_page
      api_endpoint  = self.class.to_s.split('::').last.downcase.to_sym
      options       = {:page => self.page.to_i + 1}
      raise Dribble::NoMorePagesAvailable.new('You are already on the last page.') if options[:page] > self.pages.to_i
      Dribble::Shot.send(api_endpoint, options)
    end
    
  end
end


module Dribble
  class Popular < Shots
  end
end

module Dribble
  class Everyones < Shots
  end
end

module Dribble
  class Debuts < Shots
  end
end

module Dribble
  class Following < Shots
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dribble-0.1.1 lib/dribble/shots.rb
dribble-0.1.0 lib/dribble/shots.rb
dribble-0.0.31 lib/dribble/shots.rb
dribble-0.0.3 lib/dribble/shots.rb
dribble-0.0.25 lib/dribble/shots.rb
dribble-0.0.2 lib/dribble/shots.rb