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,210 @@
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
+ # Message or Action Information.
19
+ class MessageAction
20
+ attr_accessor :data
21
+
22
+ # Destination Device ID.
23
+ attr_accessor :ddid
24
+
25
+ # Source Device ID.
26
+ attr_accessor :sdid
27
+
28
+ # Timestamp (past, present or future). Defaults to current time if not provided.
29
+ attr_accessor :ts
30
+
31
+ # Type.
32
+ attr_accessor :type
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+
38
+ :'data' => :'data',
39
+
40
+ :'ddid' => :'ddid',
41
+
42
+ :'sdid' => :'sdid',
43
+
44
+ :'ts' => :'ts',
45
+
46
+ :'type' => :'type'
47
+
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.swagger_types
53
+ {
54
+ :'data' => :'Hash<String, Object>',
55
+ :'ddid' => :'String',
56
+ :'sdid' => :'String',
57
+ :'ts' => :'Integer',
58
+ :'type' => :'String'
59
+
60
+ }
61
+ end
62
+
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
68
+
69
+
70
+ if attributes[:'data']
71
+ if (value = attributes[:'data']).is_a?(Array)
72
+ self.data = value
73
+ end
74
+ end
75
+
76
+ if attributes[:'ddid']
77
+ self.ddid = attributes[:'ddid']
78
+ end
79
+
80
+ if attributes[:'sdid']
81
+ self.sdid = attributes[:'sdid']
82
+ end
83
+
84
+ if attributes[:'ts']
85
+ self.ts = attributes[:'ts']
86
+ end
87
+
88
+ if attributes[:'type']
89
+ self.type = attributes[:'type']
90
+ end
91
+
92
+ end
93
+
94
+ # Check equality by comparing each attribute.
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ data == o.data &&
99
+ ddid == o.ddid &&
100
+ sdid == o.sdid &&
101
+ ts == o.ts &&
102
+ type == o.type
103
+ end
104
+
105
+ # @see the `==` method
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculate hash code according to all attributes.
111
+ def hash
112
+ [data, ddid, sdid, ts, type].hash
113
+ end
114
+
115
+ # build the object from hash
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.swagger_types.each_pair do |key, type|
119
+ if type =~ /^Array<(.*)>/i
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
122
+ else
123
+ #TODO show warning in debug mode
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ else
128
+ # data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :BOOLEAN
148
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ _model = ArtikCloud.const_get(type).new
169
+ _model.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_body (backward compatibility))
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # return the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ next if value.nil?
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ # Method to output non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map{ |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+
209
+ end
210
+ end
@@ -0,0 +1,165 @@
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
+ # Mesage ID.
19
+ class MessageID
20
+ # Message ID.
21
+ attr_accessor :mid
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+
27
+ :'mid' => :'mid'
28
+
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'mid' => :'String'
36
+
37
+ }
38
+ end
39
+
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
45
+
46
+
47
+ if attributes[:'mid']
48
+ self.mid = attributes[:'mid']
49
+ end
50
+
51
+ end
52
+
53
+ # Check equality by comparing each attribute.
54
+ def ==(o)
55
+ return true if self.equal?(o)
56
+ self.class == o.class &&
57
+ mid == o.mid
58
+ end
59
+
60
+ # @see the `==` method
61
+ def eql?(o)
62
+ self == o
63
+ end
64
+
65
+ # Calculate hash code according to all attributes.
66
+ def hash
67
+ [mid].hash
68
+ end
69
+
70
+ # build the object from hash
71
+ def build_from_hash(attributes)
72
+ return nil unless attributes.is_a?(Hash)
73
+ self.class.swagger_types.each_pair do |key, type|
74
+ if type =~ /^Array<(.*)>/i
75
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
76
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
77
+ else
78
+ #TODO show warning in debug mode
79
+ end
80
+ elsif !attributes[self.class.attribute_map[key]].nil?
81
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
82
+ else
83
+ # data not found in attributes(hash), not an issue as the data can be optional
84
+ end
85
+ end
86
+
87
+ self
88
+ end
89
+
90
+ def _deserialize(type, value)
91
+ case type.to_sym
92
+ when :DateTime
93
+ DateTime.parse(value)
94
+ when :Date
95
+ Date.parse(value)
96
+ when :String
97
+ value.to_s
98
+ when :Integer
99
+ value.to_i
100
+ when :Float
101
+ value.to_f
102
+ when :BOOLEAN
103
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
104
+ true
105
+ else
106
+ false
107
+ end
108
+ when :Object
109
+ # generic object (usually a Hash), return directly
110
+ value
111
+ when /\AArray<(?<inner_type>.+)>\z/
112
+ inner_type = Regexp.last_match[:inner_type]
113
+ value.map { |v| _deserialize(inner_type, v) }
114
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
115
+ k_type = Regexp.last_match[:k_type]
116
+ v_type = Regexp.last_match[:v_type]
117
+ {}.tap do |hash|
118
+ value.each do |k, v|
119
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
120
+ end
121
+ end
122
+ else # model
123
+ _model = ArtikCloud.const_get(type).new
124
+ _model.build_from_hash(value)
125
+ end
126
+ end
127
+
128
+ def to_s
129
+ to_hash.to_s
130
+ end
131
+
132
+ # to_body is an alias to to_body (backward compatibility))
133
+ def to_body
134
+ to_hash
135
+ end
136
+
137
+ # return the object in the form of hash
138
+ def to_hash
139
+ hash = {}
140
+ self.class.attribute_map.each_pair do |attr, param|
141
+ value = self.send(attr)
142
+ next if value.nil?
143
+ hash[param] = _to_hash(value)
144
+ end
145
+ hash
146
+ end
147
+
148
+ # Method to output non-array value in the form of hash
149
+ # For object, use to_hash. Otherwise, just return the value
150
+ def _to_hash(value)
151
+ if value.is_a?(Array)
152
+ value.compact.map{ |v| _to_hash(v) }
153
+ elsif value.is_a?(Hash)
154
+ {}.tap do |hash|
155
+ value.each { |k, v| hash[k] = _to_hash(v) }
156
+ end
157
+ elsif value.respond_to? :to_hash
158
+ value.to_hash
159
+ else
160
+ value
161
+ end
162
+ end
163
+
164
+ end
165
+ end
@@ -0,0 +1,164 @@
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
+ # Message ID Envelope
19
+ class MessageIDEnvelope
20
+ attr_accessor :data
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+
26
+ :'data' => :'data'
27
+
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'data' => :'MessageID'
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[:'data']
47
+ self.data = attributes[:'data']
48
+ end
49
+
50
+ end
51
+
52
+ # Check equality by comparing each attribute.
53
+ def ==(o)
54
+ return true if self.equal?(o)
55
+ self.class == o.class &&
56
+ data == o.data
57
+ end
58
+
59
+ # @see the `==` method
60
+ def eql?(o)
61
+ self == o
62
+ end
63
+
64
+ # Calculate hash code according to all attributes.
65
+ def hash
66
+ [data].hash
67
+ end
68
+
69
+ # build the object from hash
70
+ def build_from_hash(attributes)
71
+ return nil unless attributes.is_a?(Hash)
72
+ self.class.swagger_types.each_pair do |key, type|
73
+ if type =~ /^Array<(.*)>/i
74
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
75
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
76
+ else
77
+ #TODO show warning in debug mode
78
+ end
79
+ elsif !attributes[self.class.attribute_map[key]].nil?
80
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
81
+ else
82
+ # data not found in attributes(hash), not an issue as the data can be optional
83
+ end
84
+ end
85
+
86
+ self
87
+ end
88
+
89
+ def _deserialize(type, value)
90
+ case type.to_sym
91
+ when :DateTime
92
+ DateTime.parse(value)
93
+ when :Date
94
+ Date.parse(value)
95
+ when :String
96
+ value.to_s
97
+ when :Integer
98
+ value.to_i
99
+ when :Float
100
+ value.to_f
101
+ when :BOOLEAN
102
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
103
+ true
104
+ else
105
+ false
106
+ end
107
+ when :Object
108
+ # generic object (usually a Hash), return directly
109
+ value
110
+ when /\AArray<(?<inner_type>.+)>\z/
111
+ inner_type = Regexp.last_match[:inner_type]
112
+ value.map { |v| _deserialize(inner_type, v) }
113
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
114
+ k_type = Regexp.last_match[:k_type]
115
+ v_type = Regexp.last_match[:v_type]
116
+ {}.tap do |hash|
117
+ value.each do |k, v|
118
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
119
+ end
120
+ end
121
+ else # model
122
+ _model = ArtikCloud.const_get(type).new
123
+ _model.build_from_hash(value)
124
+ end
125
+ end
126
+
127
+ def to_s
128
+ to_hash.to_s
129
+ end
130
+
131
+ # to_body is an alias to to_body (backward compatibility))
132
+ def to_body
133
+ to_hash
134
+ end
135
+
136
+ # return the object in the form of hash
137
+ def to_hash
138
+ hash = {}
139
+ self.class.attribute_map.each_pair do |attr, param|
140
+ value = self.send(attr)
141
+ next if value.nil?
142
+ hash[param] = _to_hash(value)
143
+ end
144
+ hash
145
+ end
146
+
147
+ # Method to output non-array value in the form of hash
148
+ # For object, use to_hash. Otherwise, just return the value
149
+ def _to_hash(value)
150
+ if value.is_a?(Array)
151
+ value.compact.map{ |v| _to_hash(v) }
152
+ elsif value.is_a?(Hash)
153
+ {}.tap do |hash|
154
+ value.each { |k, v| hash[k] = _to_hash(v) }
155
+ end
156
+ elsif value.respond_to? :to_hash
157
+ value.to_hash
158
+ else
159
+ value
160
+ end
161
+ end
162
+
163
+ end
164
+ end