Class: MLB::Conferences

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

Class Method Summary collapse

Class Method Details

.allObject



10
11
12
13
14
# File 'lib/mlb/conferences.rb', line 10

def self.all
  response = CLIENT.get("conferences")
  conferences = from_json(response)
  conferences.conferences
end

.find(conference) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/mlb/conferences.rb', line 16

def self.find(conference)
  id = conference.respond_to?(:id) ? conference.id : conference
  params = {conferenceId: id}
  query_string = URI.encode_www_form(params)
  response = CLIENT.get("conferences?#{query_string}")
  conferences = from_json(response)
  conferences.conferences.first
end