Class: AhlScraper::SeasonListItem

Inherits:
Resource
  • Object
show all
Defined in:
lib/ahl_scraper/resources/season_list_item.rb

Instance Method Summary collapse

Methods inherited from Resource

#[], #each, #inspect, #keys, #to_json, #values

Constructor Details

#initialize(raw_data, opts = {}) ⇒ SeasonListItem

Returns a new instance of SeasonListItem.



5
6
7
# File 'lib/ahl_scraper/resources/season_list_item.rb', line 5

def initialize(raw_data, opts = {})
  super(raw_data, opts)
end

Instance Method Details

#idObject



9
10
11
# File 'lib/ahl_scraper/resources/season_list_item.rb', line 9

def id
  @id ||= @raw_data[:id].to_i
end

#nameObject



13
14
15
# File 'lib/ahl_scraper/resources/season_list_item.rb', line 13

def name
  @name ||= @raw_data[:name]
end

#season_typeObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ahl_scraper/resources/season_list_item.rb', line 17

def season_type
  case name
  when /Regular/
    :regular
  when /All-Star/
    :all_star
  when /Playoffs/
    :playoffs
  when /Exhibition/
    :exhibition
  end
end