Class: PolarAccesslinkApiGem::TrainingDataApi

Inherits:
Object
  • Object
show all
Defined in:
lib/polar-accesslink-api-gem/api/training_data_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TrainingDataApi

Returns a new instance of TrainingDataApi.



19
20
21
# File 'lib/polar-accesslink-api-gem/api/training_data_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/polar-accesslink-api-gem/api/training_data_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#commit_exercise_transaction(transaction_id, user_id, opts = {}) ⇒ nil

Commit transaction After successfully retrieving training session data within a transaction, partners are expected to commit the transaction.

Parameters:

  • transaction_id (Integer)

    Transaction identifier

  • user_id (Integer)

    User identifier

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

    the optional parameters

Returns:

  • (nil)


28
29
30
31
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 28

def commit_exercise_transaction(transaction_id, user_id, opts = {})
  commit_exercise_transaction_with_http_info(transaction_id, user_id, opts)
  nil
end

#commit_exercise_transaction_with_http_info(transaction_id, user_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Commit transaction After successfully retrieving training session data within a transaction, partners are expected to commit the transaction.

Parameters:

  • transaction_id (Integer)

    Transaction identifier

  • user_id (Integer)

    User identifier

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



39
40
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 39

def commit_exercise_transaction_with_http_info(transaction_id, user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.commit_exercise_transaction ...'
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.commit_exercise_transaction"
  end
  pattern = Regexp.new(/[0-9]+/)
  if @api_client.config.client_side_validation && transaction_id !~ pattern
    fail ArgumentError, "invalid value for 'transaction_id' when calling TrainingDataApi.commit_exercise_transaction, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.commit_exercise_transaction"
  end
  pattern = Regexp.new(/[0-9]+/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling TrainingDataApi.commit_exercise_transaction, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}'.sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.commit_exercise_transaction",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TrainingDataApi#commit_exercise_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_exercise_transaction(user_id, opts = {}) ⇒ TransactionLocation

Create transaction Check for new training data and create a new transaction if found.

Parameters:

  • user_id (Integer)

    User identifier

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

    the optional parameters

Returns:



104
105
106
107
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 104

def create_exercise_transaction(user_id, opts = {})
  data, _status_code, _headers = create_exercise_transaction_with_http_info(user_id, opts)
  data
end

#create_exercise_transaction_with_http_info(user_id, opts = {}) ⇒ Array<(TransactionLocation, Integer, Hash)>

Create transaction Check for new training data and create a new transaction if found.

Parameters:

  • user_id (Integer)

    User identifier

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

    the optional parameters

Returns:

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

    TransactionLocation data, response status code and response headers



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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 114

def create_exercise_transaction_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.create_exercise_transaction ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.create_exercise_transaction"
  end
  pattern = Regexp.new(/[0-9]+/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling TrainingDataApi.create_exercise_transaction, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions'.sub('{' + 'user-id' + '}', CGI.escape(user_id.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', 'application/xml'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.create_exercise_transaction",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TrainingDataApi#create_exercise_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_available_samples(user_id, transaction_id, exercise_id, opts = {}) ⇒ Samples

Get available samples Retrieve list of links to available samples in training session

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:



174
175
176
177
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 174

def get_available_samples(user_id, transaction_id, exercise_id, opts = {})
  data, _status_code, _headers = get_available_samples_with_http_info(user_id, transaction_id, exercise_id, opts)
  data
end

#get_available_samples_with_http_info(user_id, transaction_id, exercise_id, opts = {}) ⇒ Array<(Samples, Integer, Hash)>

Get available samples Retrieve list of links to available samples in training session

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:

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

    Samples data, response status code and response headers



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 186

def get_available_samples_with_http_info(user_id, transaction_id, exercise_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_available_samples ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_available_samples"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_available_samples"
  end
  # verify the required parameter 'exercise_id' is set
  if @api_client.config.client_side_validation && exercise_id.nil?
    fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_available_samples"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'exercise-id' + '}', CGI.escape(exercise_id.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', 'application/xml'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.get_available_samples",
    :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: TrainingDataApi#get_available_samples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_exercise_summary(user_id, transaction_id, exercise_id, opts = {}) ⇒ Exercise

Get exercise summary Retrieve training session summary data

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:



249
250
251
252
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 249

def get_exercise_summary(user_id, transaction_id, exercise_id, opts = {})
  data, _status_code, _headers = get_exercise_summary_with_http_info(user_id, transaction_id, exercise_id, opts)
  data
end

#get_exercise_summary_with_http_info(user_id, transaction_id, exercise_id, opts = {}) ⇒ Array<(Exercise, Integer, Hash)>

Get exercise summary Retrieve training session summary data

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:

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

    Exercise data, response status code and response headers



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
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
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 261

def get_exercise_summary_with_http_info(user_id, transaction_id, exercise_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_exercise_summary ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_exercise_summary"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_exercise_summary"
  end
  # verify the required parameter 'exercise_id' is set
  if @api_client.config.client_side_validation && exercise_id.nil?
    fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_exercise_summary"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'exercise-id' + '}', CGI.escape(exercise_id.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', 'application/xml'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.get_exercise_summary",
    :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: TrainingDataApi#get_exercise_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_fit(user_id, transaction_id, exercise_id, opts = {}) ⇒ String

Get FIT (beta) Retrieve exercise in FIT format. **Note!** This interface is in beta phase. If there is anything we can help you with or you want to give us feedback, please contact [Support](#support).

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:

  • (String)


324
325
326
327
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 324

def get_fit(user_id, transaction_id, exercise_id, opts = {})
  data, _status_code, _headers = get_fit_with_http_info(user_id, transaction_id, exercise_id, opts)
  data
end

#get_fit_with_http_info(user_id, transaction_id, exercise_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Get FIT (beta) Retrieve exercise in FIT format. **Note!** This interface is in beta phase. If there is anything we can help you with or you want to give us feedback, please contact [Support](#support).

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 336

def get_fit_with_http_info(user_id, transaction_id, exercise_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_fit ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_fit"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_fit"
  end
  # verify the required parameter 'exercise_id' is set
  if @api_client.config.client_side_validation && exercise_id.nil?
    fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_fit"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/fit'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'exercise-id' + '}', CGI.escape(exercise_id.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(['*/*'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.get_fit",
    :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: TrainingDataApi#get_fit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_gpx(user_id, transaction_id, exercise_id, opts = {}) ⇒ String

Get GPX Retrieve training session summary data in GPX format

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Options Hash (opts):

  • :include_pause_times (Boolean)

    Whether to add pauses as part of the route. Default is false. (default to false)

Returns:

  • (String)


400
401
402
403
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 400

def get_gpx(user_id, transaction_id, exercise_id, opts = {})
  data, _status_code, _headers = get_gpx_with_http_info(user_id, transaction_id, exercise_id, opts)
  data
end

#get_gpx_with_http_info(user_id, transaction_id, exercise_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Get GPX Retrieve training session summary data in GPX format

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Options Hash (opts):

  • :include_pause_times (Boolean)

    Whether to add pauses as part of the route. Default is false.

Returns:

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

    String data, response status code and response headers



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 413

def get_gpx_with_http_info(user_id, transaction_id, exercise_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_gpx ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_gpx"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_gpx"
  end
  # verify the required parameter 'exercise_id' is set
  if @api_client.config.client_side_validation && exercise_id.nil?
    fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_gpx"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/gpx'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'exercise-id' + '}', CGI.escape(exercise_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includePauseTimes'] = opts[:'include_pause_times'] if !opts[:'include_pause_times'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.get_gpx",
    :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: TrainingDataApi#get_gpx\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_heart_rate_zones(user_id, transaction_id, exercise_id, opts = {}) ⇒ Zones

Get heart rate zones Retrieve heart rate zones in training session

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:



477
478
479
480
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 477

def get_heart_rate_zones(user_id, transaction_id, exercise_id, opts = {})
  data, _status_code, _headers = get_heart_rate_zones_with_http_info(user_id, transaction_id, exercise_id, opts)
  data
end

#get_heart_rate_zones_with_http_info(user_id, transaction_id, exercise_id, opts = {}) ⇒ Array<(Zones, Integer, Hash)>

Get heart rate zones Retrieve heart rate zones in training session

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:

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

    Zones data, response status code and response headers



489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 489

def get_heart_rate_zones_with_http_info(user_id, transaction_id, exercise_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_heart_rate_zones ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_heart_rate_zones"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_heart_rate_zones"
  end
  # verify the required parameter 'exercise_id' is set
  if @api_client.config.client_side_validation && exercise_id.nil?
    fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_heart_rate_zones"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/heart-rate-zones'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'exercise-id' + '}', CGI.escape(exercise_id.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', 'application/xml'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.get_heart_rate_zones",
    :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: TrainingDataApi#get_heart_rate_zones\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_samples(type_id, user_id, transaction_id, exercise_id, opts = {}) ⇒ Sample

Get samples Retrieve sample data of given type

Parameters:

  • type_id (String)

    Sample type id

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:



553
554
555
556
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 553

def get_samples(type_id, user_id, transaction_id, exercise_id, opts = {})
  data, _status_code, _headers = get_samples_with_http_info(type_id, user_id, transaction_id, exercise_id, opts)
  data
end

#get_samples_with_http_info(type_id, user_id, transaction_id, exercise_id, opts = {}) ⇒ Array<(Sample, Integer, Hash)>

Get samples Retrieve sample data of given type

Parameters:

  • type_id (String)

    Sample type id

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:

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

    Sample data, response status code and response headers



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 566

def get_samples_with_http_info(type_id, user_id, transaction_id, exercise_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_samples ...'
  end
  # verify the required parameter 'type_id' is set
  if @api_client.config.client_side_validation && type_id.nil?
    fail ArgumentError, "Missing the required parameter 'type_id' when calling TrainingDataApi.get_samples"
  end
  pattern = Regexp.new(/[0-9]+/)
  if @api_client.config.client_side_validation && type_id !~ pattern
    fail ArgumentError, "invalid value for 'type_id' when calling TrainingDataApi.get_samples, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_samples"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_samples"
  end
  # verify the required parameter 'exercise_id' is set
  if @api_client.config.client_side_validation && exercise_id.nil?
    fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_samples"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples/{type-id}'.sub('{' + 'type-id' + '}', CGI.escape(type_id.to_s)).sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'exercise-id' + '}', CGI.escape(exercise_id.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', 'application/xml'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.get_samples",
    :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: TrainingDataApi#get_samples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_tcx(user_id, transaction_id, exercise_id, opts = {}) ⇒ String

Get TCX Retrieve exercise in TCX format

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:

  • (String)


638
639
640
641
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 638

def get_tcx(user_id, transaction_id, exercise_id, opts = {})
  data, _status_code, _headers = get_tcx_with_http_info(user_id, transaction_id, exercise_id, opts)
  data
end

#get_tcx_with_http_info(user_id, transaction_id, exercise_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Get TCX Retrieve exercise in TCX format

Parameters:

  • user_id (Integer)

    User identifier

  • transaction_id (Integer)

    Transaction identifier

  • exercise_id (Integer)

    Exercise identifier

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 650

def get_tcx_with_http_info(user_id, transaction_id, exercise_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_tcx ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_tcx"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_tcx"
  end
  # verify the required parameter 'exercise_id' is set
  if @api_client.config.client_side_validation && exercise_id.nil?
    fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_tcx"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/tcx'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'exercise-id' + '}', CGI.escape(exercise_id.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/vnd.garmin.tcx+xml'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.get_tcx",
    :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: TrainingDataApi#get_tcx\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_exercises(transaction_id, user_id, opts = {}) ⇒ Exercises

List exercises After successfully initiating a transaction, training sessions included within it can be retrieved with the provided transactionId.

Parameters:

  • transaction_id (Integer)

    Transaction identifier

  • user_id (Integer)

    User identifier

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

    the optional parameters

Returns:



712
713
714
715
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 712

def list_exercises(transaction_id, user_id, opts = {})
  data, _status_code, _headers = list_exercises_with_http_info(transaction_id, user_id, opts)
  data
end

#list_exercises_with_http_info(transaction_id, user_id, opts = {}) ⇒ Array<(Exercises, Integer, Hash)>

List exercises After successfully initiating a transaction, training sessions included within it can be retrieved with the provided transactionId.

Parameters:

  • transaction_id (Integer)

    Transaction identifier

  • user_id (Integer)

    User identifier

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

    the optional parameters

Returns:

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

    Exercises data, response status code and response headers



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/polar-accesslink-api-gem/api/training_data_api.rb', line 723

def list_exercises_with_http_info(transaction_id, user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrainingDataApi.list_exercises ...'
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.list_exercises"
  end
  pattern = Regexp.new(/[0-9]+/)
  if @api_client.config.client_side_validation && transaction_id !~ pattern
    fail ArgumentError, "invalid value for 'transaction_id' when calling TrainingDataApi.list_exercises, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.list_exercises"
  end
  pattern = Regexp.new(/[0-9]+/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling TrainingDataApi.list_exercises, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v3/users/{user-id}/exercise-transactions/{transaction-id}'.sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'user-id' + '}', CGI.escape(user_id.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', 'application/xml'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TrainingDataApi.list_exercises",
    :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: TrainingDataApi#list_exercises\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end