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.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +70 -0
- data/README.md +170 -0
- data/Rakefile +10 -0
- data/docs/Activity.md +33 -0
- data/docs/ActivityLog.md +17 -0
- data/docs/ActivityStepSample.md +19 -0
- data/docs/ActivityStepSamples.md +19 -0
- data/docs/ActivityZoneSample.md +19 -0
- data/docs/ActivityZoneSamples.md +19 -0
- data/docs/AvailableUserData.md +21 -0
- data/docs/AvailableUserDatas.md +17 -0
- data/docs/CreatedWebhook.md +17 -0
- data/docs/CreatedWebhookData.md +23 -0
- data/docs/DailyActivityApi.md +339 -0
- data/docs/DurationZone.md +19 -0
- data/docs/Error.md +25 -0
- data/docs/Exercise.md +47 -0
- data/docs/ExerciseHashId.md +45 -0
- data/docs/Exercises.md +17 -0
- data/docs/ExercisesApi.md +163 -0
- data/docs/HeartRate.md +19 -0
- data/docs/PhysicalInfoApi.md +227 -0
- data/docs/PhysicalInformation.md +39 -0
- data/docs/PhysicalInformations.md +17 -0
- data/docs/PullNotificationsApi.md +58 -0
- data/docs/Register.md +17 -0
- data/docs/Sample.md +21 -0
- data/docs/Samples.md +17 -0
- data/docs/TrainingDataApi.md +571 -0
- data/docs/TransactionLocation.md +19 -0
- data/docs/User.md +35 -0
- data/docs/UserExtraInfo.md +21 -0
- data/docs/UsersApi.md +166 -0
- data/docs/WebhookInfo.md +17 -0
- data/docs/WebhookInfoData.md +21 -0
- data/docs/WebhookPatch.md +19 -0
- data/docs/WebhookPayload.md +25 -0
- data/docs/WebhookPing.md +19 -0
- data/docs/WebhookRequest.md +19 -0
- data/docs/WebhookType.md +16 -0
- data/docs/WebhooksApi.md +221 -0
- data/docs/Zone.md +23 -0
- data/docs/Zones.md +17 -0
- data/lib/.DS_Store +0 -0
- data/lib/polar_accesslink/.DS_Store +0 -0
- data/lib/polar_accesslink/api/daily_activity_api.rb +463 -0
- data/lib/polar_accesslink/api/exercises_api.rb +202 -0
- data/lib/polar_accesslink/api/physical_info_api.rb +292 -0
- data/lib/polar_accesslink/api/pull_notifications_api.rb +78 -0
- data/lib/polar_accesslink/api/training_data_api.rb +772 -0
- data/lib/polar_accesslink/api/users_api.rb +218 -0
- data/lib/polar_accesslink/api/webhooks_api.rb +274 -0
- data/lib/polar_accesslink/api_client.rb +386 -0
- data/lib/polar_accesslink/api_error.rb +57 -0
- data/lib/polar_accesslink/configuration.rb +255 -0
- data/lib/polar_accesslink/models/activity.rb +288 -0
- data/lib/polar_accesslink/models/activity_log.rb +210 -0
- data/lib/polar_accesslink/models/activity_step_sample.rb +218 -0
- data/lib/polar_accesslink/models/activity_step_samples.rb +220 -0
- data/lib/polar_accesslink/models/activity_zone_sample.rb +220 -0
- data/lib/polar_accesslink/models/activity_zone_samples.rb +220 -0
- data/lib/polar_accesslink/models/available_user_data.rb +262 -0
- data/lib/polar_accesslink/models/available_user_datas.rb +210 -0
- data/lib/polar_accesslink/models/created_webhook.rb +206 -0
- data/lib/polar_accesslink/models/created_webhook_data.rb +236 -0
- data/lib/polar_accesslink/models/duration_zone.rb +218 -0
- data/lib/polar_accesslink/models/error.rb +248 -0
- data/lib/polar_accesslink/models/exercise.rb +357 -0
- data/lib/polar_accesslink/models/exercise_hash_id.rb +347 -0
- data/lib/polar_accesslink/models/exercises.rb +210 -0
- data/lib/polar_accesslink/models/heart_rate.rb +218 -0
- data/lib/polar_accesslink/models/physical_information.rb +352 -0
- data/lib/polar_accesslink/models/physical_informations.rb +210 -0
- data/lib/polar_accesslink/models/register.rb +213 -0
- data/lib/polar_accesslink/models/sample.rb +228 -0
- data/lib/polar_accesslink/models/samples.rb +210 -0
- data/lib/polar_accesslink/models/transaction_location.rb +218 -0
- data/lib/polar_accesslink/models/user.rb +334 -0
- data/lib/polar_accesslink/models/user_extra_info.rb +228 -0
- data/lib/polar_accesslink/models/webhook_info.rb +206 -0
- data/lib/polar_accesslink/models/webhook_info_data.rb +226 -0
- data/lib/polar_accesslink/models/webhook_patch.rb +219 -0
- data/lib/polar_accesslink/models/webhook_payload.rb +246 -0
- data/lib/polar_accesslink/models/webhook_ping.rb +252 -0
- data/lib/polar_accesslink/models/webhook_request.rb +229 -0
- data/lib/polar_accesslink/models/webhook_type.rb +37 -0
- data/lib/polar_accesslink/models/zone.rb +238 -0
- data/lib/polar_accesslink/models/zones.rb +210 -0
- data/lib/polar_accesslink/version.rb +15 -0
- data/lib/polar_accesslink.rb +79 -0
- data/polar_accesslink-1.0.0.gem +0 -0
- data/polar_accesslink.gemspec +38 -0
- data/spec/api/daily_activity_api_spec.rb +114 -0
- data/spec/api/exercises_api_spec.rb +70 -0
- data/spec/api/physical_info_api_spec.rb +87 -0
- data/spec/api/pull_notifications_api_spec.rb +46 -0
- data/spec/api/training_data_api_spec.rb +172 -0
- data/spec/api/users_api_spec.rb +71 -0
- data/spec/api/webhooks_api_spec.rb +83 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/activity_log_spec.rb +41 -0
- data/spec/models/activity_spec.rb +89 -0
- data/spec/models/activity_step_sample_spec.rb +47 -0
- data/spec/models/activity_step_samples_spec.rb +47 -0
- data/spec/models/activity_zone_sample_spec.rb +47 -0
- data/spec/models/activity_zone_samples_spec.rb +47 -0
- data/spec/models/available_user_data_spec.rb +57 -0
- data/spec/models/available_user_datas_spec.rb +41 -0
- data/spec/models/created_webhook_data_spec.rb +59 -0
- data/spec/models/created_webhook_spec.rb +41 -0
- data/spec/models/duration_zone_spec.rb +47 -0
- data/spec/models/error_spec.rb +65 -0
- data/spec/models/exercise_hash_id_spec.rb +125 -0
- data/spec/models/exercise_spec.rb +131 -0
- data/spec/models/exercises_spec.rb +41 -0
- data/spec/models/heart_rate_spec.rb +47 -0
- data/spec/models/physical_information_spec.rb +111 -0
- data/spec/models/physical_informations_spec.rb +41 -0
- data/spec/models/register_spec.rb +41 -0
- data/spec/models/sample_spec.rb +53 -0
- data/spec/models/samples_spec.rb +41 -0
- data/spec/models/transaction_location_spec.rb +47 -0
- data/spec/models/user_extra_info_spec.rb +53 -0
- data/spec/models/user_spec.rb +99 -0
- data/spec/models/webhook_info_data_spec.rb +53 -0
- data/spec/models/webhook_info_spec.rb +41 -0
- data/spec/models/webhook_patch_spec.rb +47 -0
- data/spec/models/webhook_payload_spec.rb +65 -0
- data/spec/models/webhook_ping_spec.rb +51 -0
- data/spec/models/webhook_request_spec.rb +47 -0
- data/spec/models/webhook_type_spec.rb +35 -0
- data/spec/models/zone_spec.rb +59 -0
- data/spec/models/zones_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- metadata +282 -0
@@ -0,0 +1,463 @@
|
|
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 DailyActivityApi
|
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 activity summary 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_activity_transaction(transaction_id, user_id, opts = {})
|
29
|
+
commit_activity_transaction_with_http_info(transaction_id, user_id, opts)
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
# Commit transaction
|
34
|
+
# After successfully retrieving activity summary 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_activity_transaction_with_http_info(transaction_id, user_id, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: DailyActivityApi.commit_activity_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 DailyActivityApi.commit_activity_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 DailyActivityApi.commit_activity_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 DailyActivityApi.commit_activity_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 DailyActivityApi.commit_activity_transaction, must conform to the pattern #{pattern}."
|
59
|
+
end
|
60
|
+
|
61
|
+
# resource path
|
62
|
+
local_var_path = '/v3/users/{user-id}/activity-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: DailyActivityApi#commit_activity_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
|
+
# Initiate activity transaction. Check for new activity summaries 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_activity_transaction(user_id, opts = {})
|
104
|
+
data, _status_code, _headers = create_activity_transaction_with_http_info(user_id, opts)
|
105
|
+
data
|
106
|
+
end
|
107
|
+
|
108
|
+
# Create transaction
|
109
|
+
# Initiate activity transaction. Check for new activity summaries 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_activity_transaction_with_http_info(user_id, opts = {})
|
114
|
+
if @api_client.config.debugging
|
115
|
+
@api_client.config.logger.debug 'Calling API: DailyActivityApi.create_activity_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 DailyActivityApi.create_activity_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 DailyActivityApi.create_activity_transaction, must conform to the pattern #{pattern}."
|
124
|
+
end
|
125
|
+
|
126
|
+
# resource path
|
127
|
+
local_var_path = '/v3/users/{user-id}/activity-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: DailyActivityApi#create_activity_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
161
|
+
end
|
162
|
+
return data, status_code, headers
|
163
|
+
end
|
164
|
+
|
165
|
+
# Get activity summary
|
166
|
+
# @param user_id [Integer] User identifier
|
167
|
+
# @param transaction_id [Integer] Transaction identifier
|
168
|
+
# @param activity_id [Integer] Activity summary identifier
|
169
|
+
# @param [Hash] opts the optional parameters
|
170
|
+
# @return [Activity]
|
171
|
+
def get_activity_summary(user_id, transaction_id, activity_id, opts = {})
|
172
|
+
data, _status_code, _headers = get_activity_summary_with_http_info(user_id, transaction_id, activity_id, opts)
|
173
|
+
data
|
174
|
+
end
|
175
|
+
|
176
|
+
# Get activity summary
|
177
|
+
# @param user_id [Integer] User identifier
|
178
|
+
# @param transaction_id [Integer] Transaction identifier
|
179
|
+
# @param activity_id [Integer] Activity summary identifier
|
180
|
+
# @param [Hash] opts the optional parameters
|
181
|
+
# @return [Array<(Activity, Integer, Hash)>] Activity data, response status code and response headers
|
182
|
+
def get_activity_summary_with_http_info(user_id, transaction_id, activity_id, opts = {})
|
183
|
+
if @api_client.config.debugging
|
184
|
+
@api_client.config.logger.debug 'Calling API: DailyActivityApi.get_activity_summary ...'
|
185
|
+
end
|
186
|
+
# verify the required parameter 'user_id' is set
|
187
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
188
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling DailyActivityApi.get_activity_summary"
|
189
|
+
end
|
190
|
+
# verify the required parameter 'transaction_id' is set
|
191
|
+
if @api_client.config.client_side_validation && transaction_id.nil?
|
192
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling DailyActivityApi.get_activity_summary"
|
193
|
+
end
|
194
|
+
# verify the required parameter 'activity_id' is set
|
195
|
+
if @api_client.config.client_side_validation && activity_id.nil?
|
196
|
+
fail ArgumentError, "Missing the required parameter 'activity_id' when calling DailyActivityApi.get_activity_summary"
|
197
|
+
end
|
198
|
+
# resource path
|
199
|
+
local_var_path = '/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'activity-id' + '}', CGI.escape(activity_id.to_s))
|
200
|
+
|
201
|
+
# query parameters
|
202
|
+
query_params = opts[:query_params] || {}
|
203
|
+
|
204
|
+
# header parameters
|
205
|
+
header_params = opts[:header_params] || {}
|
206
|
+
# HTTP header 'Accept' (if needed)
|
207
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
|
208
|
+
|
209
|
+
# form parameters
|
210
|
+
form_params = opts[:form_params] || {}
|
211
|
+
|
212
|
+
# http body (model)
|
213
|
+
post_body = opts[:body]
|
214
|
+
|
215
|
+
# return_type
|
216
|
+
return_type = opts[:return_type] || 'Activity'
|
217
|
+
|
218
|
+
# auth_names
|
219
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
220
|
+
|
221
|
+
new_options = opts.merge(
|
222
|
+
:header_params => header_params,
|
223
|
+
:query_params => query_params,
|
224
|
+
:form_params => form_params,
|
225
|
+
:body => post_body,
|
226
|
+
:auth_names => auth_names,
|
227
|
+
:return_type => return_type
|
228
|
+
)
|
229
|
+
|
230
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
231
|
+
if @api_client.config.debugging
|
232
|
+
@api_client.config.logger.debug "API called: DailyActivityApi#get_activity_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
233
|
+
end
|
234
|
+
return data, status_code, headers
|
235
|
+
end
|
236
|
+
|
237
|
+
# Get step samples
|
238
|
+
# Get activity step samples. Example data can be seen from [appendix](#activity-step-time-series).
|
239
|
+
# @param user_id [Integer] User identifier
|
240
|
+
# @param transaction_id [Integer] Transaction identifier
|
241
|
+
# @param activity_id [Integer] Activity summary identifier
|
242
|
+
# @param [Hash] opts the optional parameters
|
243
|
+
# @return [ActivityStepSamples]
|
244
|
+
def get_step_samples(user_id, transaction_id, activity_id, opts = {})
|
245
|
+
data, _status_code, _headers = get_step_samples_with_http_info(user_id, transaction_id, activity_id, opts)
|
246
|
+
data
|
247
|
+
end
|
248
|
+
|
249
|
+
# Get step samples
|
250
|
+
# Get activity step samples. Example data can be seen from [appendix](#activity-step-time-series).
|
251
|
+
# @param user_id [Integer] User identifier
|
252
|
+
# @param transaction_id [Integer] Transaction identifier
|
253
|
+
# @param activity_id [Integer] Activity summary identifier
|
254
|
+
# @param [Hash] opts the optional parameters
|
255
|
+
# @return [Array<(ActivityStepSamples, Integer, Hash)>] ActivityStepSamples data, response status code and response headers
|
256
|
+
def get_step_samples_with_http_info(user_id, transaction_id, activity_id, opts = {})
|
257
|
+
if @api_client.config.debugging
|
258
|
+
@api_client.config.logger.debug 'Calling API: DailyActivityApi.get_step_samples ...'
|
259
|
+
end
|
260
|
+
# verify the required parameter 'user_id' is set
|
261
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
262
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling DailyActivityApi.get_step_samples"
|
263
|
+
end
|
264
|
+
# verify the required parameter 'transaction_id' is set
|
265
|
+
if @api_client.config.client_side_validation && transaction_id.nil?
|
266
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling DailyActivityApi.get_step_samples"
|
267
|
+
end
|
268
|
+
# verify the required parameter 'activity_id' is set
|
269
|
+
if @api_client.config.client_side_validation && activity_id.nil?
|
270
|
+
fail ArgumentError, "Missing the required parameter 'activity_id' when calling DailyActivityApi.get_step_samples"
|
271
|
+
end
|
272
|
+
# resource path
|
273
|
+
local_var_path = '/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/step-samples'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'activity-id' + '}', CGI.escape(activity_id.to_s))
|
274
|
+
|
275
|
+
# query parameters
|
276
|
+
query_params = opts[:query_params] || {}
|
277
|
+
|
278
|
+
# header parameters
|
279
|
+
header_params = opts[:header_params] || {}
|
280
|
+
# HTTP header 'Accept' (if needed)
|
281
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
|
282
|
+
|
283
|
+
# form parameters
|
284
|
+
form_params = opts[:form_params] || {}
|
285
|
+
|
286
|
+
# http body (model)
|
287
|
+
post_body = opts[:body]
|
288
|
+
|
289
|
+
# return_type
|
290
|
+
return_type = opts[:return_type] || 'ActivityStepSamples'
|
291
|
+
|
292
|
+
# auth_names
|
293
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
294
|
+
|
295
|
+
new_options = opts.merge(
|
296
|
+
:header_params => header_params,
|
297
|
+
:query_params => query_params,
|
298
|
+
:form_params => form_params,
|
299
|
+
:body => post_body,
|
300
|
+
:auth_names => auth_names,
|
301
|
+
:return_type => return_type
|
302
|
+
)
|
303
|
+
|
304
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
305
|
+
if @api_client.config.debugging
|
306
|
+
@api_client.config.logger.debug "API called: DailyActivityApi#get_step_samples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
307
|
+
end
|
308
|
+
return data, status_code, headers
|
309
|
+
end
|
310
|
+
|
311
|
+
# Get zone samples
|
312
|
+
# Get activity zone samples. Example data can be seen from [appendix](#activity-zone-time-series).
|
313
|
+
# @param user_id [Integer] User identifier
|
314
|
+
# @param transaction_id [Integer] Transaction identifier
|
315
|
+
# @param activity_id [Integer] Activity summary identifier
|
316
|
+
# @param [Hash] opts the optional parameters
|
317
|
+
# @return [ActivityZoneSamples]
|
318
|
+
def get_zone_samples(user_id, transaction_id, activity_id, opts = {})
|
319
|
+
data, _status_code, _headers = get_zone_samples_with_http_info(user_id, transaction_id, activity_id, opts)
|
320
|
+
data
|
321
|
+
end
|
322
|
+
|
323
|
+
# Get zone samples
|
324
|
+
# Get activity zone samples. Example data can be seen from [appendix](#activity-zone-time-series).
|
325
|
+
# @param user_id [Integer] User identifier
|
326
|
+
# @param transaction_id [Integer] Transaction identifier
|
327
|
+
# @param activity_id [Integer] Activity summary identifier
|
328
|
+
# @param [Hash] opts the optional parameters
|
329
|
+
# @return [Array<(ActivityZoneSamples, Integer, Hash)>] ActivityZoneSamples data, response status code and response headers
|
330
|
+
def get_zone_samples_with_http_info(user_id, transaction_id, activity_id, opts = {})
|
331
|
+
if @api_client.config.debugging
|
332
|
+
@api_client.config.logger.debug 'Calling API: DailyActivityApi.get_zone_samples ...'
|
333
|
+
end
|
334
|
+
# verify the required parameter 'user_id' is set
|
335
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
336
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling DailyActivityApi.get_zone_samples"
|
337
|
+
end
|
338
|
+
# verify the required parameter 'transaction_id' is set
|
339
|
+
if @api_client.config.client_side_validation && transaction_id.nil?
|
340
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling DailyActivityApi.get_zone_samples"
|
341
|
+
end
|
342
|
+
# verify the required parameter 'activity_id' is set
|
343
|
+
if @api_client.config.client_side_validation && activity_id.nil?
|
344
|
+
fail ArgumentError, "Missing the required parameter 'activity_id' when calling DailyActivityApi.get_zone_samples"
|
345
|
+
end
|
346
|
+
# resource path
|
347
|
+
local_var_path = '/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/zone-samples'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'activity-id' + '}', CGI.escape(activity_id.to_s))
|
348
|
+
|
349
|
+
# query parameters
|
350
|
+
query_params = opts[:query_params] || {}
|
351
|
+
|
352
|
+
# header parameters
|
353
|
+
header_params = opts[:header_params] || {}
|
354
|
+
# HTTP header 'Accept' (if needed)
|
355
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
|
356
|
+
|
357
|
+
# form parameters
|
358
|
+
form_params = opts[:form_params] || {}
|
359
|
+
|
360
|
+
# http body (model)
|
361
|
+
post_body = opts[:body]
|
362
|
+
|
363
|
+
# return_type
|
364
|
+
return_type = opts[:return_type] || 'ActivityZoneSamples'
|
365
|
+
|
366
|
+
# auth_names
|
367
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
368
|
+
|
369
|
+
new_options = opts.merge(
|
370
|
+
:header_params => header_params,
|
371
|
+
:query_params => query_params,
|
372
|
+
:form_params => form_params,
|
373
|
+
:body => post_body,
|
374
|
+
:auth_names => auth_names,
|
375
|
+
:return_type => return_type
|
376
|
+
)
|
377
|
+
|
378
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
379
|
+
if @api_client.config.debugging
|
380
|
+
@api_client.config.logger.debug "API called: DailyActivityApi#get_zone_samples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
381
|
+
end
|
382
|
+
return data, status_code, headers
|
383
|
+
end
|
384
|
+
|
385
|
+
# List activities
|
386
|
+
# List new activity data. After successfully initiating a transaction, activity summaries included within it can be retrieved with the provided transactionId.
|
387
|
+
# @param transaction_id [Integer] Transaction identifier
|
388
|
+
# @param user_id [Integer] User identifier
|
389
|
+
# @param [Hash] opts the optional parameters
|
390
|
+
# @return [ActivityLog]
|
391
|
+
def list_activities(transaction_id, user_id, opts = {})
|
392
|
+
data, _status_code, _headers = list_activities_with_http_info(transaction_id, user_id, opts)
|
393
|
+
data
|
394
|
+
end
|
395
|
+
|
396
|
+
# List activities
|
397
|
+
# List new activity data. After successfully initiating a transaction, activity summaries included within it can be retrieved with the provided transactionId.
|
398
|
+
# @param transaction_id [Integer] Transaction identifier
|
399
|
+
# @param user_id [Integer] User identifier
|
400
|
+
# @param [Hash] opts the optional parameters
|
401
|
+
# @return [Array<(ActivityLog, Integer, Hash)>] ActivityLog data, response status code and response headers
|
402
|
+
def list_activities_with_http_info(transaction_id, user_id, opts = {})
|
403
|
+
if @api_client.config.debugging
|
404
|
+
@api_client.config.logger.debug 'Calling API: DailyActivityApi.list_activities ...'
|
405
|
+
end
|
406
|
+
# verify the required parameter 'transaction_id' is set
|
407
|
+
if @api_client.config.client_side_validation && transaction_id.nil?
|
408
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling DailyActivityApi.list_activities"
|
409
|
+
end
|
410
|
+
pattern = Regexp.new(/[0-9]+/)
|
411
|
+
if @api_client.config.client_side_validation && transaction_id !~ pattern
|
412
|
+
fail ArgumentError, "invalid value for 'transaction_id' when calling DailyActivityApi.list_activities, must conform to the pattern #{pattern}."
|
413
|
+
end
|
414
|
+
|
415
|
+
# verify the required parameter 'user_id' is set
|
416
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
417
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling DailyActivityApi.list_activities"
|
418
|
+
end
|
419
|
+
pattern = Regexp.new(/[0-9]+/)
|
420
|
+
if @api_client.config.client_side_validation && user_id !~ pattern
|
421
|
+
fail ArgumentError, "invalid value for 'user_id' when calling DailyActivityApi.list_activities, must conform to the pattern #{pattern}."
|
422
|
+
end
|
423
|
+
|
424
|
+
# resource path
|
425
|
+
local_var_path = '/v3/users/{user-id}/activity-transactions/{transaction-id}'.sub('{' + 'transaction-id' + '}', CGI.escape(transaction_id.to_s)).sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s))
|
426
|
+
|
427
|
+
# query parameters
|
428
|
+
query_params = opts[:query_params] || {}
|
429
|
+
|
430
|
+
# header parameters
|
431
|
+
header_params = opts[:header_params] || {}
|
432
|
+
# HTTP header 'Accept' (if needed)
|
433
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
|
434
|
+
|
435
|
+
# form parameters
|
436
|
+
form_params = opts[:form_params] || {}
|
437
|
+
|
438
|
+
# http body (model)
|
439
|
+
post_body = opts[:body]
|
440
|
+
|
441
|
+
# return_type
|
442
|
+
return_type = opts[:return_type] || 'ActivityLog'
|
443
|
+
|
444
|
+
# auth_names
|
445
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
446
|
+
|
447
|
+
new_options = opts.merge(
|
448
|
+
:header_params => header_params,
|
449
|
+
:query_params => query_params,
|
450
|
+
:form_params => form_params,
|
451
|
+
:body => post_body,
|
452
|
+
:auth_names => auth_names,
|
453
|
+
:return_type => return_type
|
454
|
+
)
|
455
|
+
|
456
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
457
|
+
if @api_client.config.debugging
|
458
|
+
@api_client.config.logger.debug "API called: DailyActivityApi#list_activities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
459
|
+
end
|
460
|
+
return data, status_code, headers
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|
@@ -0,0 +1,202 @@
|
|
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 ExercisesApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Get exercise FIT
|
23
|
+
# FIT file for users exercise.
|
24
|
+
# @param exercise_id [String] Hashed exercise id.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [String]
|
27
|
+
def get_exercise_fit_without_transaction(exercise_id, opts = {})
|
28
|
+
data, _status_code, _headers = get_exercise_fit_without_transaction_with_http_info(exercise_id, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get exercise FIT
|
33
|
+
# FIT file for users exercise.
|
34
|
+
# @param exercise_id [String] Hashed exercise id.
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
|
37
|
+
def get_exercise_fit_without_transaction_with_http_info(exercise_id, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: ExercisesApi.get_exercise_fit_without_transaction ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'exercise_id' is set
|
42
|
+
if @api_client.config.client_side_validation && exercise_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'exercise_id' when calling ExercisesApi.get_exercise_fit_without_transaction"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/v3/exercises/{exerciseId}/fit'.sub('{' + 'exerciseId' + '}', CGI.escape(exercise_id.to_s))
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
55
|
+
|
56
|
+
# form parameters
|
57
|
+
form_params = opts[:form_params] || {}
|
58
|
+
|
59
|
+
# http body (model)
|
60
|
+
post_body = opts[:body]
|
61
|
+
|
62
|
+
# return_type
|
63
|
+
return_type = opts[:return_type] || 'String'
|
64
|
+
|
65
|
+
# auth_names
|
66
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
67
|
+
|
68
|
+
new_options = opts.merge(
|
69
|
+
:header_params => header_params,
|
70
|
+
:query_params => query_params,
|
71
|
+
:form_params => form_params,
|
72
|
+
:body => post_body,
|
73
|
+
:auth_names => auth_names,
|
74
|
+
:return_type => return_type
|
75
|
+
)
|
76
|
+
|
77
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
78
|
+
if @api_client.config.debugging
|
79
|
+
@api_client.config.logger.debug "API called: ExercisesApi#get_exercise_fit_without_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
80
|
+
end
|
81
|
+
return data, status_code, headers
|
82
|
+
end
|
83
|
+
|
84
|
+
# Get exercise
|
85
|
+
# Get users exercise using hashed id.
|
86
|
+
# @param exercise_id [String] Hashed exercise id.
|
87
|
+
# @param [Hash] opts the optional parameters
|
88
|
+
# @return [ExerciseHashId]
|
89
|
+
def get_exercise_without_transaction(exercise_id, opts = {})
|
90
|
+
data, _status_code, _headers = get_exercise_without_transaction_with_http_info(exercise_id, opts)
|
91
|
+
data
|
92
|
+
end
|
93
|
+
|
94
|
+
# Get exercise
|
95
|
+
# Get users exercise using hashed id.
|
96
|
+
# @param exercise_id [String] Hashed exercise id.
|
97
|
+
# @param [Hash] opts the optional parameters
|
98
|
+
# @return [Array<(ExerciseHashId, Integer, Hash)>] ExerciseHashId data, response status code and response headers
|
99
|
+
def get_exercise_without_transaction_with_http_info(exercise_id, opts = {})
|
100
|
+
if @api_client.config.debugging
|
101
|
+
@api_client.config.logger.debug 'Calling API: ExercisesApi.get_exercise_without_transaction ...'
|
102
|
+
end
|
103
|
+
# verify the required parameter 'exercise_id' is set
|
104
|
+
if @api_client.config.client_side_validation && exercise_id.nil?
|
105
|
+
fail ArgumentError, "Missing the required parameter 'exercise_id' when calling ExercisesApi.get_exercise_without_transaction"
|
106
|
+
end
|
107
|
+
# resource path
|
108
|
+
local_var_path = '/v3/exercises/{exerciseId}'.sub('{' + 'exerciseId' + '}', CGI.escape(exercise_id.to_s))
|
109
|
+
|
110
|
+
# query parameters
|
111
|
+
query_params = opts[:query_params] || {}
|
112
|
+
|
113
|
+
# header parameters
|
114
|
+
header_params = opts[:header_params] || {}
|
115
|
+
# HTTP header 'Accept' (if needed)
|
116
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
117
|
+
|
118
|
+
# form parameters
|
119
|
+
form_params = opts[:form_params] || {}
|
120
|
+
|
121
|
+
# http body (model)
|
122
|
+
post_body = opts[:body]
|
123
|
+
|
124
|
+
# return_type
|
125
|
+
return_type = opts[:return_type] || 'ExerciseHashId'
|
126
|
+
|
127
|
+
# auth_names
|
128
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
129
|
+
|
130
|
+
new_options = opts.merge(
|
131
|
+
:header_params => header_params,
|
132
|
+
:query_params => query_params,
|
133
|
+
:form_params => form_params,
|
134
|
+
:body => post_body,
|
135
|
+
:auth_names => auth_names,
|
136
|
+
:return_type => return_type
|
137
|
+
)
|
138
|
+
|
139
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
140
|
+
if @api_client.config.debugging
|
141
|
+
@api_client.config.logger.debug "API called: ExercisesApi#get_exercise_without_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
142
|
+
end
|
143
|
+
return data, status_code, headers
|
144
|
+
end
|
145
|
+
|
146
|
+
# List exercises
|
147
|
+
# List users exercises available in Accesslink.
|
148
|
+
# @param [Hash] opts the optional parameters
|
149
|
+
# @return [Array<ExerciseHashId>]
|
150
|
+
def list_exercises_without_transaction(opts = {})
|
151
|
+
data, _status_code, _headers = list_exercises_without_transaction_with_http_info(opts)
|
152
|
+
data
|
153
|
+
end
|
154
|
+
|
155
|
+
# List exercises
|
156
|
+
# List users exercises available in Accesslink.
|
157
|
+
# @param [Hash] opts the optional parameters
|
158
|
+
# @return [Array<(Array<ExerciseHashId>, Integer, Hash)>] Array<ExerciseHashId> data, response status code and response headers
|
159
|
+
def list_exercises_without_transaction_with_http_info(opts = {})
|
160
|
+
if @api_client.config.debugging
|
161
|
+
@api_client.config.logger.debug 'Calling API: ExercisesApi.list_exercises_without_transaction ...'
|
162
|
+
end
|
163
|
+
# resource path
|
164
|
+
local_var_path = '/v3/exercises'
|
165
|
+
|
166
|
+
# query parameters
|
167
|
+
query_params = opts[:query_params] || {}
|
168
|
+
|
169
|
+
# header parameters
|
170
|
+
header_params = opts[:header_params] || {}
|
171
|
+
# HTTP header 'Accept' (if needed)
|
172
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
173
|
+
|
174
|
+
# form parameters
|
175
|
+
form_params = opts[:form_params] || {}
|
176
|
+
|
177
|
+
# http body (model)
|
178
|
+
post_body = opts[:body]
|
179
|
+
|
180
|
+
# return_type
|
181
|
+
return_type = opts[:return_type] || 'Array<ExerciseHashId>'
|
182
|
+
|
183
|
+
# auth_names
|
184
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
185
|
+
|
186
|
+
new_options = opts.merge(
|
187
|
+
:header_params => header_params,
|
188
|
+
:query_params => query_params,
|
189
|
+
:form_params => form_params,
|
190
|
+
:body => post_body,
|
191
|
+
:auth_names => auth_names,
|
192
|
+
:return_type => return_type
|
193
|
+
)
|
194
|
+
|
195
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
196
|
+
if @api_client.config.debugging
|
197
|
+
@api_client.config.logger.debug "API called: ExercisesApi#list_exercises_without_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
198
|
+
end
|
199
|
+
return data, status_code, headers
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|