polar_accesslink 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -5
  3. data/README.md +20 -65
  4. data/Rakefile +0 -2
  5. data/docs/DailyActivityApi.md +96 -123
  6. data/docs/ExercisesApi.md +35 -55
  7. data/docs/NightlyRechargeApi.md +96 -0
  8. data/docs/PhysicalInfoApi.md +60 -79
  9. data/docs/PullNotificationsApi.md +11 -20
  10. data/docs/SleepApi.md +137 -0
  11. data/docs/TrainingDataApi.md +175 -213
  12. data/docs/UsersApi.md +33 -56
  13. data/docs/WebhooksApi.md +43 -80
  14. data/git_push.sh +55 -0
  15. data/lib/polar_accesslink.rb +5 -36
  16. data/lib/polar_accesslink/api/daily_activity_api.rb +101 -201
  17. data/lib/polar_accesslink/api/exercises_api.rb +43 -81
  18. data/lib/polar_accesslink/api/nightly_recharge_api.rb +115 -0
  19. data/lib/polar_accesslink/api/physical_info_api.rb +65 -114
  20. data/lib/polar_accesslink/api/pull_notifications_api.rb +15 -27
  21. data/lib/polar_accesslink/api/sleep_api.rb +158 -0
  22. data/lib/polar_accesslink/api/training_data_api.rb +178 -332
  23. data/lib/polar_accesslink/api/users_api.rb +42 -96
  24. data/lib/polar_accesslink/api/webhooks_api.rb +59 -126
  25. data/lib/polar_accesslink/api_client.rb +45 -41
  26. data/lib/polar_accesslink/api_error.rb +3 -22
  27. data/lib/polar_accesslink/configuration.rb +9 -62
  28. data/lib/polar_accesslink/version.rb +3 -3
  29. data/polar_accesslink.gemspec +2 -1
  30. data/spec/api/daily_activity_api_spec.rb +11 -11
  31. data/spec/api/exercises_api_spec.rb +9 -9
  32. data/spec/api/nightly_recharge_api_spec.rb +58 -0
  33. data/spec/api/physical_info_api_spec.rb +9 -9
  34. data/spec/api/pull_notifications_api_spec.rb +7 -7
  35. data/spec/api/sleep_api_spec.rb +69 -0
  36. data/spec/api/training_data_api_spec.rb +16 -15
  37. data/spec/api/users_api_spec.rb +8 -9
  38. data/spec/api/webhooks_api_spec.rb +11 -13
  39. data/spec/api_client_spec.rb +21 -4
  40. data/spec/configuration_spec.rb +6 -6
  41. data/spec/spec_helper.rb +3 -3
  42. metadata +36 -145
  43. data/docs/Activity.md +0 -33
  44. data/docs/ActivityLog.md +0 -17
  45. data/docs/ActivityStepSample.md +0 -19
  46. data/docs/ActivityStepSamples.md +0 -19
  47. data/docs/ActivityZoneSample.md +0 -19
  48. data/docs/ActivityZoneSamples.md +0 -19
  49. data/docs/AvailableUserData.md +0 -21
  50. data/docs/AvailableUserDatas.md +0 -17
  51. data/docs/CreatedWebhook.md +0 -17
  52. data/docs/CreatedWebhookData.md +0 -23
  53. data/docs/DurationZone.md +0 -19
  54. data/docs/Error.md +0 -25
  55. data/docs/Exercise.md +0 -47
  56. data/docs/ExerciseHashId.md +0 -45
  57. data/docs/Exercises.md +0 -17
  58. data/docs/HeartRate.md +0 -19
  59. data/docs/PhysicalInformation.md +0 -39
  60. data/docs/PhysicalInformations.md +0 -17
  61. data/docs/Register.md +0 -17
  62. data/docs/Sample.md +0 -21
  63. data/docs/Samples.md +0 -17
  64. data/docs/TransactionLocation.md +0 -19
  65. data/docs/User.md +0 -35
  66. data/docs/UserExtraInfo.md +0 -21
  67. data/docs/WebhookInfo.md +0 -17
  68. data/docs/WebhookInfoData.md +0 -21
  69. data/docs/WebhookPatch.md +0 -19
  70. data/docs/WebhookPayload.md +0 -25
  71. data/docs/WebhookPing.md +0 -19
  72. data/docs/WebhookRequest.md +0 -19
  73. data/docs/WebhookType.md +0 -16
  74. data/docs/Zone.md +0 -23
  75. data/docs/Zones.md +0 -17
  76. data/lib/polar_accesslink/models/activity.rb +0 -288
  77. data/lib/polar_accesslink/models/activity_log.rb +0 -210
  78. data/lib/polar_accesslink/models/activity_step_sample.rb +0 -218
  79. data/lib/polar_accesslink/models/activity_step_samples.rb +0 -220
  80. data/lib/polar_accesslink/models/activity_zone_sample.rb +0 -220
  81. data/lib/polar_accesslink/models/activity_zone_samples.rb +0 -220
  82. data/lib/polar_accesslink/models/available_user_data.rb +0 -262
  83. data/lib/polar_accesslink/models/available_user_datas.rb +0 -210
  84. data/lib/polar_accesslink/models/created_webhook.rb +0 -206
  85. data/lib/polar_accesslink/models/created_webhook_data.rb +0 -236
  86. data/lib/polar_accesslink/models/duration_zone.rb +0 -218
  87. data/lib/polar_accesslink/models/error.rb +0 -248
  88. data/lib/polar_accesslink/models/exercise.rb +0 -357
  89. data/lib/polar_accesslink/models/exercise_hash_id.rb +0 -347
  90. data/lib/polar_accesslink/models/exercises.rb +0 -210
  91. data/lib/polar_accesslink/models/heart_rate.rb +0 -218
  92. data/lib/polar_accesslink/models/physical_information.rb +0 -352
  93. data/lib/polar_accesslink/models/physical_informations.rb +0 -210
  94. data/lib/polar_accesslink/models/register.rb +0 -213
  95. data/lib/polar_accesslink/models/sample.rb +0 -228
  96. data/lib/polar_accesslink/models/samples.rb +0 -210
  97. data/lib/polar_accesslink/models/transaction_location.rb +0 -218
  98. data/lib/polar_accesslink/models/user.rb +0 -334
  99. data/lib/polar_accesslink/models/user_extra_info.rb +0 -228
  100. data/lib/polar_accesslink/models/webhook_info.rb +0 -206
  101. data/lib/polar_accesslink/models/webhook_info_data.rb +0 -226
  102. data/lib/polar_accesslink/models/webhook_patch.rb +0 -219
  103. data/lib/polar_accesslink/models/webhook_payload.rb +0 -246
  104. data/lib/polar_accesslink/models/webhook_ping.rb +0 -252
  105. data/lib/polar_accesslink/models/webhook_request.rb +0 -229
  106. data/lib/polar_accesslink/models/webhook_type.rb +0 -37
  107. data/lib/polar_accesslink/models/zone.rb +0 -238
  108. data/lib/polar_accesslink/models/zones.rb +0 -210
  109. data/spec/models/activity_log_spec.rb +0 -41
  110. data/spec/models/activity_spec.rb +0 -89
  111. data/spec/models/activity_step_sample_spec.rb +0 -47
  112. data/spec/models/activity_step_samples_spec.rb +0 -47
  113. data/spec/models/activity_zone_sample_spec.rb +0 -47
  114. data/spec/models/activity_zone_samples_spec.rb +0 -47
  115. data/spec/models/available_user_data_spec.rb +0 -57
  116. data/spec/models/available_user_datas_spec.rb +0 -41
  117. data/spec/models/created_webhook_data_spec.rb +0 -59
  118. data/spec/models/created_webhook_spec.rb +0 -41
  119. data/spec/models/duration_zone_spec.rb +0 -47
  120. data/spec/models/error_spec.rb +0 -65
  121. data/spec/models/exercise_hash_id_spec.rb +0 -125
  122. data/spec/models/exercise_spec.rb +0 -131
  123. data/spec/models/exercises_spec.rb +0 -41
  124. data/spec/models/heart_rate_spec.rb +0 -47
  125. data/spec/models/physical_information_spec.rb +0 -111
  126. data/spec/models/physical_informations_spec.rb +0 -41
  127. data/spec/models/register_spec.rb +0 -41
  128. data/spec/models/sample_spec.rb +0 -53
  129. data/spec/models/samples_spec.rb +0 -41
  130. data/spec/models/transaction_location_spec.rb +0 -47
  131. data/spec/models/user_extra_info_spec.rb +0 -53
  132. data/spec/models/user_spec.rb +0 -99
  133. data/spec/models/webhook_info_data_spec.rb +0 -53
  134. data/spec/models/webhook_info_spec.rb +0 -41
  135. data/spec/models/webhook_patch_spec.rb +0 -47
  136. data/spec/models/webhook_payload_spec.rb +0 -65
  137. data/spec/models/webhook_ping_spec.rb +0 -51
  138. data/spec/models/webhook_request_spec.rb +0 -47
  139. data/spec/models/webhook_type_spec.rb +0 -35
  140. data/spec/models/zone_spec.rb +0 -59
  141. data/spec/models/zones_spec.rb +0 -41
@@ -1,357 +0,0 @@
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 'date'
14
-
15
- module PolarAccesslink
16
- # Training session summary data
17
- class Exercise
18
- # Id of the trainining session
19
- attr_accessor :id
20
-
21
- # Time of the transfer from wrist unit to Polar database
22
- attr_accessor :upload_time
23
-
24
- # Absolute link to Polar user owning the training
25
- attr_accessor :polar_user
26
-
27
- # Id of the exercise-transaction this training was transferred in
28
- attr_accessor :transaction_id
29
-
30
- # Polar product used in training
31
- attr_accessor :device
32
-
33
- # Start time of the training session in local time
34
- attr_accessor :start_time
35
-
36
- # The duration of the training session as specified in ISO8601
37
- attr_accessor :duration
38
-
39
- # Expended calories during training in kilocalories
40
- attr_accessor :calories
41
-
42
- # Distance in meters travelled during training
43
- attr_accessor :distance
44
-
45
- attr_accessor :heart_rate
46
-
47
- # Training load effect to user
48
- attr_accessor :training_load
49
-
50
- # Sport name
51
- attr_accessor :sport
52
-
53
- # Boolean indicating if the exercise has route data
54
- attr_accessor :has_route
55
-
56
- # Has value if the exercise is from \"Flow For Club\", otherwise not printed. Value -1 indicates that there were errors finding the club
57
- attr_accessor :club_id
58
-
59
- # Has value if the exercise is from \"Flow For Club\", otherwise not printed. Value \"Ambiguous club location. Please contact support.\" is printed in case of error (and the club-id is -1).
60
- attr_accessor :club_name
61
-
62
- # String containing the name of a Polar Flow-compatible sport, if one is set for the exercise.
63
- attr_accessor :detailed_sport_info
64
-
65
- # Attribute mapping from ruby-style variable name to JSON key.
66
- def self.attribute_map
67
- {
68
- :'id' => :'id',
69
- :'upload_time' => :'upload-time',
70
- :'polar_user' => :'polar-user',
71
- :'transaction_id' => :'transaction-id',
72
- :'device' => :'device',
73
- :'start_time' => :'start-time',
74
- :'duration' => :'duration',
75
- :'calories' => :'calories',
76
- :'distance' => :'distance',
77
- :'heart_rate' => :'heart-rate',
78
- :'training_load' => :'training-load',
79
- :'sport' => :'sport',
80
- :'has_route' => :'has-route',
81
- :'club_id' => :'club-id',
82
- :'club_name' => :'club-name',
83
- :'detailed_sport_info' => :'detailed-sport-info'
84
- }
85
- end
86
-
87
- # Attribute type mapping.
88
- def self.openapi_types
89
- {
90
- :'id' => :'Integer',
91
- :'upload_time' => :'String',
92
- :'polar_user' => :'String',
93
- :'transaction_id' => :'Integer',
94
- :'device' => :'String',
95
- :'start_time' => :'String',
96
- :'duration' => :'String',
97
- :'calories' => :'Integer',
98
- :'distance' => :'Float',
99
- :'heart_rate' => :'HeartRate',
100
- :'training_load' => :'Float',
101
- :'sport' => :'String',
102
- :'has_route' => :'Boolean',
103
- :'club_id' => :'Integer',
104
- :'club_name' => :'String',
105
- :'detailed_sport_info' => :'String'
106
- }
107
- end
108
-
109
- # List of attributes with nullable: true
110
- def self.openapi_nullable
111
- Set.new([
112
- ])
113
- end
114
-
115
- # Initializes the object
116
- # @param [Hash] attributes Model attributes in the form of hash
117
- def initialize(attributes = {})
118
- if (!attributes.is_a?(Hash))
119
- fail ArgumentError, "The input argument (attributes) must be a hash in `PolarAccesslink::Exercise` initialize method"
120
- end
121
-
122
- # check to see if the attribute exists and convert string to symbol for hash key
123
- attributes = attributes.each_with_object({}) { |(k, v), h|
124
- if (!self.class.attribute_map.key?(k.to_sym))
125
- fail ArgumentError, "`#{k}` is not a valid attribute in `PolarAccesslink::Exercise`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
126
- end
127
- h[k.to_sym] = v
128
- }
129
-
130
- if attributes.key?(:'id')
131
- self.id = attributes[:'id']
132
- end
133
-
134
- if attributes.key?(:'upload_time')
135
- self.upload_time = attributes[:'upload_time']
136
- end
137
-
138
- if attributes.key?(:'polar_user')
139
- self.polar_user = attributes[:'polar_user']
140
- end
141
-
142
- if attributes.key?(:'transaction_id')
143
- self.transaction_id = attributes[:'transaction_id']
144
- end
145
-
146
- if attributes.key?(:'device')
147
- self.device = attributes[:'device']
148
- end
149
-
150
- if attributes.key?(:'start_time')
151
- self.start_time = attributes[:'start_time']
152
- end
153
-
154
- if attributes.key?(:'duration')
155
- self.duration = attributes[:'duration']
156
- end
157
-
158
- if attributes.key?(:'calories')
159
- self.calories = attributes[:'calories']
160
- end
161
-
162
- if attributes.key?(:'distance')
163
- self.distance = attributes[:'distance']
164
- end
165
-
166
- if attributes.key?(:'heart_rate')
167
- self.heart_rate = attributes[:'heart_rate']
168
- end
169
-
170
- if attributes.key?(:'training_load')
171
- self.training_load = attributes[:'training_load']
172
- end
173
-
174
- if attributes.key?(:'sport')
175
- self.sport = attributes[:'sport']
176
- end
177
-
178
- if attributes.key?(:'has_route')
179
- self.has_route = attributes[:'has_route']
180
- end
181
-
182
- if attributes.key?(:'club_id')
183
- self.club_id = attributes[:'club_id']
184
- end
185
-
186
- if attributes.key?(:'club_name')
187
- self.club_name = attributes[:'club_name']
188
- end
189
-
190
- if attributes.key?(:'detailed_sport_info')
191
- self.detailed_sport_info = attributes[:'detailed_sport_info']
192
- end
193
- end
194
-
195
- # Show invalid properties with the reasons. Usually used together with valid?
196
- # @return Array for valid properties with the reasons
197
- def list_invalid_properties
198
- invalid_properties = Array.new
199
- invalid_properties
200
- end
201
-
202
- # Check to see if the all the properties in the model are valid
203
- # @return true if the model is valid
204
- def valid?
205
- true
206
- end
207
-
208
- # Checks equality by comparing each attribute.
209
- # @param [Object] Object to be compared
210
- def ==(o)
211
- return true if self.equal?(o)
212
- self.class == o.class &&
213
- id == o.id &&
214
- upload_time == o.upload_time &&
215
- polar_user == o.polar_user &&
216
- transaction_id == o.transaction_id &&
217
- device == o.device &&
218
- start_time == o.start_time &&
219
- duration == o.duration &&
220
- calories == o.calories &&
221
- distance == o.distance &&
222
- heart_rate == o.heart_rate &&
223
- training_load == o.training_load &&
224
- sport == o.sport &&
225
- has_route == o.has_route &&
226
- club_id == o.club_id &&
227
- club_name == o.club_name &&
228
- detailed_sport_info == o.detailed_sport_info
229
- end
230
-
231
- # @see the `==` method
232
- # @param [Object] Object to be compared
233
- def eql?(o)
234
- self == o
235
- end
236
-
237
- # Calculates hash code according to all attributes.
238
- # @return [Integer] Hash code
239
- def hash
240
- [id, upload_time, polar_user, transaction_id, device, start_time, duration, calories, distance, heart_rate, training_load, sport, has_route, club_id, club_name, detailed_sport_info].hash
241
- end
242
-
243
- # Builds the object from hash
244
- # @param [Hash] attributes Model attributes in the form of hash
245
- # @return [Object] Returns the model itself
246
- def self.build_from_hash(attributes)
247
- new.build_from_hash(attributes)
248
- end
249
-
250
- # Builds the object from hash
251
- # @param [Hash] attributes Model attributes in the form of hash
252
- # @return [Object] Returns the model itself
253
- def build_from_hash(attributes)
254
- return nil unless attributes.is_a?(Hash)
255
- self.class.openapi_types.each_pair do |key, type|
256
- if type =~ /\AArray<(.*)>/i
257
- # check to ensure the input is an array given that the attribute
258
- # is documented as an array but the input is not
259
- if attributes[self.class.attribute_map[key]].is_a?(Array)
260
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
261
- end
262
- elsif !attributes[self.class.attribute_map[key]].nil?
263
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
264
- end # or else data not found in attributes(hash), not an issue as the data can be optional
265
- end
266
-
267
- self
268
- end
269
-
270
- # Deserializes the data based on type
271
- # @param string type Data type
272
- # @param string value Value to be deserialized
273
- # @return [Object] Deserialized data
274
- def _deserialize(type, value)
275
- case type.to_sym
276
- when :DateTime
277
- DateTime.parse(value)
278
- when :Date
279
- Date.parse(value)
280
- when :String
281
- value.to_s
282
- when :Integer
283
- value.to_i
284
- when :Float
285
- value.to_f
286
- when :Boolean
287
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
288
- true
289
- else
290
- false
291
- end
292
- when :Object
293
- # generic object (usually a Hash), return directly
294
- value
295
- when /\AArray<(?<inner_type>.+)>\z/
296
- inner_type = Regexp.last_match[:inner_type]
297
- value.map { |v| _deserialize(inner_type, v) }
298
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
299
- k_type = Regexp.last_match[:k_type]
300
- v_type = Regexp.last_match[:v_type]
301
- {}.tap do |hash|
302
- value.each do |k, v|
303
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
304
- end
305
- end
306
- else # model
307
- PolarAccesslink.const_get(type).build_from_hash(value)
308
- end
309
- end
310
-
311
- # Returns the string representation of the object
312
- # @return [String] String presentation of the object
313
- def to_s
314
- to_hash.to_s
315
- end
316
-
317
- # to_body is an alias to to_hash (backward compatibility)
318
- # @return [Hash] Returns the object in the form of hash
319
- def to_body
320
- to_hash
321
- end
322
-
323
- # Returns the object in the form of hash
324
- # @return [Hash] Returns the object in the form of hash
325
- def to_hash
326
- hash = {}
327
- self.class.attribute_map.each_pair do |attr, param|
328
- value = self.send(attr)
329
- if value.nil?
330
- is_nullable = self.class.openapi_nullable.include?(attr)
331
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
332
- end
333
-
334
- hash[param] = _to_hash(value)
335
- end
336
- hash
337
- end
338
-
339
- # Outputs non-array value in the form of hash
340
- # For object, use to_hash. Otherwise, just return the value
341
- # @param [Object] value Any valid value
342
- # @return [Hash] Returns the value in the form of hash
343
- def _to_hash(value)
344
- if value.is_a?(Array)
345
- value.compact.map { |v| _to_hash(v) }
346
- elsif value.is_a?(Hash)
347
- {}.tap do |hash|
348
- value.each { |k, v| hash[k] = _to_hash(v) }
349
- end
350
- elsif value.respond_to? :to_hash
351
- value.to_hash
352
- else
353
- value
354
- end
355
- end
356
- end
357
- end
@@ -1,347 +0,0 @@
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 'date'
14
-
15
- module PolarAccesslink
16
- # Training session summary data
17
- class ExerciseHashId
18
- # Hashed id of the trainining session
19
- attr_accessor :id
20
-
21
- # Time of the transfer from wrist unit to Polar database
22
- attr_accessor :upload_time
23
-
24
- # Absolute link to Polar user owning the training
25
- attr_accessor :polar_user
26
-
27
- # Polar product used in training
28
- attr_accessor :device
29
-
30
- # Start time of the training session in local time
31
- attr_accessor :start_time
32
-
33
- # The duration of the training session as specified in ISO8601
34
- attr_accessor :duration
35
-
36
- # Expended calories during training in kilocalories
37
- attr_accessor :calories
38
-
39
- # Distance in meters travelled during training
40
- attr_accessor :distance
41
-
42
- attr_accessor :heart_rate
43
-
44
- # Training load effect to user
45
- attr_accessor :training_load
46
-
47
- # Sport name
48
- attr_accessor :sport
49
-
50
- # Boolean indicating if the exercise has route data
51
- attr_accessor :has_route
52
-
53
- # Has value if the exercise is from \"Flow For Club\", otherwise not printed. Value -1 indicates that there were errors finding the club
54
- attr_accessor :club_id
55
-
56
- # Has value if the exercise is from \"Flow For Club\", otherwise not printed. Value \"Ambiguous club location. Please contact support.\" is printed in case of error (and the club-id is -1).
57
- attr_accessor :club_name
58
-
59
- # String containing the name of a Polar Flow-compatible sport, if one is set for the exercise.
60
- attr_accessor :detailed_sport_info
61
-
62
- # Attribute mapping from ruby-style variable name to JSON key.
63
- def self.attribute_map
64
- {
65
- :'id' => :'id',
66
- :'upload_time' => :'upload-time',
67
- :'polar_user' => :'polar-user',
68
- :'device' => :'device',
69
- :'start_time' => :'start-time',
70
- :'duration' => :'duration',
71
- :'calories' => :'calories',
72
- :'distance' => :'distance',
73
- :'heart_rate' => :'heart-rate',
74
- :'training_load' => :'training-load',
75
- :'sport' => :'sport',
76
- :'has_route' => :'has-route',
77
- :'club_id' => :'club-id',
78
- :'club_name' => :'club-name',
79
- :'detailed_sport_info' => :'detailed-sport-info'
80
- }
81
- end
82
-
83
- # Attribute type mapping.
84
- def self.openapi_types
85
- {
86
- :'id' => :'String',
87
- :'upload_time' => :'String',
88
- :'polar_user' => :'String',
89
- :'device' => :'String',
90
- :'start_time' => :'String',
91
- :'duration' => :'String',
92
- :'calories' => :'Integer',
93
- :'distance' => :'Float',
94
- :'heart_rate' => :'HeartRate',
95
- :'training_load' => :'Float',
96
- :'sport' => :'String',
97
- :'has_route' => :'Boolean',
98
- :'club_id' => :'Integer',
99
- :'club_name' => :'String',
100
- :'detailed_sport_info' => :'String'
101
- }
102
- end
103
-
104
- # List of attributes with nullable: true
105
- def self.openapi_nullable
106
- Set.new([
107
- ])
108
- end
109
-
110
- # Initializes the object
111
- # @param [Hash] attributes Model attributes in the form of hash
112
- def initialize(attributes = {})
113
- if (!attributes.is_a?(Hash))
114
- fail ArgumentError, "The input argument (attributes) must be a hash in `PolarAccesslink::ExerciseHashId` initialize method"
115
- end
116
-
117
- # check to see if the attribute exists and convert string to symbol for hash key
118
- attributes = attributes.each_with_object({}) { |(k, v), h|
119
- if (!self.class.attribute_map.key?(k.to_sym))
120
- fail ArgumentError, "`#{k}` is not a valid attribute in `PolarAccesslink::ExerciseHashId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
121
- end
122
- h[k.to_sym] = v
123
- }
124
-
125
- if attributes.key?(:'id')
126
- self.id = attributes[:'id']
127
- end
128
-
129
- if attributes.key?(:'upload_time')
130
- self.upload_time = attributes[:'upload_time']
131
- end
132
-
133
- if attributes.key?(:'polar_user')
134
- self.polar_user = attributes[:'polar_user']
135
- end
136
-
137
- if attributes.key?(:'device')
138
- self.device = attributes[:'device']
139
- end
140
-
141
- if attributes.key?(:'start_time')
142
- self.start_time = attributes[:'start_time']
143
- end
144
-
145
- if attributes.key?(:'duration')
146
- self.duration = attributes[:'duration']
147
- end
148
-
149
- if attributes.key?(:'calories')
150
- self.calories = attributes[:'calories']
151
- end
152
-
153
- if attributes.key?(:'distance')
154
- self.distance = attributes[:'distance']
155
- end
156
-
157
- if attributes.key?(:'heart_rate')
158
- self.heart_rate = attributes[:'heart_rate']
159
- end
160
-
161
- if attributes.key?(:'training_load')
162
- self.training_load = attributes[:'training_load']
163
- end
164
-
165
- if attributes.key?(:'sport')
166
- self.sport = attributes[:'sport']
167
- end
168
-
169
- if attributes.key?(:'has_route')
170
- self.has_route = attributes[:'has_route']
171
- end
172
-
173
- if attributes.key?(:'club_id')
174
- self.club_id = attributes[:'club_id']
175
- end
176
-
177
- if attributes.key?(:'club_name')
178
- self.club_name = attributes[:'club_name']
179
- end
180
-
181
- if attributes.key?(:'detailed_sport_info')
182
- self.detailed_sport_info = attributes[:'detailed_sport_info']
183
- end
184
- end
185
-
186
- # Show invalid properties with the reasons. Usually used together with valid?
187
- # @return Array for valid properties with the reasons
188
- def list_invalid_properties
189
- invalid_properties = Array.new
190
- invalid_properties
191
- end
192
-
193
- # Check to see if the all the properties in the model are valid
194
- # @return true if the model is valid
195
- def valid?
196
- true
197
- end
198
-
199
- # Checks equality by comparing each attribute.
200
- # @param [Object] Object to be compared
201
- def ==(o)
202
- return true if self.equal?(o)
203
- self.class == o.class &&
204
- id == o.id &&
205
- upload_time == o.upload_time &&
206
- polar_user == o.polar_user &&
207
- device == o.device &&
208
- start_time == o.start_time &&
209
- duration == o.duration &&
210
- calories == o.calories &&
211
- distance == o.distance &&
212
- heart_rate == o.heart_rate &&
213
- training_load == o.training_load &&
214
- sport == o.sport &&
215
- has_route == o.has_route &&
216
- club_id == o.club_id &&
217
- club_name == o.club_name &&
218
- detailed_sport_info == o.detailed_sport_info
219
- end
220
-
221
- # @see the `==` method
222
- # @param [Object] Object to be compared
223
- def eql?(o)
224
- self == o
225
- end
226
-
227
- # Calculates hash code according to all attributes.
228
- # @return [Integer] Hash code
229
- def hash
230
- [id, upload_time, polar_user, device, start_time, duration, calories, distance, heart_rate, training_load, sport, has_route, club_id, club_name, detailed_sport_info].hash
231
- end
232
-
233
- # Builds the object from hash
234
- # @param [Hash] attributes Model attributes in the form of hash
235
- # @return [Object] Returns the model itself
236
- def self.build_from_hash(attributes)
237
- new.build_from_hash(attributes)
238
- end
239
-
240
- # Builds the object from hash
241
- # @param [Hash] attributes Model attributes in the form of hash
242
- # @return [Object] Returns the model itself
243
- def build_from_hash(attributes)
244
- return nil unless attributes.is_a?(Hash)
245
- self.class.openapi_types.each_pair do |key, type|
246
- if type =~ /\AArray<(.*)>/i
247
- # check to ensure the input is an array given that the attribute
248
- # is documented as an array but the input is not
249
- if attributes[self.class.attribute_map[key]].is_a?(Array)
250
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
251
- end
252
- elsif !attributes[self.class.attribute_map[key]].nil?
253
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
254
- end # or else data not found in attributes(hash), not an issue as the data can be optional
255
- end
256
-
257
- self
258
- end
259
-
260
- # Deserializes the data based on type
261
- # @param string type Data type
262
- # @param string value Value to be deserialized
263
- # @return [Object] Deserialized data
264
- def _deserialize(type, value)
265
- case type.to_sym
266
- when :DateTime
267
- DateTime.parse(value)
268
- when :Date
269
- Date.parse(value)
270
- when :String
271
- value.to_s
272
- when :Integer
273
- value.to_i
274
- when :Float
275
- value.to_f
276
- when :Boolean
277
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
278
- true
279
- else
280
- false
281
- end
282
- when :Object
283
- # generic object (usually a Hash), return directly
284
- value
285
- when /\AArray<(?<inner_type>.+)>\z/
286
- inner_type = Regexp.last_match[:inner_type]
287
- value.map { |v| _deserialize(inner_type, v) }
288
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
289
- k_type = Regexp.last_match[:k_type]
290
- v_type = Regexp.last_match[:v_type]
291
- {}.tap do |hash|
292
- value.each do |k, v|
293
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
294
- end
295
- end
296
- else # model
297
- PolarAccesslink.const_get(type).build_from_hash(value)
298
- end
299
- end
300
-
301
- # Returns the string representation of the object
302
- # @return [String] String presentation of the object
303
- def to_s
304
- to_hash.to_s
305
- end
306
-
307
- # to_body is an alias to to_hash (backward compatibility)
308
- # @return [Hash] Returns the object in the form of hash
309
- def to_body
310
- to_hash
311
- end
312
-
313
- # Returns the object in the form of hash
314
- # @return [Hash] Returns the object in the form of hash
315
- def to_hash
316
- hash = {}
317
- self.class.attribute_map.each_pair do |attr, param|
318
- value = self.send(attr)
319
- if value.nil?
320
- is_nullable = self.class.openapi_nullable.include?(attr)
321
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
322
- end
323
-
324
- hash[param] = _to_hash(value)
325
- end
326
- hash
327
- end
328
-
329
- # Outputs non-array value in the form of hash
330
- # For object, use to_hash. Otherwise, just return the value
331
- # @param [Object] value Any valid value
332
- # @return [Hash] Returns the value in the form of hash
333
- def _to_hash(value)
334
- if value.is_a?(Array)
335
- value.compact.map { |v| _to_hash(v) }
336
- elsif value.is_a?(Hash)
337
- {}.tap do |hash|
338
- value.each { |k, v| hash[k] = _to_hash(v) }
339
- end
340
- elsif value.respond_to? :to_hash
341
- value.to_hash
342
- else
343
- value
344
- end
345
- end
346
- end
347
- end