Class: PolarAccesslink::DailyActivityApi

Inherits:
Object
  • Object
show all
Defined in:
lib/polar_accesslink/api/daily_activity_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DailyActivityApi

Returns a new instance of DailyActivityApi.



19
20
21
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

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

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

Parameters:

  • transaction_id

    Transaction identifier

  • user_id

    User identifier

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

    the optional parameters

Returns:

  • (nil)


28
29
30
31
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 28

def commit_activity_transaction(transaction_id, user_id, opts = {})
  commit_activity_transaction_with_http_info(transaction_id, user_id, opts)
  nil
end

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

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

Parameters:

  • transaction_id

    Transaction identifier

  • user_id

    User identifier

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 39

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

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DailyActivityApi#commit_activity_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_activity_transaction(user_id, opts = {}) ⇒ nil

Create transaction Initiate activity transaction. Check for new activity summaries and create a new transaction if found.

Parameters:

  • user_id

    User identifier

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

    the optional parameters

Returns:

  • (nil)


82
83
84
85
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 82

def create_activity_transaction(user_id, opts = {})
  create_activity_transaction_with_http_info(user_id, opts)
  nil
end

#create_activity_transaction_with_http_info(user_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create transaction Initiate activity transaction. Check for new activity summaries and create a new transaction if found.

Parameters:

  • user_id

    User identifier

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 92

def create_activity_transaction_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DailyActivityApi.create_activity_transaction ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling DailyActivityApi.create_activity_transaction"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/activity-transactions'.sub('{' + 'user-id' + '}', user_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DailyActivityApi#create_activity_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get activity summary

Parameters:

  • user_id

    User identifier

  • transaction_id

    Transaction identifier

  • activity_id

    Activity summary identifier

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

    the optional parameters

Returns:

  • (nil)


132
133
134
135
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 132

def get_activity_summary(user_id, transaction_id, activity_id, opts = {})
  get_activity_summary_with_http_info(user_id, transaction_id, activity_id, opts)
  nil
end

#get_activity_summary_with_http_info(user_id, transaction_id, activity_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Get activity summary

Parameters:

  • user_id

    User identifier

  • transaction_id

    Transaction identifier

  • activity_id

    Activity summary identifier

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 143

def get_activity_summary_with_http_info(user_id, transaction_id, activity_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DailyActivityApi.get_activity_summary ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling DailyActivityApi.get_activity_summary"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling DailyActivityApi.get_activity_summary"
  end
  # verify the required parameter 'activity_id' is set
  if @api_client.config.client_side_validation && activity_id.nil?
    fail ArgumentError, "Missing the required parameter 'activity_id' when calling DailyActivityApi.get_activity_summary"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}'.sub('{' + 'user-id' + '}', user_id.to_s).sub('{' + 'transaction-id' + '}', transaction_id.to_s).sub('{' + 'activity-id' + '}', activity_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DailyActivityApi#get_activity_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get step samples Get activity step samples. Example data can be seen from [appendix](#activity-step-time-series).

Parameters:

  • user_id

    User identifier

  • transaction_id

    Transaction identifier

  • activity_id

    Activity summary identifier

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

    the optional parameters

Returns:

  • (nil)


192
193
194
195
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 192

def get_step_samples(user_id, transaction_id, activity_id, opts = {})
  get_step_samples_with_http_info(user_id, transaction_id, activity_id, opts)
  nil
end

#get_step_samples_with_http_info(user_id, transaction_id, activity_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Get step samples Get activity step samples. Example data can be seen from [appendix](#activity-step-time-series).

Parameters:

  • user_id

    User identifier

  • transaction_id

    Transaction identifier

  • activity_id

    Activity summary identifier

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 204

def get_step_samples_with_http_info(user_id, transaction_id, activity_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DailyActivityApi.get_step_samples ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling DailyActivityApi.get_step_samples"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling DailyActivityApi.get_step_samples"
  end
  # verify the required parameter 'activity_id' is set
  if @api_client.config.client_side_validation && activity_id.nil?
    fail ArgumentError, "Missing the required parameter 'activity_id' when calling DailyActivityApi.get_step_samples"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/step-samples'.sub('{' + 'user-id' + '}', user_id.to_s).sub('{' + 'transaction-id' + '}', transaction_id.to_s).sub('{' + 'activity-id' + '}', activity_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DailyActivityApi#get_step_samples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get zone samples Get activity zone samples. Example data can be seen from [appendix](#activity-zone-time-series).

Parameters:

  • user_id

    User identifier

  • transaction_id

    Transaction identifier

  • activity_id

    Activity summary identifier

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

    the optional parameters

Returns:

  • (nil)


253
254
255
256
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 253

def get_zone_samples(user_id, transaction_id, activity_id, opts = {})
  get_zone_samples_with_http_info(user_id, transaction_id, activity_id, opts)
  nil
end

#get_zone_samples_with_http_info(user_id, transaction_id, activity_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Get zone samples Get activity zone samples. Example data can be seen from [appendix](#activity-zone-time-series).

Parameters:

  • user_id

    User identifier

  • transaction_id

    Transaction identifier

  • activity_id

    Activity summary identifier

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 265

def get_zone_samples_with_http_info(user_id, transaction_id, activity_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DailyActivityApi.get_zone_samples ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling DailyActivityApi.get_zone_samples"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling DailyActivityApi.get_zone_samples"
  end
  # verify the required parameter 'activity_id' is set
  if @api_client.config.client_side_validation && activity_id.nil?
    fail ArgumentError, "Missing the required parameter 'activity_id' when calling DailyActivityApi.get_zone_samples"
  end
  # resource path
  local_var_path = '/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/zone-samples'.sub('{' + 'user-id' + '}', user_id.to_s).sub('{' + 'transaction-id' + '}', transaction_id.to_s).sub('{' + 'activity-id' + '}', activity_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DailyActivityApi#get_zone_samples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

List activities List new activity data. After successfully initiating a transaction, activity summaries included within it can be retrieved with the provided transactionId.

Parameters:

  • transaction_id

    Transaction identifier

  • user_id

    User identifier

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

    the optional parameters

Returns:

  • (nil)


313
314
315
316
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 313

def list_activities(transaction_id, user_id, opts = {})
  list_activities_with_http_info(transaction_id, user_id, opts)
  nil
end

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

List activities List new activity data. After successfully initiating a transaction, activity summaries included within it can be retrieved with the provided transactionId.

Parameters:

  • transaction_id

    Transaction identifier

  • user_id

    User identifier

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/polar_accesslink/api/daily_activity_api.rb', line 324

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

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DailyActivityApi#list_activities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end