Class: AhlScraper::Games::Goalie
- Inherits:
-
Resource
- Object
- Resource
- AhlScraper::Games::Goalie
show all
- Defined in:
- lib/ahl_scraper/resources/games/goalie.rb
Instance Method Summary
collapse
Methods inherited from Resource
#[], #each, #initialize, #inspect, #keys, #to_json, #values
Instance Method Details
#birthdate ⇒ Object
34
35
36
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 34
def birthdate
@birthdate ||= valid_birthdate? ? @raw_data[:info][:birthDate] : nil
end
|
#captaincy ⇒ Object
65
66
67
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 65
def captaincy
nil
end
|
#current_age ⇒ Object
38
39
40
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 38
def current_age
@current_age ||= valid_birthdate? ? BirthdateHelper.new(birthdate).age_on_date(@opts[:game_date]) : nil
end
|
#first_name ⇒ Object
10
11
12
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 10
def first_name
@first_name ||= @raw_data[:info][:firstName]
end
|
#home_team ⇒ Object
26
27
28
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 26
def home_team
@home_team ||= @opts[:home_team]
end
|
#id ⇒ Object
6
7
8
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 6
def id
@id ||= @raw_data[:info][:id]
end
|
#jersey_number ⇒ Object
18
19
20
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 18
def jersey_number
@jersey_number ||= @raw_data[:info][:jerseyNumber]
end
|
#last_name ⇒ Object
14
15
16
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 14
def last_name
@last_name ||= @raw_data[:info][:lastName]
end
|
#penalty_shots ⇒ Object
76
77
78
79
80
81
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 76
def penalty_shots
@penalty_shots ||= {
attempts_against: penalty_shot_data.size,
goals_against: penalty_shot_data.filter { |attempt| attempt[:isGoal] == true }.size,
}
end
|
#position ⇒ Object
30
31
32
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 30
def position
@position ||= @raw_data[:info][:position]
end
|
#shootout ⇒ Object
69
70
71
72
73
74
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 69
def shootout
@shootout ||= {
attempts_against: shootout_data.size,
goals_against: shootout_data.filter { |attempt| attempt[:isGoal] == true }.size,
}
end
|
#starting ⇒ Object
57
58
59
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 57
def starting
@starting ||= @raw_data[:starting]
end
|
#stats ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 42
def stats
@stats ||= {
goals: @raw_data[:stats][:goals],
assists: @raw_data[:stats][:assists],
points: @raw_data[:stats][:points],
penalty_minutes: @raw_data[:stats][:penaltyMinutes],
toi: @raw_data[:stats][:timeOnIce],
toi_in_seconds: set_time_on_ice_in_seconds,
shots_against: @raw_data[:stats][:shotsAgainst],
goals_against: @raw_data[:stats][:goalsAgainst],
saves: @raw_data[:stats][:saves],
save_percent: @raw_data[:stats][:shotsAgainst].positive? ? set_save_percent : nil,
}
end
|
#status ⇒ Object
61
62
63
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 61
def status
@status ||= @raw_data[:status]
end
|
#team_id ⇒ Object
22
23
24
|
# File 'lib/ahl_scraper/resources/games/goalie.rb', line 22
def team_id
@team_id ||= @opts[:team_id]
end
|