Class: MLB::Sports

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/mlb/sports.rb

Class Method Summary collapse

Class Method Details

.allObject



9
10
11
12
13
# File 'lib/mlb/sports.rb', line 9

def self.all
  response = CLIENT.get("sports")
  sports = from_json(response)
  sports.sports.sort!
end

.find(sport) ⇒ Object



15
16
17
18
19
20
# File 'lib/mlb/sports.rb', line 15

def self.find(sport)
  id = sport.respond_to?(:id) ? sport.id : sport
  response = CLIENT.get("sports/#{id}")
  sports = from_json(response)
  sports.sports.first
end