artikcloud 2.0.0 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -12
  3. data/README.md +33 -10
  4. data/artikcloud.gemspec +5 -6
  5. data/docs/Action.md +9 -0
  6. data/docs/ActionArray.md +8 -0
  7. data/docs/Actions.md +12 -0
  8. data/docs/DeviceTypesApi.md +10 -10
  9. data/docs/DevicesApi.md +68 -15
  10. data/docs/ExportApi.md +10 -10
  11. data/docs/Message.md +11 -0
  12. data/docs/MessagesApi.md +205 -27
  13. data/docs/NormalizedAction.md +16 -0
  14. data/docs/NormalizedActionsEnvelope.md +17 -0
  15. data/docs/PresenceEnvelope.md +9 -0
  16. data/docs/PresenceModel.md +9 -0
  17. data/docs/RegistrationsApi.md +6 -6
  18. data/docs/RulesApi.md +8 -8
  19. data/docs/RulesEnvelope.md +1 -1
  20. data/docs/SnapshotResponse.md +9 -0
  21. data/docs/SnapshotResponses.md +10 -0
  22. data/docs/SnapshotsResponseEnvelope.md +9 -0
  23. data/docs/TagsApi.md +7 -7
  24. data/docs/TokenInfo.md +11 -0
  25. data/docs/TokenInfoSuccessResponse.md +8 -0
  26. data/docs/TokensApi.md +54 -7
  27. data/docs/UsersApi.md +18 -20
  28. data/git_push.sh +16 -1
  29. data/lib/artikcloud/api/device_types_api.rb +52 -59
  30. data/lib/artikcloud/api/devices_api.rb +120 -76
  31. data/lib/artikcloud/api/export_api.rb +43 -45
  32. data/lib/artikcloud/api/messages_api.rb +285 -103
  33. data/lib/artikcloud/api/registrations_api.rb +34 -34
  34. data/lib/artikcloud/api/rules_api.rb +43 -48
  35. data/lib/artikcloud/api/tags_api.rb +37 -35
  36. data/lib/artikcloud/api/tokens_api.rb +85 -30
  37. data/lib/artikcloud/api/users_api.rb +83 -102
  38. data/lib/artikcloud/api_client.rb +56 -13
  39. data/lib/artikcloud/api_error.rb +13 -4
  40. data/lib/artikcloud/configuration.rb +45 -1
  41. data/lib/artikcloud/models/ack_envelope.rb +59 -24
  42. data/lib/artikcloud/models/acknowledgement.rb +65 -33
  43. data/lib/artikcloud/models/action.rb +212 -0
  44. data/lib/artikcloud/models/action_array.rb +201 -0
  45. data/lib/artikcloud/models/action_details.rb +61 -27
  46. data/lib/artikcloud/models/action_details_array.rb +59 -24
  47. data/lib/artikcloud/models/action_in.rb +69 -39
  48. data/lib/artikcloud/models/action_out.rb +67 -36
  49. data/lib/artikcloud/models/actions.rb +241 -0
  50. data/lib/artikcloud/models/aggregate_data.rb +69 -39
  51. data/lib/artikcloud/models/aggregates_histogram_data.rb +71 -42
  52. data/lib/artikcloud/models/aggregates_histogram_response.rb +71 -42
  53. data/lib/artikcloud/models/aggregates_response.rb +69 -39
  54. data/lib/artikcloud/models/app_properties.rb +64 -30
  55. data/lib/artikcloud/models/check_token_message.rb +59 -24
  56. data/lib/artikcloud/models/check_token_response.rb +59 -24
  57. data/lib/artikcloud/models/device.rb +85 -63
  58. data/lib/artikcloud/models/device_array.rb +59 -24
  59. data/lib/artikcloud/models/device_envelope.rb +60 -24
  60. data/lib/artikcloud/models/device_reg_complete_request.rb +59 -24
  61. data/lib/artikcloud/models/device_reg_confirm_user_request.rb +63 -30
  62. data/lib/artikcloud/models/device_reg_confirm_user_response.rb +59 -24
  63. data/lib/artikcloud/models/device_reg_confirm_user_response_envelope.rb +59 -24
  64. data/lib/artikcloud/models/device_reg_status_response.rb +61 -27
  65. data/lib/artikcloud/models/device_reg_status_response_envelope.rb +59 -24
  66. data/lib/artikcloud/models/device_token.rb +69 -33
  67. data/lib/artikcloud/models/device_token_envelope.rb +60 -24
  68. data/lib/artikcloud/models/device_type.rb +93 -75
  69. data/lib/artikcloud/models/device_type_array.rb +59 -24
  70. data/lib/artikcloud/models/device_type_envelope.rb +60 -24
  71. data/lib/artikcloud/models/device_types_envelope.rb +68 -33
  72. data/lib/artikcloud/models/devices_envelope.rb +68 -33
  73. data/lib/artikcloud/models/error_envelope.rb +59 -24
  74. data/lib/artikcloud/models/export_data.rb +71 -42
  75. data/lib/artikcloud/models/export_data_array.rb +59 -24
  76. data/lib/artikcloud/models/export_history_response.rb +65 -33
  77. data/lib/artikcloud/models/export_normalized_messages_response.rb +83 -60
  78. data/lib/artikcloud/models/export_request.rb +73 -45
  79. data/lib/artikcloud/models/export_request_data.rb +79 -54
  80. data/lib/artikcloud/models/export_request_info.rb +77 -51
  81. data/lib/artikcloud/models/export_request_response.rb +59 -24
  82. data/lib/artikcloud/models/export_response.rb +79 -54
  83. data/lib/artikcloud/models/export_status_response.rb +67 -36
  84. data/lib/artikcloud/models/field_path.rb +59 -24
  85. data/lib/artikcloud/models/field_presence.rb +60 -24
  86. data/lib/artikcloud/models/field_presence_envelope.rb +78 -42
  87. data/lib/artikcloud/models/fields_actions.rb +61 -27
  88. data/lib/artikcloud/models/manifest_properties.rb +60 -24
  89. data/lib/artikcloud/models/manifest_properties_envelope.rb +60 -24
  90. data/lib/artikcloud/models/manifest_versions.rb +60 -24
  91. data/lib/artikcloud/models/manifest_versions_envelope.rb +60 -24
  92. data/lib/artikcloud/models/message.rb +233 -0
  93. data/lib/artikcloud/models/message_action.rb +67 -36
  94. data/lib/artikcloud/models/message_id.rb +59 -24
  95. data/lib/artikcloud/models/message_id_envelope.rb +59 -24
  96. data/lib/artikcloud/models/message_in.rb +69 -39
  97. data/lib/artikcloud/models/message_out.rb +67 -36
  98. data/lib/artikcloud/models/non_empty_string.rb +59 -24
  99. data/lib/artikcloud/models/normalized_action.rb +279 -0
  100. data/lib/artikcloud/models/normalized_actions_envelope.rb +285 -0
  101. data/lib/artikcloud/models/normalized_message.rb +81 -45
  102. data/lib/artikcloud/models/normalized_messages_envelope.rb +80 -51
  103. data/lib/artikcloud/models/output_rule.rb +85 -63
  104. data/lib/artikcloud/models/presence_envelope.rb +208 -0
  105. data/lib/artikcloud/models/presence_model.rb +208 -0
  106. data/lib/artikcloud/models/properties_envelope.rb +60 -24
  107. data/lib/artikcloud/models/refresh_token_response.rb +65 -33
  108. data/lib/artikcloud/models/register_message.rb +67 -36
  109. data/lib/artikcloud/models/rule_array.rb +59 -24
  110. data/lib/artikcloud/models/rule_creation_info.rb +65 -33
  111. data/lib/artikcloud/models/rule_envelope.rb +59 -24
  112. data/lib/artikcloud/models/rule_error.rb +65 -33
  113. data/lib/artikcloud/models/rule_update_info.rb +65 -33
  114. data/lib/artikcloud/models/rule_warning_output.rb +61 -27
  115. data/lib/artikcloud/models/rules_envelope.rb +69 -35
  116. data/lib/artikcloud/models/snapshot_response.rb +210 -0
  117. data/lib/artikcloud/models/snapshot_responses.rb +219 -0
  118. data/lib/artikcloud/models/snapshots_response_envelope.rb +208 -0
  119. data/lib/artikcloud/models/tag.rb +61 -27
  120. data/lib/artikcloud/models/tag_array.rb +59 -24
  121. data/lib/artikcloud/models/tags_envelope.rb +59 -24
  122. data/lib/artikcloud/models/token.rb +65 -33
  123. data/lib/artikcloud/models/token_info.rb +226 -0
  124. data/lib/artikcloud/models/token_info_success_response.rb +199 -0
  125. data/lib/artikcloud/models/token_request.rb +59 -24
  126. data/lib/artikcloud/models/token_response.rb +59 -24
  127. data/lib/artikcloud/models/unregister_device_response.rb +79 -54
  128. data/lib/artikcloud/models/unregister_device_response_envelope.rb +59 -24
  129. data/lib/artikcloud/models/user.rb +77 -42
  130. data/lib/artikcloud/models/user_envelope.rb +60 -24
  131. data/lib/artikcloud/models/web_socket_error.rb +63 -30
  132. data/lib/artikcloud/version.rb +14 -5
  133. data/lib/artikcloud.rb +26 -4
  134. data/spec/api/device_types_api_spec.rb +110 -0
  135. data/spec/api/devices_api_spec.rb +143 -0
  136. data/spec/api/export_api_spec.rb +96 -0
  137. data/spec/api/messages_api_spec.rb +7 -7
  138. data/spec/api/registrations_api_spec.rb +82 -0
  139. data/spec/api/rules_api_spec.rb +96 -0
  140. data/spec/api/tags_api_spec.rb +84 -0
  141. data/spec/api/tokens_api_spec.rb +12 -21
  142. data/spec/api/users_api_spec.rb +1 -1
  143. data/spec/spec_helper.rb +1 -1
  144. metadata +60 -22
@@ -0,0 +1,241 @@
1
+ =begin
2
+ #ARTIK Cloud API
3
+
4
+ #No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module ArtikCloud
27
+ # Actions Information.
28
+ class Actions
29
+ attr_accessor :data
30
+
31
+ # Destination Device ID.
32
+ attr_accessor :ddid
33
+
34
+ # Destination Device ID.
35
+ attr_accessor :sdid
36
+
37
+ # Timestamp (past, present or future). Defaults to current time if not provided.
38
+ attr_accessor :ts
39
+
40
+ # Type - action.
41
+ attr_accessor :type
42
+
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'data' => :'data',
48
+ :'ddid' => :'ddid',
49
+ :'sdid' => :'sdid',
50
+ :'ts' => :'ts',
51
+ :'type' => :'type'
52
+ }
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.swagger_types
57
+ {
58
+ :'data' => :'ActionArray',
59
+ :'ddid' => :'String',
60
+ :'sdid' => :'String',
61
+ :'ts' => :'Integer',
62
+ :'type' => :'String'
63
+ }
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ return unless attributes.is_a?(Hash)
70
+
71
+ # convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
73
+
74
+ if attributes.has_key?(:'data')
75
+ self.data = attributes[:'data']
76
+ end
77
+
78
+ if attributes.has_key?(:'ddid')
79
+ self.ddid = attributes[:'ddid']
80
+ end
81
+
82
+ if attributes.has_key?(:'sdid')
83
+ self.sdid = attributes[:'sdid']
84
+ end
85
+
86
+ if attributes.has_key?(:'ts')
87
+ self.ts = attributes[:'ts']
88
+ end
89
+
90
+ if attributes.has_key?(:'type')
91
+ self.type = attributes[:'type']
92
+ else
93
+ self.type = "action"
94
+ end
95
+
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properies with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ return invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ return true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ data == o.data &&
117
+ ddid == o.ddid &&
118
+ sdid == o.sdid &&
119
+ ts == o.ts &&
120
+ type == o.type
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Fixnum] Hash code
131
+ def hash
132
+ [data, ddid, sdid, ts, type].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.swagger_types.each_pair do |key, type|
141
+ if type =~ /^Array<(.*)>/i
142
+ # check to ensure the input is an array given that the the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :DateTime
162
+ DateTime.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :BOOLEAN
172
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ temp_model = ArtikCloud.const_get(type).new
193
+ temp_model.build_from_hash(value)
194
+ end
195
+ end
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_hash (backward compatibility)
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_body
206
+ to_hash
207
+ end
208
+
209
+ # Returns the object in the form of hash
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_hash
212
+ hash = {}
213
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = self.send(attr)
215
+ next if value.nil?
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map{ |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ end
@@ -1,14 +1,23 @@
1
1
  =begin
2
- ARTIK Cloud API
2
+ #ARTIK Cloud API
3
+
4
+ #No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
3
5
 
4
6
  OpenAPI spec version: 2.0.0
5
7
 
6
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
7
9
 
8
- License: MIT
9
- http://en.wikipedia.org/wiki/MIT_License
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
10
15
 
11
- Terms of Service: http://www.samsung.com/global/business/mobile/info/terms-and-conditions.html
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
12
21
 
13
22
  =end
14
23
 
@@ -29,22 +38,16 @@ module ArtikCloud
29
38
 
30
39
  attr_accessor :variance
31
40
 
41
+
32
42
  # Attribute mapping from ruby-style variable name to JSON key.
33
43
  def self.attribute_map
34
44
  {
35
-
36
45
  :'count' => :'count',
37
-
38
46
  :'max' => :'max',
39
-
40
47
  :'mean' => :'mean',
41
-
42
48
  :'min' => :'min',
43
-
44
49
  :'sum' => :'sum',
45
-
46
50
  :'variance' => :'variance'
47
-
48
51
  }
49
52
  end
50
53
 
@@ -57,44 +60,58 @@ module ArtikCloud
57
60
  :'min' => :'Float',
58
61
  :'sum' => :'Float',
59
62
  :'variance' => :'Float'
60
-
61
63
  }
62
64
  end
63
65
 
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
64
68
  def initialize(attributes = {})
65
69
  return unless attributes.is_a?(Hash)
66
70
 
67
71
  # convert string to symbol for hash key
68
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
72
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
69
73
 
70
-
71
- if attributes[:'count']
74
+ if attributes.has_key?(:'count')
72
75
  self.count = attributes[:'count']
73
76
  end
74
-
75
- if attributes[:'max']
77
+
78
+ if attributes.has_key?(:'max')
76
79
  self.max = attributes[:'max']
77
80
  end
78
-
79
- if attributes[:'mean']
81
+
82
+ if attributes.has_key?(:'mean')
80
83
  self.mean = attributes[:'mean']
81
84
  end
82
-
83
- if attributes[:'min']
85
+
86
+ if attributes.has_key?(:'min')
84
87
  self.min = attributes[:'min']
85
88
  end
86
-
87
- if attributes[:'sum']
89
+
90
+ if attributes.has_key?(:'sum')
88
91
  self.sum = attributes[:'sum']
89
92
  end
90
-
91
- if attributes[:'variance']
93
+
94
+ if attributes.has_key?(:'variance')
92
95
  self.variance = attributes[:'variance']
93
96
  end
94
-
97
+
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properies with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+ return invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ return true
95
111
  end
96
112
 
97
- # Check equality by comparing each attribute.
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
98
115
  def ==(o)
99
116
  return true if self.equal?(o)
100
117
  self.class == o.class &&
@@ -107,35 +124,41 @@ module ArtikCloud
107
124
  end
108
125
 
109
126
  # @see the `==` method
127
+ # @param [Object] Object to be compared
110
128
  def eql?(o)
111
129
  self == o
112
130
  end
113
131
 
114
- # Calculate hash code according to all attributes.
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Fixnum] Hash code
115
134
  def hash
116
135
  [count, max, mean, min, sum, variance].hash
117
136
  end
118
137
 
119
- # build the object from hash
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
120
141
  def build_from_hash(attributes)
121
142
  return nil unless attributes.is_a?(Hash)
122
143
  self.class.swagger_types.each_pair do |key, type|
123
144
  if type =~ /^Array<(.*)>/i
145
+ # check to ensure the input is an array given that the the attribute
146
+ # is documented as an array but the input is not
124
147
  if attributes[self.class.attribute_map[key]].is_a?(Array)
125
148
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
126
- else
127
- #TODO show warning in debug mode
128
149
  end
129
150
  elsif !attributes[self.class.attribute_map[key]].nil?
130
151
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
- else
132
- # data not found in attributes(hash), not an issue as the data can be optional
133
- end
152
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
134
153
  end
135
154
 
136
155
  self
137
156
  end
138
157
 
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
139
162
  def _deserialize(type, value)
140
163
  case type.to_sym
141
164
  when :DateTime
@@ -169,21 +192,25 @@ module ArtikCloud
169
192
  end
170
193
  end
171
194
  else # model
172
- _model = ArtikCloud.const_get(type).new
173
- _model.build_from_hash(value)
195
+ temp_model = ArtikCloud.const_get(type).new
196
+ temp_model.build_from_hash(value)
174
197
  end
175
198
  end
176
199
 
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
177
202
  def to_s
178
203
  to_hash.to_s
179
204
  end
180
205
 
181
- # to_body is an alias to to_body (backward compatibility))
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
182
208
  def to_body
183
209
  to_hash
184
210
  end
185
211
 
186
- # return the object in the form of hash
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
187
214
  def to_hash
188
215
  hash = {}
189
216
  self.class.attribute_map.each_pair do |attr, param|
@@ -194,8 +221,10 @@ module ArtikCloud
194
221
  hash
195
222
  end
196
223
 
197
- # Method to output non-array value in the form of hash
224
+ # Outputs non-array value in the form of hash
198
225
  # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
199
228
  def _to_hash(value)
200
229
  if value.is_a?(Array)
201
230
  value.compact.map{ |v| _to_hash(v) }
@@ -211,4 +240,5 @@ module ArtikCloud
211
240
  end
212
241
 
213
242
  end
243
+
214
244
  end
@@ -1,14 +1,23 @@
1
1
  =begin
2
- ARTIK Cloud API
2
+ #ARTIK Cloud API
3
+
4
+ #No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
3
5
 
4
6
  OpenAPI spec version: 2.0.0
5
7
 
6
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
7
9
 
8
- License: MIT
9
- http://en.wikipedia.org/wiki/MIT_License
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
10
15
 
11
- Terms of Service: http://www.samsung.com/global/business/mobile/info/terms-and-conditions.html
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
12
21
 
13
22
  =end
14
23
 
@@ -31,24 +40,17 @@ module ArtikCloud
31
40
 
32
41
  attr_accessor :variance
33
42
 
43
+
34
44
  # Attribute mapping from ruby-style variable name to JSON key.
35
45
  def self.attribute_map
36
46
  {
37
-
38
47
  :'count' => :'count',
39
-
40
48
  :'max' => :'max',
41
-
42
49
  :'mean' => :'mean',
43
-
44
50
  :'min' => :'min',
45
-
46
51
  :'sum' => :'sum',
47
-
48
52
  :'ts' => :'ts',
49
-
50
53
  :'variance' => :'variance'
51
-
52
54
  }
53
55
  end
54
56
 
@@ -62,48 +64,62 @@ module ArtikCloud
62
64
  :'sum' => :'Float',
63
65
  :'ts' => :'Integer',
64
66
  :'variance' => :'Float'
65
-
66
67
  }
67
68
  end
68
69
 
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
69
72
  def initialize(attributes = {})
70
73
  return unless attributes.is_a?(Hash)
71
74
 
72
75
  # convert string to symbol for hash key
73
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
76
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
74
77
 
75
-
76
- if attributes[:'count']
78
+ if attributes.has_key?(:'count')
77
79
  self.count = attributes[:'count']
78
80
  end
79
-
80
- if attributes[:'max']
81
+
82
+ if attributes.has_key?(:'max')
81
83
  self.max = attributes[:'max']
82
84
  end
83
-
84
- if attributes[:'mean']
85
+
86
+ if attributes.has_key?(:'mean')
85
87
  self.mean = attributes[:'mean']
86
88
  end
87
-
88
- if attributes[:'min']
89
+
90
+ if attributes.has_key?(:'min')
89
91
  self.min = attributes[:'min']
90
92
  end
91
-
92
- if attributes[:'sum']
93
+
94
+ if attributes.has_key?(:'sum')
93
95
  self.sum = attributes[:'sum']
94
96
  end
95
-
96
- if attributes[:'ts']
97
+
98
+ if attributes.has_key?(:'ts')
97
99
  self.ts = attributes[:'ts']
98
100
  end
99
-
100
- if attributes[:'variance']
101
+
102
+ if attributes.has_key?(:'variance')
101
103
  self.variance = attributes[:'variance']
102
104
  end
103
-
105
+
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properies with the reasons
110
+ def list_invalid_properties
111
+ invalid_properties = Array.new
112
+ return invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ return true
104
119
  end
105
120
 
106
- # Check equality by comparing each attribute.
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
107
123
  def ==(o)
108
124
  return true if self.equal?(o)
109
125
  self.class == o.class &&
@@ -117,35 +133,41 @@ module ArtikCloud
117
133
  end
118
134
 
119
135
  # @see the `==` method
136
+ # @param [Object] Object to be compared
120
137
  def eql?(o)
121
138
  self == o
122
139
  end
123
140
 
124
- # Calculate hash code according to all attributes.
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Fixnum] Hash code
125
143
  def hash
126
144
  [count, max, mean, min, sum, ts, variance].hash
127
145
  end
128
146
 
129
- # build the object from hash
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
130
150
  def build_from_hash(attributes)
131
151
  return nil unless attributes.is_a?(Hash)
132
152
  self.class.swagger_types.each_pair do |key, type|
133
153
  if type =~ /^Array<(.*)>/i
154
+ # check to ensure the input is an array given that the the attribute
155
+ # is documented as an array but the input is not
134
156
  if attributes[self.class.attribute_map[key]].is_a?(Array)
135
157
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
136
- else
137
- #TODO show warning in debug mode
138
158
  end
139
159
  elsif !attributes[self.class.attribute_map[key]].nil?
140
160
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
- else
142
- # data not found in attributes(hash), not an issue as the data can be optional
143
- end
161
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
162
  end
145
163
 
146
164
  self
147
165
  end
148
166
 
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
149
171
  def _deserialize(type, value)
150
172
  case type.to_sym
151
173
  when :DateTime
@@ -179,21 +201,25 @@ module ArtikCloud
179
201
  end
180
202
  end
181
203
  else # model
182
- _model = ArtikCloud.const_get(type).new
183
- _model.build_from_hash(value)
204
+ temp_model = ArtikCloud.const_get(type).new
205
+ temp_model.build_from_hash(value)
184
206
  end
185
207
  end
186
208
 
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
187
211
  def to_s
188
212
  to_hash.to_s
189
213
  end
190
214
 
191
- # to_body is an alias to to_body (backward compatibility))
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
192
217
  def to_body
193
218
  to_hash
194
219
  end
195
220
 
196
- # return the object in the form of hash
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
197
223
  def to_hash
198
224
  hash = {}
199
225
  self.class.attribute_map.each_pair do |attr, param|
@@ -204,8 +230,10 @@ module ArtikCloud
204
230
  hash
205
231
  end
206
232
 
207
- # Method to output non-array value in the form of hash
233
+ # Outputs non-array value in the form of hash
208
234
  # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
209
237
  def _to_hash(value)
210
238
  if value.is_a?(Array)
211
239
  value.compact.map{ |v| _to_hash(v) }
@@ -221,4 +249,5 @@ module ArtikCloud
221
249
  end
222
250
 
223
251
  end
252
+
224
253
  end