Sha256: b9b2b2aef2b763144608665fd6f57b5be7e3b4502765c536003abc54ad1363b0

Contents?: true

Size: 772 Bytes

Versions: 2

Compression:

Stored size: 772 Bytes

Contents

module Dribble
  class Players
    attr_reader :players, :page, :pages, :per_page, :total
    
    def initialize(players, attributes={})
      @players  = players
      @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::Player.send(api_endpoint, options)
    end
    
  end
end


module Dribble
  class Followers < Players
  end
end

module Dribble
  class Draftees < Players
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dribble-0.1.1 lib/dribble/players.rb
dribble-0.1.0 lib/dribble/players.rb