Class: FtcApiV3Client::LeaguesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ftc_api_v3_client/api/leagues_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LeaguesApi

Returns a new instance of LeaguesApi.



19
20
21
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_league(cmp_year, region_code, league_code, opts = {}) ⇒ ApiV3LeagueDetails

Gets a single league from a region Gets a leagues for a region in a season, including any children

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • league_code (String)

    The code (abbreviation) for the league

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



29
30
31
32
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 29

def get_league(cmp_year, region_code, league_code, opts = {})
  data, _status_code, _headers = get_league_with_http_info(cmp_year, region_code, league_code, opts)
  data
end

#get_league_rankings(cmp_year, region_code, league_code, opts = {}) ⇒ ApiV3Rankings

Get rankings for a league Gets league rankings for a given league. This only includes matches played in League Meets. For rankings including the League Tournament, use the tournament event's rankings endpoint instead. Each sort order field is season-specific: see the season's competition manual for definitions. The last non-zero sort order is the scoring system randomly generated tiebreaker value.

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • league_code (String)

    The code (abbreviation) for the league

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



92
93
94
95
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 92

def get_league_rankings(cmp_year, region_code, league_code, opts = {})
  data, _status_code, _headers = get_league_rankings_with_http_info(cmp_year, region_code, league_code, opts)
  data
end

#get_league_rankings_with_http_info(cmp_year, region_code, league_code, opts = {}) ⇒ Array<(ApiV3Rankings, Integer, Hash)>

Get rankings for a league Gets league rankings for a given league. This only includes matches played in League Meets. For rankings including the League Tournament, use the tournament event's rankings endpoint instead. Each sort order field is season-specific: see the season's competition manual for definitions. The last non-zero sort order is the scoring system randomly generated tiebreaker value.

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • league_code (String)

    The code (abbreviation) for the league

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ApiV3Rankings, Integer, Hash)>)

    ApiV3Rankings data, response status code and response headers



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 104

def get_league_rankings_with_http_info(cmp_year, region_code, league_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LeaguesApi.get_league_rankings ...'
  end
  # resource path
  local_var_path = '/api/v3/seasons/{cmpYear}/regions/{regionCode}/leagues/{leagueCode}/rankings'.sub('{' + 'cmpYear' + '}', CGI.escape(cmp_year.to_s)).sub('{' + 'regionCode' + '}', CGI.escape(region_code.to_s)).sub('{' + 'leagueCode' + '}', CGI.escape(league_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ApiV3Rankings'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"LeaguesApi.get_league_rankings",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LeaguesApi#get_league_rankings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_league_with_http_info(cmp_year, region_code, league_code, opts = {}) ⇒ Array<(ApiV3LeagueDetails, Integer, Hash)>

Gets a single league from a region Gets a leagues for a region in a season, including any children

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • league_code (String)

    The code (abbreviation) for the league

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ApiV3LeagueDetails, Integer, Hash)>)

    ApiV3LeagueDetails data, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 41

def get_league_with_http_info(cmp_year, region_code, league_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LeaguesApi.get_league ...'
  end
  # resource path
  local_var_path = '/api/v3/seasons/{cmpYear}/regions/{regionCode}/leagues/{leagueCode}'.sub('{' + 'cmpYear' + '}', CGI.escape(cmp_year.to_s)).sub('{' + 'regionCode' + '}', CGI.escape(region_code.to_s)).sub('{' + 'leagueCode' + '}', CGI.escape(league_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ApiV3LeagueDetails'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"LeaguesApi.get_league",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LeaguesApi#get_league\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_league_events(cmp_year, region_code, league_code, opts = {}) ⇒ ApiV3Events

List events for a league Lists all events in a league, including events in child leagues.

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • league_code (String)

    The code (abbreviation) for the league

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



155
156
157
158
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 155

def list_league_events(cmp_year, region_code, league_code, opts = {})
  data, _status_code, _headers = list_league_events_with_http_info(cmp_year, region_code, league_code, opts)
  data
end

#list_league_events_with_http_info(cmp_year, region_code, league_code, opts = {}) ⇒ Array<(ApiV3Events, Integer, Hash)>

List events for a league Lists all events in a league, including events in child leagues.

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • league_code (String)

    The code (abbreviation) for the league

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ApiV3Events, Integer, Hash)>)

    ApiV3Events data, response status code and response headers



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 167

def list_league_events_with_http_info(cmp_year, region_code, league_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LeaguesApi.list_league_events ...'
  end
  # resource path
  local_var_path = '/api/v3/seasons/{cmpYear}/regions/{regionCode}/leagues/{leagueCode}/events'.sub('{' + 'cmpYear' + '}', CGI.escape(cmp_year.to_s)).sub('{' + 'regionCode' + '}', CGI.escape(region_code.to_s)).sub('{' + 'leagueCode' + '}', CGI.escape(league_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ApiV3Events'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"LeaguesApi.list_league_events",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LeaguesApi#list_league_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_league_teams(cmp_year, region_code, league_code, opts = {}) ⇒ ApiV3Teams

List teams for a league Lists all teams assigned to the given league.

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • league_code (String)

    The code (abbreviation) for the league

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



218
219
220
221
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 218

def list_league_teams(cmp_year, region_code, league_code, opts = {})
  data, _status_code, _headers = list_league_teams_with_http_info(cmp_year, region_code, league_code, opts)
  data
end

#list_league_teams_with_http_info(cmp_year, region_code, league_code, opts = {}) ⇒ Array<(ApiV3Teams, Integer, Hash)>

List teams for a league Lists all teams assigned to the given league.

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • league_code (String)

    The code (abbreviation) for the league

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ApiV3Teams, Integer, Hash)>)

    ApiV3Teams data, response status code and response headers



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 230

def list_league_teams_with_http_info(cmp_year, region_code, league_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LeaguesApi.list_league_teams ...'
  end
  # resource path
  local_var_path = '/api/v3/seasons/{cmpYear}/regions/{regionCode}/leagues/{leagueCode}/teams'.sub('{' + 'cmpYear' + '}', CGI.escape(cmp_year.to_s)).sub('{' + 'regionCode' + '}', CGI.escape(region_code.to_s)).sub('{' + 'leagueCode' + '}', CGI.escape(league_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ApiV3Teams'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"LeaguesApi.list_league_teams",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LeaguesApi#list_league_teams\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_leagues(cmp_year, region_code, opts = {}) ⇒ ApiV3Leagues

Lists leagues for a region Lists all leagues for a region in a season. Parent/child relationships can be determined from the parentCode field of each league. League parents are guaranteed to be in the same region as their children.

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



280
281
282
283
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 280

def list_leagues(cmp_year, region_code, opts = {})
  data, _status_code, _headers = list_leagues_with_http_info(cmp_year, region_code, opts)
  data
end

#list_leagues_with_http_info(cmp_year, region_code, opts = {}) ⇒ Array<(ApiV3Leagues, Integer, Hash)>

Lists leagues for a region Lists all leagues for a region in a season. Parent/child relationships can be determined from the `parentCode` field of each league. League parents are guaranteed to be in the same region as their children.

Parameters:

  • cmp_year (String)

    The year of the FIRST Championship for the requested season

  • region_code (String)

    The code (abbreviation) for the region

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ApiV3Leagues, Integer, Hash)>)

    ApiV3Leagues data, response status code and response headers



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/ftc_api_v3_client/api/leagues_api.rb', line 291

def list_leagues_with_http_info(cmp_year, region_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LeaguesApi.list_leagues ...'
  end
  # resource path
  local_var_path = '/api/v3/seasons/{cmpYear}/regions/{regionCode}/leagues'.sub('{' + 'cmpYear' + '}', CGI.escape(cmp_year.to_s)).sub('{' + 'regionCode' + '}', CGI.escape(region_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ApiV3Leagues'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"LeaguesApi.list_leagues",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LeaguesApi#list_leagues\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end