Balling out with my first CLI

def self.load_all
current_page = 0
until current_page == 50
page_number = "?page=#{current_page}"
response = RestClient.get(url+page_number)
data = JSON.parse(response.body)
data["data"].each do |player|
* player = Ballers.new(player)
end
current_page += 1
end
end
end
def initialize(data)
self.first_name = data["first_name"]
self.last_name = data["last_name"]
self.position = data["position"]
self.full_name = "#{self.first_name} #{self.last_name}"
@@all << self
end
def self.all
@@all
end
def self.find_player_by_name(name)
@@all.find{|player| player.full_name.upcase == name.upcase}
end

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store