artikcloud 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +65 -0
  4. data/LICENSE +202 -0
  5. data/README.md +230 -0
  6. data/artikcloud.gemspec +32 -0
  7. data/docs/AckEnvelope.md +8 -0
  8. data/docs/Acknowledgement.md +11 -0
  9. data/docs/ActionDetails.md +9 -0
  10. data/docs/ActionDetailsArray.md +8 -0
  11. data/docs/ActionIn.md +13 -0
  12. data/docs/ActionOut.md +12 -0
  13. data/docs/AggregateData.md +13 -0
  14. data/docs/AggregatesHistogramData.md +14 -0
  15. data/docs/AggregatesHistogramResponse.md +14 -0
  16. data/docs/AggregatesResponse.md +13 -0
  17. data/docs/AppProperties.md +10 -0
  18. data/docs/CheckTokenMessage.md +8 -0
  19. data/docs/CheckTokenResponse.md +8 -0
  20. data/docs/Device.md +21 -0
  21. data/docs/DeviceArray.md +8 -0
  22. data/docs/DeviceEnvelope.md +8 -0
  23. data/docs/DeviceRegCompleteRequest.md +8 -0
  24. data/docs/DeviceRegConfirmUserRequest.md +10 -0
  25. data/docs/DeviceRegConfirmUserResponse.md +8 -0
  26. data/docs/DeviceRegConfirmUserResponseEnvelope.md +8 -0
  27. data/docs/DeviceRegStatusResponse.md +9 -0
  28. data/docs/DeviceRegStatusResponseEnvelope.md +8 -0
  29. data/docs/DeviceToken.md +11 -0
  30. data/docs/DeviceTokenEnvelope.md +8 -0
  31. data/docs/DeviceType.md +25 -0
  32. data/docs/DeviceTypeArray.md +8 -0
  33. data/docs/DeviceTypeEnvelope.md +8 -0
  34. data/docs/DeviceTypesApi.md +284 -0
  35. data/docs/DeviceTypesEnvelope.md +11 -0
  36. data/docs/DevicesApi.md +382 -0
  37. data/docs/DevicesEnvelope.md +11 -0
  38. data/docs/ErrorEnvelope.md +8 -0
  39. data/docs/ExportApi.md +225 -0
  40. data/docs/ExportData.md +14 -0
  41. data/docs/ExportDataArray.md +8 -0
  42. data/docs/ExportHistoryResponse.md +11 -0
  43. data/docs/ExportNormalizedMessagesResponse.md +20 -0
  44. data/docs/ExportRequest.md +15 -0
  45. data/docs/ExportRequestData.md +18 -0
  46. data/docs/ExportRequestInfo.md +17 -0
  47. data/docs/ExportRequestResponse.md +8 -0
  48. data/docs/ExportResponse.md +18 -0
  49. data/docs/ExportStatusResponse.md +12 -0
  50. data/docs/FieldPath.md +8 -0
  51. data/docs/FieldPresence.md +8 -0
  52. data/docs/FieldPresenceEnvelope.md +14 -0
  53. data/docs/FieldsActions.md +9 -0
  54. data/docs/ManifestProperties.md +8 -0
  55. data/docs/ManifestPropertiesEnvelope.md +8 -0
  56. data/docs/ManifestVersions.md +8 -0
  57. data/docs/ManifestVersionsEnvelope.md +8 -0
  58. data/docs/MessageAction.md +12 -0
  59. data/docs/MessageID.md +8 -0
  60. data/docs/MessageIDEnvelope.md +8 -0
  61. data/docs/MessageIn.md +13 -0
  62. data/docs/MessageOut.md +12 -0
  63. data/docs/MessagesApi.md +382 -0
  64. data/docs/NonEmptyString.md +8 -0
  65. data/docs/NormalizedMessage.md +15 -0
  66. data/docs/NormalizedMessagesEnvelope.md +17 -0
  67. data/docs/OutputRule.md +21 -0
  68. data/docs/PropertiesEnvelope.md +8 -0
  69. data/docs/RefreshTokenResponse.md +11 -0
  70. data/docs/RegisterMessage.md +12 -0
  71. data/docs/RegistrationsApi.md +167 -0
  72. data/docs/RuleArray.md +8 -0
  73. data/docs/RuleCreationInfo.md +11 -0
  74. data/docs/RuleEnvelope.md +8 -0
  75. data/docs/RuleError.md +11 -0
  76. data/docs/RuleUpdateInfo.md +11 -0
  77. data/docs/RuleWarningOutput.md +9 -0
  78. data/docs/RulesApi.md +226 -0
  79. data/docs/RulesEnvelope.md +11 -0
  80. data/docs/Tag.md +9 -0
  81. data/docs/TagArray.md +8 -0
  82. data/docs/TagsApi.md +169 -0
  83. data/docs/TagsEnvelope.md +8 -0
  84. data/docs/Token.md +11 -0
  85. data/docs/TokenRequest.md +8 -0
  86. data/docs/TokenResponse.md +8 -0
  87. data/docs/TokensApi.md +117 -0
  88. data/docs/UnregisterDeviceResponse.md +18 -0
  89. data/docs/UnregisterDeviceResponseEnvelope.md +8 -0
  90. data/docs/User.md +14 -0
  91. data/docs/UserEnvelope.md +8 -0
  92. data/docs/UsersApi.md +474 -0
  93. data/docs/WebSocketError.md +10 -0
  94. data/git_push.sh +52 -0
  95. data/lib/artikcloud/api/device_types_api.rb +340 -0
  96. data/lib/artikcloud/api/devices_api.rb +450 -0
  97. data/lib/artikcloud/api/export_api.rb +269 -0
  98. data/lib/artikcloud/api/messages_api.rb +468 -0
  99. data/lib/artikcloud/api/registrations_api.rb +205 -0
  100. data/lib/artikcloud/api/rules_api.rb +276 -0
  101. data/lib/artikcloud/api/tags_api.rb +209 -0
  102. data/lib/artikcloud/api/tokens_api.rb +152 -0
  103. data/lib/artikcloud/api/users_api.rb +552 -0
  104. data/lib/artikcloud/api_client.rb +336 -0
  105. data/lib/artikcloud/api_error.rb +38 -0
  106. data/lib/artikcloud/configuration.rb +170 -0
  107. data/lib/artikcloud/models/ack_envelope.rb +164 -0
  108. data/lib/artikcloud/models/acknowledgement.rb +198 -0
  109. data/lib/artikcloud/models/action_details.rb +178 -0
  110. data/lib/artikcloud/models/action_details_array.rb +166 -0
  111. data/lib/artikcloud/models/action_in.rb +221 -0
  112. data/lib/artikcloud/models/action_out.rb +209 -0
  113. data/lib/artikcloud/models/aggregate_data.rb +214 -0
  114. data/lib/artikcloud/models/aggregates_histogram_data.rb +224 -0
  115. data/lib/artikcloud/models/aggregates_histogram_response.rb +226 -0
  116. data/lib/artikcloud/models/aggregates_response.rb +216 -0
  117. data/lib/artikcloud/models/app_properties.rb +184 -0
  118. data/lib/artikcloud/models/check_token_message.rb +164 -0
  119. data/lib/artikcloud/models/check_token_response.rb +164 -0
  120. data/lib/artikcloud/models/device.rb +310 -0
  121. data/lib/artikcloud/models/device_array.rb +166 -0
  122. data/lib/artikcloud/models/device_envelope.rb +164 -0
  123. data/lib/artikcloud/models/device_reg_complete_request.rb +165 -0
  124. data/lib/artikcloud/models/device_reg_confirm_user_request.rb +187 -0
  125. data/lib/artikcloud/models/device_reg_confirm_user_response.rb +165 -0
  126. data/lib/artikcloud/models/device_reg_confirm_user_response_envelope.rb +164 -0
  127. data/lib/artikcloud/models/device_reg_status_response.rb +176 -0
  128. data/lib/artikcloud/models/device_reg_status_response_envelope.rb +164 -0
  129. data/lib/artikcloud/models/device_token.rb +194 -0
  130. data/lib/artikcloud/models/device_token_envelope.rb +164 -0
  131. data/lib/artikcloud/models/device_type.rb +353 -0
  132. data/lib/artikcloud/models/device_type_array.rb +166 -0
  133. data/lib/artikcloud/models/device_type_envelope.rb +164 -0
  134. data/lib/artikcloud/models/device_types_envelope.rb +194 -0
  135. data/lib/artikcloud/models/devices_envelope.rb +194 -0
  136. data/lib/artikcloud/models/error_envelope.rb +165 -0
  137. data/lib/artikcloud/models/export_data.rb +225 -0
  138. data/lib/artikcloud/models/export_data_array.rb +166 -0
  139. data/lib/artikcloud/models/export_history_response.rb +194 -0
  140. data/lib/artikcloud/models/export_normalized_messages_response.rb +284 -0
  141. data/lib/artikcloud/models/export_request.rb +234 -0
  142. data/lib/artikcloud/models/export_request_data.rb +275 -0
  143. data/lib/artikcloud/models/export_request_info.rb +264 -0
  144. data/lib/artikcloud/models/export_request_response.rb +164 -0
  145. data/lib/artikcloud/models/export_response.rb +275 -0
  146. data/lib/artikcloud/models/export_status_response.rb +205 -0
  147. data/lib/artikcloud/models/field_path.rb +166 -0
  148. data/lib/artikcloud/models/field_presence.rb +164 -0
  149. data/lib/artikcloud/models/field_presence_envelope.rb +226 -0
  150. data/lib/artikcloud/models/fields_actions.rb +180 -0
  151. data/lib/artikcloud/models/manifest_properties.rb +164 -0
  152. data/lib/artikcloud/models/manifest_properties_envelope.rb +164 -0
  153. data/lib/artikcloud/models/manifest_versions.rb +166 -0
  154. data/lib/artikcloud/models/manifest_versions_envelope.rb +164 -0
  155. data/lib/artikcloud/models/message_action.rb +210 -0
  156. data/lib/artikcloud/models/message_id.rb +165 -0
  157. data/lib/artikcloud/models/message_id_envelope.rb +164 -0
  158. data/lib/artikcloud/models/message_in.rb +224 -0
  159. data/lib/artikcloud/models/message_out.rb +209 -0
  160. data/lib/artikcloud/models/non_empty_string.rb +164 -0
  161. data/lib/artikcloud/models/normalized_message.rb +236 -0
  162. data/lib/artikcloud/models/normalized_messages_envelope.rb +256 -0
  163. data/lib/artikcloud/models/output_rule.rb +296 -0
  164. data/lib/artikcloud/models/properties_envelope.rb +164 -0
  165. data/lib/artikcloud/models/refresh_token_response.rb +194 -0
  166. data/lib/artikcloud/models/register_message.rb +211 -0
  167. data/lib/artikcloud/models/rule_array.rb +166 -0
  168. data/lib/artikcloud/models/rule_creation_info.rb +200 -0
  169. data/lib/artikcloud/models/rule_envelope.rb +164 -0
  170. data/lib/artikcloud/models/rule_error.rb +196 -0
  171. data/lib/artikcloud/models/rule_update_info.rb +200 -0
  172. data/lib/artikcloud/models/rule_warning_output.rb +174 -0
  173. data/lib/artikcloud/models/rules_envelope.rb +194 -0
  174. data/lib/artikcloud/models/tag.rb +176 -0
  175. data/lib/artikcloud/models/tag_array.rb +166 -0
  176. data/lib/artikcloud/models/tags_envelope.rb +164 -0
  177. data/lib/artikcloud/models/token.rb +194 -0
  178. data/lib/artikcloud/models/token_request.rb +164 -0
  179. data/lib/artikcloud/models/token_response.rb +164 -0
  180. data/lib/artikcloud/models/unregister_device_response.rb +275 -0
  181. data/lib/artikcloud/models/unregister_device_response_envelope.rb +164 -0
  182. data/lib/artikcloud/models/user.rb +224 -0
  183. data/lib/artikcloud/models/user_envelope.rb +164 -0
  184. data/lib/artikcloud/models/web_socket_error.rb +187 -0
  185. data/lib/artikcloud/version.rb +17 -0
  186. data/lib/artikcloud.rb +128 -0
  187. data/pom.xml +60 -0
  188. data/spec/api/messages_api_spec.rb +79 -0
  189. data/spec/api/tokens_api_spec.rb +79 -0
  190. data/spec/api/users_api_spec.rb +50 -0
  191. data/spec/spec.opts +4 -0
  192. data/spec/spec_helper.rb +36 -0
  193. metadata +420 -0
@@ -0,0 +1,225 @@
1
+ =begin
2
+ ARTIK Cloud API
3
+
4
+ OpenAPI spec version: 2.0.0
5
+
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+ License: MIT
9
+ http://en.wikipedia.org/wiki/MIT_License
10
+
11
+ Terms of Service: http://www.samsung.com/global/business/mobile/info/terms-and-conditions.html
12
+
13
+ =end
14
+
15
+ require 'date'
16
+
17
+ module ArtikCloud
18
+ # Export Data.
19
+ class ExportData
20
+ attr_accessor :expiration_date
21
+
22
+ attr_accessor :export_id
23
+
24
+ attr_accessor :file_size
25
+
26
+ attr_accessor :md5
27
+
28
+ attr_accessor :request
29
+
30
+ # Export status
31
+ attr_accessor :status
32
+
33
+ attr_accessor :total_messages
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+
39
+ :'expiration_date' => :'expirationDate',
40
+
41
+ :'export_id' => :'exportId',
42
+
43
+ :'file_size' => :'fileSize',
44
+
45
+ :'md5' => :'md5',
46
+
47
+ :'request' => :'request',
48
+
49
+ :'status' => :'status',
50
+
51
+ :'total_messages' => :'totalMessages'
52
+
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'expiration_date' => :'Integer',
60
+ :'export_id' => :'String',
61
+ :'file_size' => :'Integer',
62
+ :'md5' => :'String',
63
+ :'request' => :'ExportRequest',
64
+ :'status' => :'String',
65
+ :'total_messages' => :'Integer'
66
+
67
+ }
68
+ end
69
+
70
+ def initialize(attributes = {})
71
+ return unless attributes.is_a?(Hash)
72
+
73
+ # convert string to symbol for hash key
74
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
75
+
76
+
77
+ if attributes[:'expirationDate']
78
+ self.expiration_date = attributes[:'expirationDate']
79
+ end
80
+
81
+ if attributes[:'exportId']
82
+ self.export_id = attributes[:'exportId']
83
+ end
84
+
85
+ if attributes[:'fileSize']
86
+ self.file_size = attributes[:'fileSize']
87
+ end
88
+
89
+ if attributes[:'md5']
90
+ self.md5 = attributes[:'md5']
91
+ end
92
+
93
+ if attributes[:'request']
94
+ self.request = attributes[:'request']
95
+ end
96
+
97
+ if attributes[:'status']
98
+ self.status = attributes[:'status']
99
+ end
100
+
101
+ if attributes[:'totalMessages']
102
+ self.total_messages = attributes[:'totalMessages']
103
+ end
104
+
105
+ end
106
+
107
+ # Check equality by comparing each attribute.
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ expiration_date == o.expiration_date &&
112
+ export_id == o.export_id &&
113
+ file_size == o.file_size &&
114
+ md5 == o.md5 &&
115
+ request == o.request &&
116
+ status == o.status &&
117
+ total_messages == o.total_messages
118
+ end
119
+
120
+ # @see the `==` method
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculate hash code according to all attributes.
126
+ def hash
127
+ [expiration_date, export_id, file_size, md5, request, status, total_messages].hash
128
+ end
129
+
130
+ # build the object from hash
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ self.class.swagger_types.each_pair do |key, type|
134
+ if type =~ /^Array<(.*)>/i
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
137
+ else
138
+ #TODO show warning in debug mode
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ else
143
+ # data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :DateTime
153
+ DateTime.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :BOOLEAN
163
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ _model = ArtikCloud.const_get(type).new
184
+ _model.build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_body (backward compatibility))
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # return the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ next if value.nil?
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Method to output non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map{ |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+
224
+ end
225
+ end
@@ -0,0 +1,166 @@
1
+ =begin
2
+ ARTIK Cloud API
3
+
4
+ OpenAPI spec version: 2.0.0
5
+
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+ License: MIT
9
+ http://en.wikipedia.org/wiki/MIT_License
10
+
11
+ Terms of Service: http://www.samsung.com/global/business/mobile/info/terms-and-conditions.html
12
+
13
+ =end
14
+
15
+ require 'date'
16
+
17
+ module ArtikCloud
18
+ # Export Data Array.
19
+ class ExportDataArray
20
+ attr_accessor :exports
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+
26
+ :'exports' => :'exports'
27
+
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'exports' => :'Array<ExportData>'
35
+
36
+ }
37
+ end
38
+
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
44
+
45
+
46
+ if attributes[:'exports']
47
+ if (value = attributes[:'exports']).is_a?(Array)
48
+ self.exports = value
49
+ end
50
+ end
51
+
52
+ end
53
+
54
+ # Check equality by comparing each attribute.
55
+ def ==(o)
56
+ return true if self.equal?(o)
57
+ self.class == o.class &&
58
+ exports == o.exports
59
+ end
60
+
61
+ # @see the `==` method
62
+ def eql?(o)
63
+ self == o
64
+ end
65
+
66
+ # Calculate hash code according to all attributes.
67
+ def hash
68
+ [exports].hash
69
+ end
70
+
71
+ # build the object from hash
72
+ def build_from_hash(attributes)
73
+ return nil unless attributes.is_a?(Hash)
74
+ self.class.swagger_types.each_pair do |key, type|
75
+ if type =~ /^Array<(.*)>/i
76
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
77
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
78
+ else
79
+ #TODO show warning in debug mode
80
+ end
81
+ elsif !attributes[self.class.attribute_map[key]].nil?
82
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
83
+ else
84
+ # data not found in attributes(hash), not an issue as the data can be optional
85
+ end
86
+ end
87
+
88
+ self
89
+ end
90
+
91
+ def _deserialize(type, value)
92
+ case type.to_sym
93
+ when :DateTime
94
+ DateTime.parse(value)
95
+ when :Date
96
+ Date.parse(value)
97
+ when :String
98
+ value.to_s
99
+ when :Integer
100
+ value.to_i
101
+ when :Float
102
+ value.to_f
103
+ when :BOOLEAN
104
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
105
+ true
106
+ else
107
+ false
108
+ end
109
+ when :Object
110
+ # generic object (usually a Hash), return directly
111
+ value
112
+ when /\AArray<(?<inner_type>.+)>\z/
113
+ inner_type = Regexp.last_match[:inner_type]
114
+ value.map { |v| _deserialize(inner_type, v) }
115
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
116
+ k_type = Regexp.last_match[:k_type]
117
+ v_type = Regexp.last_match[:v_type]
118
+ {}.tap do |hash|
119
+ value.each do |k, v|
120
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
121
+ end
122
+ end
123
+ else # model
124
+ _model = ArtikCloud.const_get(type).new
125
+ _model.build_from_hash(value)
126
+ end
127
+ end
128
+
129
+ def to_s
130
+ to_hash.to_s
131
+ end
132
+
133
+ # to_body is an alias to to_body (backward compatibility))
134
+ def to_body
135
+ to_hash
136
+ end
137
+
138
+ # return the object in the form of hash
139
+ def to_hash
140
+ hash = {}
141
+ self.class.attribute_map.each_pair do |attr, param|
142
+ value = self.send(attr)
143
+ next if value.nil?
144
+ hash[param] = _to_hash(value)
145
+ end
146
+ hash
147
+ end
148
+
149
+ # Method to output non-array value in the form of hash
150
+ # For object, use to_hash. Otherwise, just return the value
151
+ def _to_hash(value)
152
+ if value.is_a?(Array)
153
+ value.compact.map{ |v| _to_hash(v) }
154
+ elsif value.is_a?(Hash)
155
+ {}.tap do |hash|
156
+ value.each { |k, v| hash[k] = _to_hash(v) }
157
+ end
158
+ elsif value.respond_to? :to_hash
159
+ value.to_hash
160
+ else
161
+ value
162
+ end
163
+ end
164
+
165
+ end
166
+ end
@@ -0,0 +1,194 @@
1
+ =begin
2
+ ARTIK Cloud API
3
+
4
+ OpenAPI spec version: 2.0.0
5
+
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+ License: MIT
9
+ http://en.wikipedia.org/wiki/MIT_License
10
+
11
+ Terms of Service: http://www.samsung.com/global/business/mobile/info/terms-and-conditions.html
12
+
13
+ =end
14
+
15
+ require 'date'
16
+
17
+ module ArtikCloud
18
+ # Export History Response.
19
+ class ExportHistoryResponse
20
+ attr_accessor :count
21
+
22
+ attr_accessor :data
23
+
24
+ attr_accessor :offset
25
+
26
+ attr_accessor :total
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+
32
+ :'count' => :'count',
33
+
34
+ :'data' => :'data',
35
+
36
+ :'offset' => :'offset',
37
+
38
+ :'total' => :'total'
39
+
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'count' => :'Integer',
47
+ :'data' => :'ExportDataArray',
48
+ :'offset' => :'Integer',
49
+ :'total' => :'Integer'
50
+
51
+ }
52
+ end
53
+
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
59
+
60
+
61
+ if attributes[:'count']
62
+ self.count = attributes[:'count']
63
+ end
64
+
65
+ if attributes[:'data']
66
+ self.data = attributes[:'data']
67
+ end
68
+
69
+ if attributes[:'offset']
70
+ self.offset = attributes[:'offset']
71
+ end
72
+
73
+ if attributes[:'total']
74
+ self.total = attributes[:'total']
75
+ end
76
+
77
+ end
78
+
79
+ # Check equality by comparing each attribute.
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ count == o.count &&
84
+ data == o.data &&
85
+ offset == o.offset &&
86
+ total == o.total
87
+ end
88
+
89
+ # @see the `==` method
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculate hash code according to all attributes.
95
+ def hash
96
+ [count, data, offset, total].hash
97
+ end
98
+
99
+ # build the object from hash
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /^Array<(.*)>/i
104
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
105
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
106
+ else
107
+ #TODO show warning in debug mode
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ else
112
+ # data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ def _deserialize(type, value)
120
+ case type.to_sym
121
+ when :DateTime
122
+ DateTime.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :BOOLEAN
132
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ _model = ArtikCloud.const_get(type).new
153
+ _model.build_from_hash(value)
154
+ end
155
+ end
156
+
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_body (backward compatibility))
162
+ def to_body
163
+ to_hash
164
+ end
165
+
166
+ # return the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Method to output non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ def _to_hash(value)
180
+ if value.is_a?(Array)
181
+ value.compact.map{ |v| _to_hash(v) }
182
+ elsif value.is_a?(Hash)
183
+ {}.tap do |hash|
184
+ value.each { |k, v| hash[k] = _to_hash(v) }
185
+ end
186
+ elsif value.respond_to? :to_hash
187
+ value.to_hash
188
+ else
189
+ value
190
+ end
191
+ end
192
+
193
+ end
194
+ end