Class: ApiSports::FixturesResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/api_sports/resources/fixtures.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#get_request, #get_single_resource, #handle_response, #initialize

Constructor Details

This class inherits a constructor from ApiSports::Resource

Instance Method Details

#events(fixture_id:, **params) ⇒ Object



28
29
30
31
# File 'lib/api_sports/resources/fixtures.rb', line 28

def events(fixture_id:, **params)
  response = get_request("fixtures/events", params: { fixture: fixture_id }.merge(params))
  Collection.from_response(response, type: Event)
end

#head_to_head(first_team_id:, second_team_id:, **params) ⇒ Object



18
19
20
21
# File 'lib/api_sports/resources/fixtures.rb', line 18

def head_to_head(first_team_id:, second_team_id:, **params)
  response = get_request("fixtures/headtohead", params: { h2h: "#{first_team_id}-#{second_team_id}" }.merge(params))
  Collection.from_response(response, type: Fixture)
end

#lineups(fixture_id:, **params) ⇒ Object



33
34
35
36
# File 'lib/api_sports/resources/fixtures.rb', line 33

def lineups(fixture_id:, **params)
  response = get_request("fixtures/lineups", params: { fixture: fixture_id }.merge(params))
  Collection.from_response(response, type: Lineup)
end

#list(**params) ⇒ Object



5
6
7
8
# File 'lib/api_sports/resources/fixtures.rb', line 5

def list(**params)
  response = get_request("fixtures", params: params)
  Collection.from_response(response, type: Fixture)
end

#player_statistics(fixture_id:, **params) ⇒ Object



38
39
40
41
# File 'lib/api_sports/resources/fixtures.rb', line 38

def player_statistics(fixture_id:, **params)
  response = get_request("fixtures/players", params: { fixture: fixture_id }.merge(params))
  Collection.from_response(response, type: Player)
end

#rounds(league_id:, season_id:, current_round_only: false) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/api_sports/resources/fixtures.rb', line 10

def rounds(league_id:, season_id:, current_round_only: false)
  response = get_request("fixtures/rounds",
                         params: { league: league_id,
                                   season: season_id,
                                   current: current_round_only }.compact)
  Collection.from_response(response, type: FixtureRound)
end

#statistics(fixture_id:, **params) ⇒ Object



23
24
25
26
# File 'lib/api_sports/resources/fixtures.rb', line 23

def statistics(fixture_id:, **params)
  response = get_request("fixtures/statistics", params: { fixture: fixture_id }.merge(params))
  Collection.from_response(response, type: Statistics)
end