Module: Sports::Butler::Shared::AllSports

Included in:
Endpoints
Defined in:
lib/sports/butler/shared/all_sports.rb

Instance Method Summary collapse

Instance Method Details

#all(filters: {}) ⇒ Object



6
7
8
9
10
11
# File 'lib/sports/butler/shared/all_sports.rb', line 6

def all(filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  api.get(path: build_path(path), filters: filters)
  api
end

#by_coach(coach_id:, filters: {}) ⇒ Object



85
86
87
88
89
90
91
# File 'lib/sports/butler/shared/all_sports.rb', line 85

def by_coach(coach_id:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ coach: coach_id })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_code(code:, filters: {}) ⇒ Object



157
158
159
160
161
162
163
# File 'lib/sports/butler/shared/all_sports.rb', line 157

def by_code(code: , filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ code: code })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_competition(competition_id:, filters: {}) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/sports/butler/shared/all_sports.rb', line 53

def by_competition(competition_id:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_by_competition(competition_id))
  api.get(path: build_path(path), filters: filters)
  api
end

#by_competition_and_range(competition_id:, from:, to:, filters: {}) ⇒ Object



141
142
143
144
145
146
147
# File 'lib/sports/butler/shared/all_sports.rb', line 141

def by_competition_and_range(competition_id:, from:, to:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_by_competition_and_range(competition_id, from, to))
  api.get(path: build_path(path), filters: filters)
  api
end

#by_competition_and_season(competition_id:, season:, filters: {}) ⇒ Object



117
118
119
120
121
122
123
# File 'lib/sports/butler/shared/all_sports.rb', line 117

def by_competition_and_season(competition_id:, season:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ league: competition_id, season: season })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_competition_and_team_and_season(competition_id:, team_id:, season:, filters: {}) ⇒ Object



165
166
167
168
169
170
171
# File 'lib/sports/butler/shared/all_sports.rb', line 165

def by_competition_and_team_and_season(competition_id:, team_id:, season: , filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ league: competition_id, team: team_id, season: season })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_competition_and_year(competition_id:, year:, filters: {}) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/sports/butler/shared/all_sports.rb', line 101

def by_competition_and_year(competition_id:, year:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_by_competition_and_year(competition_id, year))
  api.get(path: build_path(path), filters: filters)
  api
end

#by_country(country_id:, filters: {}) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/sports/butler/shared/all_sports.rb', line 45

def by_country(country_id: , filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ country_id: country_id })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_country_name(country_name:, filters: {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/sports/butler/shared/all_sports.rb', line 21

def by_country_name(country_name: , filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ country: country_name })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_id(id:, filters: {}) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/sports/butler/shared/all_sports.rb', line 29

def by_id(id: , filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_by_id(id))
  api.get(path: build_path(path), filters: filters)
  api
end

#by_id_and_season(id:, season:, filters: {}) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/sports/butler/shared/all_sports.rb', line 93

def by_id_and_season(id:, season:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ id: id, season: season })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_match(match_id:, filters: {}) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/sports/butler/shared/all_sports.rb', line 37

def by_match(match_id: , filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_by_match(match_id))
  api.get(path: build_path(path), filters: filters)
  api
end

#by_name(name:, filters: {}) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/sports/butler/shared/all_sports.rb', line 13

def by_name(name: , filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ name: name })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_player(player_id:, filters: {}) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/sports/butler/shared/all_sports.rb', line 69

def by_player(player_id:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_by_player(player_id))
  api.get(path: build_path(path), filters: filters)
  api
end

#by_season(season:, filters: {}) ⇒ Object



149
150
151
152
153
154
155
# File 'lib/sports/butler/shared/all_sports.rb', line 149

def by_season(season:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ season: season })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_team(team_id:, filters: {}) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/sports/butler/shared/all_sports.rb', line 77

def by_team(team_id:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_by_team(team_id))
  api.get(path: build_path(path), filters: filters)
  api
end

#by_team_and_range(team_id:, from:, to:, filters: {}) ⇒ Object



133
134
135
136
137
138
139
# File 'lib/sports/butler/shared/all_sports.rb', line 133

def by_team_and_range(team_id:, from:, to:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ team_id: team_id, from: from, to: to })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_team_and_season(team_id:, season:, filters: {}) ⇒ Object



125
126
127
128
129
130
131
# File 'lib/sports/butler/shared/all_sports.rb', line 125

def by_team_and_season(team_id:, season:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!({ team: team_id, season: season })
  api.get(path: build_path(path), filters: filters)
  api
end

#by_teams(team_id:, second_team_id:, filters: {}) ⇒ Object



109
110
111
112
113
114
115
# File 'lib/sports/butler/shared/all_sports.rb', line 109

def by_teams(team_id:, second_team_id:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_by_teams(team_id, second_team_id))
  api.get(path: build_path(path), filters: filters)
  api
end

#search_by_name(name:, filters: {}) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/sports/butler/shared/all_sports.rb', line 61

def search_by_name(name:, filters: {})
  return error_missing_endpoint_method(__method__) unless available_endpoint_methods.include?(__method__)

  filters.merge!(filters_search_by_name(name))
  api.get(path: build_path(path), filters: filters)
  api
end