Class: OpenDotaApi::Match

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

Defined Under Namespace

Classes: Player

Constant Summary collapse

ENDPOINT =
'matches'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

define_adder, #initialize

Methods included from Entities::Instantiatable

included

Constructor Details

This class inherits a constructor from OpenDotaApi::Entity

Class Method Details

.instantiate(_ = nil) ⇒ Object

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/open_dota_api/match.rb', line 8

def self.instantiate(_ = nil)
  raise NotImplementedError
end

Instance Method Details

#clusterObject



56
57
58
# File 'lib/open_dota_api/match.rb', line 56

def cluster
  data['cluster']
end

#dire_scoreObject



76
77
78
# File 'lib/open_dota_api/match.rb', line 76

def dire_score
  data['dire_score']
end

#dire_team_idObject



36
37
38
# File 'lib/open_dota_api/match.rb', line 36

def dire_team_id
  data.dig('dire_team', 'team_id')
end

#durationObject



20
21
22
# File 'lib/open_dota_api/match.rb', line 20

def duration
  data['duration']
end

#first_blood_timeObject



48
49
50
# File 'lib/open_dota_api/match.rb', line 48

def first_blood_time
  data['first_blood_time']
end

#league_idObject



44
45
46
# File 'lib/open_dota_api/match.rb', line 44

def league_id
  data['leagueid']
end

#match_idObject



12
13
14
# File 'lib/open_dota_api/match.rb', line 12

def match_id
  data['match_id']
end

#match_seq_numObject



40
41
42
# File 'lib/open_dota_api/match.rb', line 40

def match_seq_num
  data['match_seq_num']
end

#playersObject



68
69
70
# File 'lib/open_dota_api/match.rb', line 68

def players
  Player.instantiate(data['players'])
end

#radiant_scoreObject



72
73
74
# File 'lib/open_dota_api/match.rb', line 72

def radiant_score
  data['radiant_score']
end

#radiant_team_idObject



32
33
34
# File 'lib/open_dota_api/match.rb', line 32

def radiant_team_id
  data.dig('radiant_team', 'team_id')
end

#replay_saltObject



60
61
62
# File 'lib/open_dota_api/match.rb', line 60

def replay_salt
  data['replay_salt']
end

#replay_urlObject



64
65
66
# File 'lib/open_dota_api/match.rb', line 64

def replay_url
  "http://replay#{cluster}.valve.net/570/#{match_id}_#{replay_salt}.dem.bz2"
end

#series_idObject



24
25
26
# File 'lib/open_dota_api/match.rb', line 24

def series_id
  data['series_id']
end

#series_typeObject



28
29
30
# File 'lib/open_dota_api/match.rb', line 28

def series_type
  data['series_type']
end

#start_timeObject



16
17
18
# File 'lib/open_dota_api/match.rb', line 16

def start_time
  data['start_time']
end

#winnerObject



52
53
54
# File 'lib/open_dota_api/match.rb', line 52

def winner
  data['radiant_win'] ? :radiant : :dire
end