polar-accesslink-api-gem 0.1.0

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