Class: Sports::Butler::Endpoints
Instance Attribute Summary collapse
Instance Method Summary
collapse
#cups, #leagues
#all, #by_coach, #by_code, #by_competition, #by_competition_and_range, #by_competition_and_season, #by_competition_and_team_and_season, #by_competition_and_year, #by_country, #by_country_name, #by_id, #by_id_and_season, #by_match, #by_name, #by_player, #by_season, #by_team, #by_team_and_range, #by_team_and_season, #by_teams, #search_by_name
Constructor Details
#initialize(sport:, api_name:, api:) ⇒ Endpoints
Returns a new instance of Endpoints.
13
14
15
16
17
|
# File 'lib/sports/butler/endpoints.rb', line 13
def initialize(sport:, api_name:, api:)
@sport = sport
@api_name = api_name
@api = api
end
|
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
11
12
13
|
# File 'lib/sports/butler/endpoints.rb', line 11
def api
@api
end
|
#api_name ⇒ Object
Returns the value of attribute api_name.
11
12
13
|
# File 'lib/sports/butler/endpoints.rb', line 11
def api_name
@api_name
end
|
#sport ⇒ Object
Returns the value of attribute sport.
11
12
13
|
# File 'lib/sports/butler/endpoints.rb', line 11
def sport
@sport
end
|
Instance Method Details
#build_path(_action) ⇒ Object
19
20
21
|
# File 'lib/sports/butler/endpoints.rb', line 19
def build_path(_action)
path
end
|
#error_missing_endpoint_method(meth) ⇒ Object
23
24
25
|
# File 'lib/sports/butler/endpoints.rb', line 23
def error_missing_endpoint_method(meth)
"The method '#{meth}' is not available for endpoint '#{self.class.name.demodulize}' in API #{self.api_name}."
end
|
#filters_by_competition(id) ⇒ Object
45
46
47
|
# File 'lib/sports/butler/endpoints.rb', line 45
def filters_by_competition(id)
{ competition_id: id }
end
|
#filters_by_competition_and_year(id, year) ⇒ Object
49
50
51
|
# File 'lib/sports/butler/endpoints.rb', line 49
def filters_by_competition_and_year(id, year)
{ league: id, season: year }
end
|
#filters_by_id(id) ⇒ Object
37
38
39
|
# File 'lib/sports/butler/endpoints.rb', line 37
def filters_by_id(id)
{ id: id }
end
|
#filters_by_match(id) ⇒ Object
29
30
31
|
# File 'lib/sports/butler/endpoints.rb', line 29
def filters_by_match(id)
{ id: id }
end
|
#filters_by_player(id) ⇒ Object
41
42
43
|
# File 'lib/sports/butler/endpoints.rb', line 41
def filters_by_player(id)
{ player: id }
end
|
#filters_by_team(team_id) ⇒ Object
33
34
35
|
# File 'lib/sports/butler/endpoints.rb', line 33
def filters_by_team(team_id)
{ team: team_id }
end
|
#filters_search_by_name(name) ⇒ Object
53
54
55
|
# File 'lib/sports/butler/endpoints.rb', line 53
def filters_search_by_name(name)
{ name: name }
end
|