polar_accesslink 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/README.md +170 -0
  5. data/Rakefile +10 -0
  6. data/docs/Activity.md +33 -0
  7. data/docs/ActivityLog.md +17 -0
  8. data/docs/ActivityStepSample.md +19 -0
  9. data/docs/ActivityStepSamples.md +19 -0
  10. data/docs/ActivityZoneSample.md +19 -0
  11. data/docs/ActivityZoneSamples.md +19 -0
  12. data/docs/AvailableUserData.md +21 -0
  13. data/docs/AvailableUserDatas.md +17 -0
  14. data/docs/CreatedWebhook.md +17 -0
  15. data/docs/CreatedWebhookData.md +23 -0
  16. data/docs/DailyActivityApi.md +339 -0
  17. data/docs/DurationZone.md +19 -0
  18. data/docs/Error.md +25 -0
  19. data/docs/Exercise.md +47 -0
  20. data/docs/ExerciseHashId.md +45 -0
  21. data/docs/Exercises.md +17 -0
  22. data/docs/ExercisesApi.md +163 -0
  23. data/docs/HeartRate.md +19 -0
  24. data/docs/PhysicalInfoApi.md +227 -0
  25. data/docs/PhysicalInformation.md +39 -0
  26. data/docs/PhysicalInformations.md +17 -0
  27. data/docs/PullNotificationsApi.md +58 -0
  28. data/docs/Register.md +17 -0
  29. data/docs/Sample.md +21 -0
  30. data/docs/Samples.md +17 -0
  31. data/docs/TrainingDataApi.md +571 -0
  32. data/docs/TransactionLocation.md +19 -0
  33. data/docs/User.md +35 -0
  34. data/docs/UserExtraInfo.md +21 -0
  35. data/docs/UsersApi.md +166 -0
  36. data/docs/WebhookInfo.md +17 -0
  37. data/docs/WebhookInfoData.md +21 -0
  38. data/docs/WebhookPatch.md +19 -0
  39. data/docs/WebhookPayload.md +25 -0
  40. data/docs/WebhookPing.md +19 -0
  41. data/docs/WebhookRequest.md +19 -0
  42. data/docs/WebhookType.md +16 -0
  43. data/docs/WebhooksApi.md +221 -0
  44. data/docs/Zone.md +23 -0
  45. data/docs/Zones.md +17 -0
  46. data/lib/.DS_Store +0 -0
  47. data/lib/polar_accesslink/.DS_Store +0 -0
  48. data/lib/polar_accesslink/api/daily_activity_api.rb +463 -0
  49. data/lib/polar_accesslink/api/exercises_api.rb +202 -0
  50. data/lib/polar_accesslink/api/physical_info_api.rb +292 -0
  51. data/lib/polar_accesslink/api/pull_notifications_api.rb +78 -0
  52. data/lib/polar_accesslink/api/training_data_api.rb +772 -0
  53. data/lib/polar_accesslink/api/users_api.rb +218 -0
  54. data/lib/polar_accesslink/api/webhooks_api.rb +274 -0
  55. data/lib/polar_accesslink/api_client.rb +386 -0
  56. data/lib/polar_accesslink/api_error.rb +57 -0
  57. data/lib/polar_accesslink/configuration.rb +255 -0
  58. data/lib/polar_accesslink/models/activity.rb +288 -0
  59. data/lib/polar_accesslink/models/activity_log.rb +210 -0
  60. data/lib/polar_accesslink/models/activity_step_sample.rb +218 -0
  61. data/lib/polar_accesslink/models/activity_step_samples.rb +220 -0
  62. data/lib/polar_accesslink/models/activity_zone_sample.rb +220 -0
  63. data/lib/polar_accesslink/models/activity_zone_samples.rb +220 -0
  64. data/lib/polar_accesslink/models/available_user_data.rb +262 -0
  65. data/lib/polar_accesslink/models/available_user_datas.rb +210 -0
  66. data/lib/polar_accesslink/models/created_webhook.rb +206 -0
  67. data/lib/polar_accesslink/models/created_webhook_data.rb +236 -0
  68. data/lib/polar_accesslink/models/duration_zone.rb +218 -0
  69. data/lib/polar_accesslink/models/error.rb +248 -0
  70. data/lib/polar_accesslink/models/exercise.rb +357 -0
  71. data/lib/polar_accesslink/models/exercise_hash_id.rb +347 -0
  72. data/lib/polar_accesslink/models/exercises.rb +210 -0
  73. data/lib/polar_accesslink/models/heart_rate.rb +218 -0
  74. data/lib/polar_accesslink/models/physical_information.rb +352 -0
  75. data/lib/polar_accesslink/models/physical_informations.rb +210 -0
  76. data/lib/polar_accesslink/models/register.rb +213 -0
  77. data/lib/polar_accesslink/models/sample.rb +228 -0
  78. data/lib/polar_accesslink/models/samples.rb +210 -0
  79. data/lib/polar_accesslink/models/transaction_location.rb +218 -0
  80. data/lib/polar_accesslink/models/user.rb +334 -0
  81. data/lib/polar_accesslink/models/user_extra_info.rb +228 -0
  82. data/lib/polar_accesslink/models/webhook_info.rb +206 -0
  83. data/lib/polar_accesslink/models/webhook_info_data.rb +226 -0
  84. data/lib/polar_accesslink/models/webhook_patch.rb +219 -0
  85. data/lib/polar_accesslink/models/webhook_payload.rb +246 -0
  86. data/lib/polar_accesslink/models/webhook_ping.rb +252 -0
  87. data/lib/polar_accesslink/models/webhook_request.rb +229 -0
  88. data/lib/polar_accesslink/models/webhook_type.rb +37 -0
  89. data/lib/polar_accesslink/models/zone.rb +238 -0
  90. data/lib/polar_accesslink/models/zones.rb +210 -0
  91. data/lib/polar_accesslink/version.rb +15 -0
  92. data/lib/polar_accesslink.rb +79 -0
  93. data/polar_accesslink-1.0.0.gem +0 -0
  94. data/polar_accesslink.gemspec +38 -0
  95. data/spec/api/daily_activity_api_spec.rb +114 -0
  96. data/spec/api/exercises_api_spec.rb +70 -0
  97. data/spec/api/physical_info_api_spec.rb +87 -0
  98. data/spec/api/pull_notifications_api_spec.rb +46 -0
  99. data/spec/api/training_data_api_spec.rb +172 -0
  100. data/spec/api/users_api_spec.rb +71 -0
  101. data/spec/api/webhooks_api_spec.rb +83 -0
  102. data/spec/api_client_spec.rb +226 -0
  103. data/spec/configuration_spec.rb +42 -0
  104. data/spec/models/activity_log_spec.rb +41 -0
  105. data/spec/models/activity_spec.rb +89 -0
  106. data/spec/models/activity_step_sample_spec.rb +47 -0
  107. data/spec/models/activity_step_samples_spec.rb +47 -0
  108. data/spec/models/activity_zone_sample_spec.rb +47 -0
  109. data/spec/models/activity_zone_samples_spec.rb +47 -0
  110. data/spec/models/available_user_data_spec.rb +57 -0
  111. data/spec/models/available_user_datas_spec.rb +41 -0
  112. data/spec/models/created_webhook_data_spec.rb +59 -0
  113. data/spec/models/created_webhook_spec.rb +41 -0
  114. data/spec/models/duration_zone_spec.rb +47 -0
  115. data/spec/models/error_spec.rb +65 -0
  116. data/spec/models/exercise_hash_id_spec.rb +125 -0
  117. data/spec/models/exercise_spec.rb +131 -0
  118. data/spec/models/exercises_spec.rb +41 -0
  119. data/spec/models/heart_rate_spec.rb +47 -0
  120. data/spec/models/physical_information_spec.rb +111 -0
  121. data/spec/models/physical_informations_spec.rb +41 -0
  122. data/spec/models/register_spec.rb +41 -0
  123. data/spec/models/sample_spec.rb +53 -0
  124. data/spec/models/samples_spec.rb +41 -0
  125. data/spec/models/transaction_location_spec.rb +47 -0
  126. data/spec/models/user_extra_info_spec.rb +53 -0
  127. data/spec/models/user_spec.rb +99 -0
  128. data/spec/models/webhook_info_data_spec.rb +53 -0
  129. data/spec/models/webhook_info_spec.rb +41 -0
  130. data/spec/models/webhook_patch_spec.rb +47 -0
  131. data/spec/models/webhook_payload_spec.rb +65 -0
  132. data/spec/models/webhook_ping_spec.rb +51 -0
  133. data/spec/models/webhook_request_spec.rb +47 -0
  134. data/spec/models/webhook_type_spec.rb +35 -0
  135. data/spec/models/zone_spec.rb +59 -0
  136. data/spec/models/zones_spec.rb +41 -0
  137. data/spec/spec_helper.rb +111 -0
  138. metadata +282 -0
@@ -0,0 +1,772 @@
1
+ =begin
2
+ #Polar Accesslink API
3
+
4
+ #Polar Accesslink API documentation
5
+
6
+ The version of the OpenAPI document: 3.40.0
7
+ Contact: b2bhelpdesk@polar.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PolarAccesslink
16
+ class TrainingDataApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Commit transaction
23
+ # After successfully retrieving training session data within a transaction, partners are expected to commit the transaction.
24
+ # @param transaction_id [Integer] Transaction identifier
25
+ # @param user_id [Integer] User identifier
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [nil]
28
+ def commit_exercise_transaction(transaction_id, user_id, opts = {})
29
+ commit_exercise_transaction_with_http_info(transaction_id, user_id, opts)
30
+ nil
31
+ end
32
+
33
+ # Commit transaction
34
+ # After successfully retrieving training session data within a transaction, partners are expected to commit the transaction.
35
+ # @param transaction_id [Integer] Transaction identifier
36
+ # @param user_id [Integer] User identifier
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
39
+ def commit_exercise_transaction_with_http_info(transaction_id, user_id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.commit_exercise_transaction ...'
42
+ end
43
+ # verify the required parameter 'transaction_id' is set
44
+ if @api_client.config.client_side_validation && transaction_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.commit_exercise_transaction"
46
+ end
47
+ pattern = Regexp.new(/[0-9]+/)
48
+ if @api_client.config.client_side_validation && transaction_id !~ pattern
49
+ fail ArgumentError, "invalid value for 'transaction_id' when calling TrainingDataApi.commit_exercise_transaction, must conform to the pattern #{pattern}."
50
+ end
51
+
52
+ # verify the required parameter 'user_id' is set
53
+ if @api_client.config.client_side_validation && user_id.nil?
54
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.commit_exercise_transaction"
55
+ end
56
+ pattern = Regexp.new(/[0-9]+/)
57
+ if @api_client.config.client_side_validation && user_id !~ pattern
58
+ fail ArgumentError, "invalid value for 'user_id' when calling TrainingDataApi.commit_exercise_transaction, must conform to the pattern #{pattern}."
59
+ end
60
+
61
+ # resource path
62
+ 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))
63
+
64
+ # query parameters
65
+ query_params = opts[:query_params] || {}
66
+
67
+ # header parameters
68
+ header_params = opts[:header_params] || {}
69
+
70
+ # form parameters
71
+ form_params = opts[:form_params] || {}
72
+
73
+ # http body (model)
74
+ post_body = opts[:body]
75
+
76
+ # return_type
77
+ return_type = opts[:return_type]
78
+
79
+ # auth_names
80
+ auth_names = opts[:auth_names] || ['OAuth2']
81
+
82
+ new_options = opts.merge(
83
+ :header_params => header_params,
84
+ :query_params => query_params,
85
+ :form_params => form_params,
86
+ :body => post_body,
87
+ :auth_names => auth_names,
88
+ :return_type => return_type
89
+ )
90
+
91
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug "API called: TrainingDataApi#commit_exercise_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
94
+ end
95
+ return data, status_code, headers
96
+ end
97
+
98
+ # Create transaction
99
+ # Check for new training data and create a new transaction if found.
100
+ # @param user_id [Integer] User identifier
101
+ # @param [Hash] opts the optional parameters
102
+ # @return [TransactionLocation]
103
+ def create_exercise_transaction(user_id, opts = {})
104
+ data, _status_code, _headers = create_exercise_transaction_with_http_info(user_id, opts)
105
+ data
106
+ end
107
+
108
+ # Create transaction
109
+ # Check for new training data and create a new transaction if found.
110
+ # @param user_id [Integer] User identifier
111
+ # @param [Hash] opts the optional parameters
112
+ # @return [Array<(TransactionLocation, Integer, Hash)>] TransactionLocation data, response status code and response headers
113
+ def create_exercise_transaction_with_http_info(user_id, opts = {})
114
+ if @api_client.config.debugging
115
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.create_exercise_transaction ...'
116
+ end
117
+ # verify the required parameter 'user_id' is set
118
+ if @api_client.config.client_side_validation && user_id.nil?
119
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.create_exercise_transaction"
120
+ end
121
+ pattern = Regexp.new(/[0-9]+/)
122
+ if @api_client.config.client_side_validation && user_id !~ pattern
123
+ fail ArgumentError, "invalid value for 'user_id' when calling TrainingDataApi.create_exercise_transaction, must conform to the pattern #{pattern}."
124
+ end
125
+
126
+ # resource path
127
+ local_var_path = '/v3/users/{user-id}/exercise-transactions'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s))
128
+
129
+ # query parameters
130
+ query_params = opts[:query_params] || {}
131
+
132
+ # header parameters
133
+ header_params = opts[:header_params] || {}
134
+ # HTTP header 'Accept' (if needed)
135
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
136
+
137
+ # form parameters
138
+ form_params = opts[:form_params] || {}
139
+
140
+ # http body (model)
141
+ post_body = opts[:body]
142
+
143
+ # return_type
144
+ return_type = opts[:return_type] || 'TransactionLocation'
145
+
146
+ # auth_names
147
+ auth_names = opts[:auth_names] || ['OAuth2']
148
+
149
+ new_options = opts.merge(
150
+ :header_params => header_params,
151
+ :query_params => query_params,
152
+ :form_params => form_params,
153
+ :body => post_body,
154
+ :auth_names => auth_names,
155
+ :return_type => return_type
156
+ )
157
+
158
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
159
+ if @api_client.config.debugging
160
+ @api_client.config.logger.debug "API called: TrainingDataApi#create_exercise_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
161
+ end
162
+ return data, status_code, headers
163
+ end
164
+
165
+ # Get available samples
166
+ # Retrieve list of links to available samples in training session
167
+ # @param user_id [Integer] User identifier
168
+ # @param transaction_id [Integer] Transaction identifier
169
+ # @param exercise_id [Integer] Exercise identifier
170
+ # @param [Hash] opts the optional parameters
171
+ # @return [Samples]
172
+ def get_available_samples(user_id, transaction_id, exercise_id, opts = {})
173
+ data, _status_code, _headers = get_available_samples_with_http_info(user_id, transaction_id, exercise_id, opts)
174
+ data
175
+ end
176
+
177
+ # Get available samples
178
+ # Retrieve list of links to available samples in training session
179
+ # @param user_id [Integer] User identifier
180
+ # @param transaction_id [Integer] Transaction identifier
181
+ # @param exercise_id [Integer] Exercise identifier
182
+ # @param [Hash] opts the optional parameters
183
+ # @return [Array<(Samples, Integer, Hash)>] Samples data, response status code and response headers
184
+ def get_available_samples_with_http_info(user_id, transaction_id, exercise_id, opts = {})
185
+ if @api_client.config.debugging
186
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_available_samples ...'
187
+ end
188
+ # verify the required parameter 'user_id' is set
189
+ if @api_client.config.client_side_validation && user_id.nil?
190
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_available_samples"
191
+ end
192
+ # verify the required parameter 'transaction_id' is set
193
+ if @api_client.config.client_side_validation && transaction_id.nil?
194
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_available_samples"
195
+ end
196
+ # verify the required parameter 'exercise_id' is set
197
+ if @api_client.config.client_side_validation && exercise_id.nil?
198
+ fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_available_samples"
199
+ end
200
+ # resource path
201
+ 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))
202
+
203
+ # query parameters
204
+ query_params = opts[:query_params] || {}
205
+
206
+ # header parameters
207
+ header_params = opts[:header_params] || {}
208
+ # HTTP header 'Accept' (if needed)
209
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
210
+
211
+ # form parameters
212
+ form_params = opts[:form_params] || {}
213
+
214
+ # http body (model)
215
+ post_body = opts[:body]
216
+
217
+ # return_type
218
+ return_type = opts[:return_type] || 'Samples'
219
+
220
+ # auth_names
221
+ auth_names = opts[:auth_names] || ['OAuth2']
222
+
223
+ new_options = opts.merge(
224
+ :header_params => header_params,
225
+ :query_params => query_params,
226
+ :form_params => form_params,
227
+ :body => post_body,
228
+ :auth_names => auth_names,
229
+ :return_type => return_type
230
+ )
231
+
232
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
233
+ if @api_client.config.debugging
234
+ @api_client.config.logger.debug "API called: TrainingDataApi#get_available_samples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
235
+ end
236
+ return data, status_code, headers
237
+ end
238
+
239
+ # Get exercise summary
240
+ # Retrieve training session summary data
241
+ # @param user_id [Integer] User identifier
242
+ # @param transaction_id [Integer] Transaction identifier
243
+ # @param exercise_id [Integer] Exercise identifier
244
+ # @param [Hash] opts the optional parameters
245
+ # @return [Exercise]
246
+ def get_exercise_summary(user_id, transaction_id, exercise_id, opts = {})
247
+ data, _status_code, _headers = get_exercise_summary_with_http_info(user_id, transaction_id, exercise_id, opts)
248
+ data
249
+ end
250
+
251
+ # Get exercise summary
252
+ # Retrieve training session summary data
253
+ # @param user_id [Integer] User identifier
254
+ # @param transaction_id [Integer] Transaction identifier
255
+ # @param exercise_id [Integer] Exercise identifier
256
+ # @param [Hash] opts the optional parameters
257
+ # @return [Array<(Exercise, Integer, Hash)>] Exercise data, response status code and response headers
258
+ def get_exercise_summary_with_http_info(user_id, transaction_id, exercise_id, opts = {})
259
+ if @api_client.config.debugging
260
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_exercise_summary ...'
261
+ end
262
+ # verify the required parameter 'user_id' is set
263
+ if @api_client.config.client_side_validation && user_id.nil?
264
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_exercise_summary"
265
+ end
266
+ # verify the required parameter 'transaction_id' is set
267
+ if @api_client.config.client_side_validation && transaction_id.nil?
268
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_exercise_summary"
269
+ end
270
+ # verify the required parameter 'exercise_id' is set
271
+ if @api_client.config.client_side_validation && exercise_id.nil?
272
+ fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_exercise_summary"
273
+ end
274
+ # resource path
275
+ 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))
276
+
277
+ # query parameters
278
+ query_params = opts[:query_params] || {}
279
+
280
+ # header parameters
281
+ header_params = opts[:header_params] || {}
282
+ # HTTP header 'Accept' (if needed)
283
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
284
+
285
+ # form parameters
286
+ form_params = opts[:form_params] || {}
287
+
288
+ # http body (model)
289
+ post_body = opts[:body]
290
+
291
+ # return_type
292
+ return_type = opts[:return_type] || 'Exercise'
293
+
294
+ # auth_names
295
+ auth_names = opts[:auth_names] || ['OAuth2']
296
+
297
+ new_options = opts.merge(
298
+ :header_params => header_params,
299
+ :query_params => query_params,
300
+ :form_params => form_params,
301
+ :body => post_body,
302
+ :auth_names => auth_names,
303
+ :return_type => return_type
304
+ )
305
+
306
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
307
+ if @api_client.config.debugging
308
+ @api_client.config.logger.debug "API called: TrainingDataApi#get_exercise_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
309
+ end
310
+ return data, status_code, headers
311
+ end
312
+
313
+ # Get FIT (beta)
314
+ # 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).
315
+ # @param user_id [Integer] User identifier
316
+ # @param transaction_id [Integer] Transaction identifier
317
+ # @param exercise_id [Integer] Exercise identifier
318
+ # @param [Hash] opts the optional parameters
319
+ # @return [String]
320
+ def get_fit(user_id, transaction_id, exercise_id, opts = {})
321
+ data, _status_code, _headers = get_fit_with_http_info(user_id, transaction_id, exercise_id, opts)
322
+ data
323
+ end
324
+
325
+ # Get FIT (beta)
326
+ # 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).
327
+ # @param user_id [Integer] User identifier
328
+ # @param transaction_id [Integer] Transaction identifier
329
+ # @param exercise_id [Integer] Exercise identifier
330
+ # @param [Hash] opts the optional parameters
331
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
332
+ def get_fit_with_http_info(user_id, transaction_id, exercise_id, opts = {})
333
+ if @api_client.config.debugging
334
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_fit ...'
335
+ end
336
+ # verify the required parameter 'user_id' is set
337
+ if @api_client.config.client_side_validation && user_id.nil?
338
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_fit"
339
+ end
340
+ # verify the required parameter 'transaction_id' is set
341
+ if @api_client.config.client_side_validation && transaction_id.nil?
342
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_fit"
343
+ end
344
+ # verify the required parameter 'exercise_id' is set
345
+ if @api_client.config.client_side_validation && exercise_id.nil?
346
+ fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_fit"
347
+ end
348
+ # resource path
349
+ 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))
350
+
351
+ # query parameters
352
+ query_params = opts[:query_params] || {}
353
+
354
+ # header parameters
355
+ header_params = opts[:header_params] || {}
356
+ # HTTP header 'Accept' (if needed)
357
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
358
+
359
+ # form parameters
360
+ form_params = opts[:form_params] || {}
361
+
362
+ # http body (model)
363
+ post_body = opts[:body]
364
+
365
+ # return_type
366
+ return_type = opts[:return_type] || 'String'
367
+
368
+ # auth_names
369
+ auth_names = opts[:auth_names] || ['OAuth2']
370
+
371
+ new_options = opts.merge(
372
+ :header_params => header_params,
373
+ :query_params => query_params,
374
+ :form_params => form_params,
375
+ :body => post_body,
376
+ :auth_names => auth_names,
377
+ :return_type => return_type
378
+ )
379
+
380
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
381
+ if @api_client.config.debugging
382
+ @api_client.config.logger.debug "API called: TrainingDataApi#get_fit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
383
+ end
384
+ return data, status_code, headers
385
+ end
386
+
387
+ # Get GPX
388
+ # Retrieve training session summary data in GPX format
389
+ # @param user_id [Integer] User identifier
390
+ # @param transaction_id [Integer] Transaction identifier
391
+ # @param exercise_id [Integer] Exercise identifier
392
+ # @param [Hash] opts the optional parameters
393
+ # @return [String]
394
+ def get_gpx(user_id, transaction_id, exercise_id, opts = {})
395
+ data, _status_code, _headers = get_gpx_with_http_info(user_id, transaction_id, exercise_id, opts)
396
+ data
397
+ end
398
+
399
+ # Get GPX
400
+ # Retrieve training session summary data in GPX format
401
+ # @param user_id [Integer] User identifier
402
+ # @param transaction_id [Integer] Transaction identifier
403
+ # @param exercise_id [Integer] Exercise identifier
404
+ # @param [Hash] opts the optional parameters
405
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
406
+ def get_gpx_with_http_info(user_id, transaction_id, exercise_id, opts = {})
407
+ if @api_client.config.debugging
408
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_gpx ...'
409
+ end
410
+ # verify the required parameter 'user_id' is set
411
+ if @api_client.config.client_side_validation && user_id.nil?
412
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_gpx"
413
+ end
414
+ # verify the required parameter 'transaction_id' is set
415
+ if @api_client.config.client_side_validation && transaction_id.nil?
416
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_gpx"
417
+ end
418
+ # verify the required parameter 'exercise_id' is set
419
+ if @api_client.config.client_side_validation && exercise_id.nil?
420
+ fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_gpx"
421
+ end
422
+ # resource path
423
+ 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))
424
+
425
+ # query parameters
426
+ query_params = opts[:query_params] || {}
427
+
428
+ # header parameters
429
+ header_params = opts[:header_params] || {}
430
+ # HTTP header 'Accept' (if needed)
431
+ header_params['Accept'] = @api_client.select_header_accept(['application/gpx+xml'])
432
+
433
+ # form parameters
434
+ form_params = opts[:form_params] || {}
435
+
436
+ # http body (model)
437
+ post_body = opts[:body]
438
+
439
+ # return_type
440
+ return_type = opts[:return_type] || 'String'
441
+
442
+ # auth_names
443
+ auth_names = opts[:auth_names] || ['OAuth2']
444
+
445
+ new_options = opts.merge(
446
+ :header_params => header_params,
447
+ :query_params => query_params,
448
+ :form_params => form_params,
449
+ :body => post_body,
450
+ :auth_names => auth_names,
451
+ :return_type => return_type
452
+ )
453
+
454
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
455
+ if @api_client.config.debugging
456
+ @api_client.config.logger.debug "API called: TrainingDataApi#get_gpx\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
457
+ end
458
+ return data, status_code, headers
459
+ end
460
+
461
+ # Get heart rate zones
462
+ # Retrieve heart rate zones in training session
463
+ # @param user_id [Integer] User identifier
464
+ # @param transaction_id [Integer] Transaction identifier
465
+ # @param exercise_id [Integer] Exercise identifier
466
+ # @param [Hash] opts the optional parameters
467
+ # @return [Zones]
468
+ def get_heart_rate_zones(user_id, transaction_id, exercise_id, opts = {})
469
+ data, _status_code, _headers = get_heart_rate_zones_with_http_info(user_id, transaction_id, exercise_id, opts)
470
+ data
471
+ end
472
+
473
+ # Get heart rate zones
474
+ # Retrieve heart rate zones in training session
475
+ # @param user_id [Integer] User identifier
476
+ # @param transaction_id [Integer] Transaction identifier
477
+ # @param exercise_id [Integer] Exercise identifier
478
+ # @param [Hash] opts the optional parameters
479
+ # @return [Array<(Zones, Integer, Hash)>] Zones data, response status code and response headers
480
+ def get_heart_rate_zones_with_http_info(user_id, transaction_id, exercise_id, opts = {})
481
+ if @api_client.config.debugging
482
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_heart_rate_zones ...'
483
+ end
484
+ # verify the required parameter 'user_id' is set
485
+ if @api_client.config.client_side_validation && user_id.nil?
486
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_heart_rate_zones"
487
+ end
488
+ # verify the required parameter 'transaction_id' is set
489
+ if @api_client.config.client_side_validation && transaction_id.nil?
490
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_heart_rate_zones"
491
+ end
492
+ # verify the required parameter 'exercise_id' is set
493
+ if @api_client.config.client_side_validation && exercise_id.nil?
494
+ fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_heart_rate_zones"
495
+ end
496
+ # resource path
497
+ 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))
498
+
499
+ # query parameters
500
+ query_params = opts[:query_params] || {}
501
+
502
+ # header parameters
503
+ header_params = opts[:header_params] || {}
504
+ # HTTP header 'Accept' (if needed)
505
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
506
+
507
+ # form parameters
508
+ form_params = opts[:form_params] || {}
509
+
510
+ # http body (model)
511
+ post_body = opts[:body]
512
+
513
+ # return_type
514
+ return_type = opts[:return_type] || 'Zones'
515
+
516
+ # auth_names
517
+ auth_names = opts[:auth_names] || ['OAuth2']
518
+
519
+ new_options = opts.merge(
520
+ :header_params => header_params,
521
+ :query_params => query_params,
522
+ :form_params => form_params,
523
+ :body => post_body,
524
+ :auth_names => auth_names,
525
+ :return_type => return_type
526
+ )
527
+
528
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
529
+ if @api_client.config.debugging
530
+ @api_client.config.logger.debug "API called: TrainingDataApi#get_heart_rate_zones\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
531
+ end
532
+ return data, status_code, headers
533
+ end
534
+
535
+ # Get samples
536
+ # Retrieve sample data of given type
537
+ # @param type_id [String] Sample type id
538
+ # @param user_id [Integer] User identifier
539
+ # @param transaction_id [Integer] Transaction identifier
540
+ # @param exercise_id [Integer] Exercise identifier
541
+ # @param [Hash] opts the optional parameters
542
+ # @return [Sample]
543
+ def get_samples(type_id, user_id, transaction_id, exercise_id, opts = {})
544
+ data, _status_code, _headers = get_samples_with_http_info(type_id, user_id, transaction_id, exercise_id, opts)
545
+ data
546
+ end
547
+
548
+ # Get samples
549
+ # Retrieve sample data of given type
550
+ # @param type_id [String] Sample type id
551
+ # @param user_id [Integer] User identifier
552
+ # @param transaction_id [Integer] Transaction identifier
553
+ # @param exercise_id [Integer] Exercise identifier
554
+ # @param [Hash] opts the optional parameters
555
+ # @return [Array<(Sample, Integer, Hash)>] Sample data, response status code and response headers
556
+ def get_samples_with_http_info(type_id, user_id, transaction_id, exercise_id, opts = {})
557
+ if @api_client.config.debugging
558
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_samples ...'
559
+ end
560
+ # verify the required parameter 'type_id' is set
561
+ if @api_client.config.client_side_validation && type_id.nil?
562
+ fail ArgumentError, "Missing the required parameter 'type_id' when calling TrainingDataApi.get_samples"
563
+ end
564
+ pattern = Regexp.new(/[0-9]+/)
565
+ if @api_client.config.client_side_validation && type_id !~ pattern
566
+ fail ArgumentError, "invalid value for 'type_id' when calling TrainingDataApi.get_samples, must conform to the pattern #{pattern}."
567
+ end
568
+
569
+ # verify the required parameter 'user_id' is set
570
+ if @api_client.config.client_side_validation && user_id.nil?
571
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_samples"
572
+ end
573
+ # verify the required parameter 'transaction_id' is set
574
+ if @api_client.config.client_side_validation && transaction_id.nil?
575
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_samples"
576
+ end
577
+ # verify the required parameter 'exercise_id' is set
578
+ if @api_client.config.client_side_validation && exercise_id.nil?
579
+ fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_samples"
580
+ end
581
+ # resource path
582
+ 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))
583
+
584
+ # query parameters
585
+ query_params = opts[:query_params] || {}
586
+
587
+ # header parameters
588
+ header_params = opts[:header_params] || {}
589
+ # HTTP header 'Accept' (if needed)
590
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
591
+
592
+ # form parameters
593
+ form_params = opts[:form_params] || {}
594
+
595
+ # http body (model)
596
+ post_body = opts[:body]
597
+
598
+ # return_type
599
+ return_type = opts[:return_type] || 'Sample'
600
+
601
+ # auth_names
602
+ auth_names = opts[:auth_names] || ['OAuth2']
603
+
604
+ new_options = opts.merge(
605
+ :header_params => header_params,
606
+ :query_params => query_params,
607
+ :form_params => form_params,
608
+ :body => post_body,
609
+ :auth_names => auth_names,
610
+ :return_type => return_type
611
+ )
612
+
613
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
614
+ if @api_client.config.debugging
615
+ @api_client.config.logger.debug "API called: TrainingDataApi#get_samples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
616
+ end
617
+ return data, status_code, headers
618
+ end
619
+
620
+ # Get TCX
621
+ # Retrieve exercise in TCX format
622
+ # @param user_id [Integer] User identifier
623
+ # @param transaction_id [Integer] Transaction identifier
624
+ # @param exercise_id [Integer] Exercise identifier
625
+ # @param [Hash] opts the optional parameters
626
+ # @return [String]
627
+ def get_tcx(user_id, transaction_id, exercise_id, opts = {})
628
+ data, _status_code, _headers = get_tcx_with_http_info(user_id, transaction_id, exercise_id, opts)
629
+ data
630
+ end
631
+
632
+ # Get TCX
633
+ # Retrieve exercise in TCX format
634
+ # @param user_id [Integer] User identifier
635
+ # @param transaction_id [Integer] Transaction identifier
636
+ # @param exercise_id [Integer] Exercise identifier
637
+ # @param [Hash] opts the optional parameters
638
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
639
+ def get_tcx_with_http_info(user_id, transaction_id, exercise_id, opts = {})
640
+ if @api_client.config.debugging
641
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.get_tcx ...'
642
+ end
643
+ # verify the required parameter 'user_id' is set
644
+ if @api_client.config.client_side_validation && user_id.nil?
645
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.get_tcx"
646
+ end
647
+ # verify the required parameter 'transaction_id' is set
648
+ if @api_client.config.client_side_validation && transaction_id.nil?
649
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.get_tcx"
650
+ end
651
+ # verify the required parameter 'exercise_id' is set
652
+ if @api_client.config.client_side_validation && exercise_id.nil?
653
+ fail ArgumentError, "Missing the required parameter 'exercise_id' when calling TrainingDataApi.get_tcx"
654
+ end
655
+ # resource path
656
+ 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))
657
+
658
+ # query parameters
659
+ query_params = opts[:query_params] || {}
660
+
661
+ # header parameters
662
+ header_params = opts[:header_params] || {}
663
+ # HTTP header 'Accept' (if needed)
664
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.garmin.tcx+xml'])
665
+
666
+ # form parameters
667
+ form_params = opts[:form_params] || {}
668
+
669
+ # http body (model)
670
+ post_body = opts[:body]
671
+
672
+ # return_type
673
+ return_type = opts[:return_type] || 'String'
674
+
675
+ # auth_names
676
+ auth_names = opts[:auth_names] || ['OAuth2']
677
+
678
+ new_options = opts.merge(
679
+ :header_params => header_params,
680
+ :query_params => query_params,
681
+ :form_params => form_params,
682
+ :body => post_body,
683
+ :auth_names => auth_names,
684
+ :return_type => return_type
685
+ )
686
+
687
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
688
+ if @api_client.config.debugging
689
+ @api_client.config.logger.debug "API called: TrainingDataApi#get_tcx\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
690
+ end
691
+ return data, status_code, headers
692
+ end
693
+
694
+ # List exercises
695
+ # After successfully initiating a transaction, training sessions included within it can be retrieved with the provided transactionId.
696
+ # @param transaction_id [Integer] Transaction identifier
697
+ # @param user_id [Integer] User identifier
698
+ # @param [Hash] opts the optional parameters
699
+ # @return [Exercises]
700
+ def list_exercises(transaction_id, user_id, opts = {})
701
+ data, _status_code, _headers = list_exercises_with_http_info(transaction_id, user_id, opts)
702
+ data
703
+ end
704
+
705
+ # List exercises
706
+ # After successfully initiating a transaction, training sessions included within it can be retrieved with the provided transactionId.
707
+ # @param transaction_id [Integer] Transaction identifier
708
+ # @param user_id [Integer] User identifier
709
+ # @param [Hash] opts the optional parameters
710
+ # @return [Array<(Exercises, Integer, Hash)>] Exercises data, response status code and response headers
711
+ def list_exercises_with_http_info(transaction_id, user_id, opts = {})
712
+ if @api_client.config.debugging
713
+ @api_client.config.logger.debug 'Calling API: TrainingDataApi.list_exercises ...'
714
+ end
715
+ # verify the required parameter 'transaction_id' is set
716
+ if @api_client.config.client_side_validation && transaction_id.nil?
717
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TrainingDataApi.list_exercises"
718
+ end
719
+ pattern = Regexp.new(/[0-9]+/)
720
+ if @api_client.config.client_side_validation && transaction_id !~ pattern
721
+ fail ArgumentError, "invalid value for 'transaction_id' when calling TrainingDataApi.list_exercises, must conform to the pattern #{pattern}."
722
+ end
723
+
724
+ # verify the required parameter 'user_id' is set
725
+ if @api_client.config.client_side_validation && user_id.nil?
726
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TrainingDataApi.list_exercises"
727
+ end
728
+ pattern = Regexp.new(/[0-9]+/)
729
+ if @api_client.config.client_side_validation && user_id !~ pattern
730
+ fail ArgumentError, "invalid value for 'user_id' when calling TrainingDataApi.list_exercises, must conform to the pattern #{pattern}."
731
+ end
732
+
733
+ # resource path
734
+ 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))
735
+
736
+ # query parameters
737
+ query_params = opts[:query_params] || {}
738
+
739
+ # header parameters
740
+ header_params = opts[:header_params] || {}
741
+ # HTTP header 'Accept' (if needed)
742
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
743
+
744
+ # form parameters
745
+ form_params = opts[:form_params] || {}
746
+
747
+ # http body (model)
748
+ post_body = opts[:body]
749
+
750
+ # return_type
751
+ return_type = opts[:return_type] || 'Exercises'
752
+
753
+ # auth_names
754
+ auth_names = opts[:auth_names] || ['OAuth2']
755
+
756
+ new_options = opts.merge(
757
+ :header_params => header_params,
758
+ :query_params => query_params,
759
+ :form_params => form_params,
760
+ :body => post_body,
761
+ :auth_names => auth_names,
762
+ :return_type => return_type
763
+ )
764
+
765
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
766
+ if @api_client.config.debugging
767
+ @api_client.config.logger.debug "API called: TrainingDataApi#list_exercises\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
768
+ end
769
+ return data, status_code, headers
770
+ end
771
+ end
772
+ end