Class: FootballApi::Goal

Inherits:
Object
  • Object
show all
Defined in:
lib/football_api/goal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Goal

Returns a new instance of Goal.



5
6
7
8
9
10
11
# File 'lib/football_api/goal.rb', line 5

def initialize(hash = {})
  @score = hash[:score]
  @minute = hash[:minute]
  @owngoal = hash[:owngoal]
  @penalty = hash[:penalty]
  @player = parse_player(hash)
end

Instance Attribute Details

#minuteObject

Returns the value of attribute minute.



3
4
5
# File 'lib/football_api/goal.rb', line 3

def minute
  @minute
end

#owngoalObject

Returns the value of attribute owngoal.



3
4
5
# File 'lib/football_api/goal.rb', line 3

def owngoal
  @owngoal
end

#penaltyObject

Returns the value of attribute penalty.



3
4
5
# File 'lib/football_api/goal.rb', line 3

def penalty
  @penalty
end

#playerObject

Returns the value of attribute player.



3
4
5
# File 'lib/football_api/goal.rb', line 3

def player
  @player
end

#scoreObject

Returns the value of attribute score.



3
4
5
# File 'lib/football_api/goal.rb', line 3

def score
  @score
end

Instance Method Details

#parse_player(hash = {}) ⇒ Object



13
14
15
# File 'lib/football_api/goal.rb', line 13

def parse_player(hash = {})
  FootballApi::Player.new(hash)
end