Class: Infostrada::Goals

Inherits:
Object
  • Object
show all
Defined in:
lib/infostrada/match.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}, &block) ⇒ Goals

Returns a new instance of Goals.



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/infostrada/match.rb', line 238

def initialize(hash = {}, &block)
  @home_goals = hash['n_HomeGoals']
  @away_goals = hash['n_AwayGoals']
  @home_goals_half_time = hash['n_HomeGoalsHalftime']
  @away_goals_half_time = hash['n_AwayGoalsHalftime']
  @home_goals_90_mins = hash['n_HomeGoals90mins']
  @away_goals_90_mins = hash['n_AwayGoals90mins']
  @home_goals_105_mins = hash['n_HomeGoals105mins']
  @away_goals_105_mins = hash['n_AwayGoals105mins']
  @home_goals_shootout = hash['n_HomeGoalsShootout']
  @away_goald_shootout = hash['n_AwayGoalsShootout']

  block.call(self) if block_given?
  self
end

Instance Attribute Details

#away_goalsObject

Returns the value of attribute away_goals.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def away_goals
  @away_goals
end

#away_goals_105_minsObject

Returns the value of attribute away_goals_105_mins.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def away_goals_105_mins
  @away_goals_105_mins
end

#away_goals_90_minsObject

Returns the value of attribute away_goals_90_mins.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def away_goals_90_mins
  @away_goals_90_mins
end

#away_goals_half_timeObject

Returns the value of attribute away_goals_half_time.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def away_goals_half_time
  @away_goals_half_time
end

#away_goals_shootoutObject

Returns the value of attribute away_goals_shootout.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def away_goals_shootout
  @away_goals_shootout
end

#home_goalsObject

Returns the value of attribute home_goals.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def home_goals
  @home_goals
end

#home_goals_105_minsObject

Returns the value of attribute home_goals_105_mins.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def home_goals_105_mins
  @home_goals_105_mins
end

#home_goals_90_minsObject

Returns the value of attribute home_goals_90_mins.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def home_goals_90_mins
  @home_goals_90_mins
end

#home_goals_half_timeObject

Returns the value of attribute home_goals_half_time.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def home_goals_half_time
  @home_goals_half_time
end

#home_goals_shootoutObject

Returns the value of attribute home_goals_shootout.



219
220
221
# File 'lib/infostrada/match.rb', line 219

def home_goals_shootout
  @home_goals_shootout
end

Class Method Details

.from_json(json = {}) ⇒ Object



223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/infostrada/match.rb', line 223

def self.from_json(json = {})
  self.new do |goals|
    goals.home_goals           = json['home_goals']
    goals.away_goals           = json['away_goals']
    goals.home_goals_half_time = json['home_goals_half_time']
    goals.away_goals_half_time = json['away_goals_half_time']
    goals.home_goals_90_mins   = json['home_goals_90_mins']
    goals.away_goals_90_mins   = json['away_goals_90_mins']
    goals.home_goals_105_mins  = json['home_goals_105_mins']
    goals.away_goals_105_mins  = json['away_goals_105_mins']
    goals.home_goals_shootout  = json['home_goals_shootout']
    goals.away_goals_shootout  = json['away_goald_shootout']
  end
end