artikcloud 2.0.8 → 2.1.0

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 (197) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -2
  3. data/LICENSE +1 -1
  4. data/README.md +39 -4
  5. data/Rakefile +8 -0
  6. data/artikcloud.gemspec +5 -16
  7. data/docs/Device.md +2 -0
  8. data/docs/DeviceShareInfo.md +8 -0
  9. data/docs/DeviceSharing.md +11 -0
  10. data/docs/DeviceSharingArray.md +8 -0
  11. data/docs/DeviceSharingEnvelope.md +11 -0
  12. data/docs/DeviceSharingId.md +8 -0
  13. data/docs/DeviceStatus.md +9 -0
  14. data/docs/DeviceStatusBatch.md +11 -0
  15. data/docs/DeviceStatusData.md +12 -0
  16. data/docs/DeviceStatusPut.md +8 -0
  17. data/docs/DeviceStatusPutData.md +8 -0
  18. data/docs/DevicessharesApi.md +235 -0
  19. data/docs/DevicestatusApi.md +183 -0
  20. data/docs/NotifMessage.md +15 -0
  21. data/docs/NotifMessageArray.md +8 -0
  22. data/docs/NotifMessagesResponse.md +12 -0
  23. data/docs/Subscription.md +24 -0
  24. data/docs/SubscriptionArray.md +8 -0
  25. data/docs/SubscriptionEnvelope.md +8 -0
  26. data/docs/SubscriptionInfo.md +20 -0
  27. data/docs/SubscriptionsApi.md +342 -0
  28. data/docs/SubscriptionsEnvelope.md +11 -0
  29. data/docs/TaskParameters.md +2 -0
  30. data/docs/UpdateParameters.md +8 -0
  31. data/docs/UsersApi.md +67 -1
  32. data/docs/ValidationCallbackInfo.md +9 -0
  33. data/git_push.sh +0 -12
  34. data/lib/artikcloud.rb +24 -13
  35. data/lib/artikcloud/api/device_types_api.rb +7 -55
  36. data/lib/artikcloud/api/devices_api.rb +12 -66
  37. data/lib/artikcloud/api/devices_management_api.rb +16 -118
  38. data/lib/artikcloud/api/devicesshares_api.rb +244 -0
  39. data/lib/artikcloud/api/devicestatus_api.rb +190 -0
  40. data/lib/artikcloud/api/export_api.rb +5 -41
  41. data/lib/artikcloud/api/messages_api.rb +10 -76
  42. data/lib/artikcloud/api/registrations_api.rb +4 -34
  43. data/lib/artikcloud/api/rules_api.rb +5 -41
  44. data/lib/artikcloud/api/subscriptions_api.rb +346 -0
  45. data/lib/artikcloud/api/tags_api.rb +4 -34
  46. data/lib/artikcloud/api/tokens_api.rb +5 -33
  47. data/lib/artikcloud/api/users_api.rb +79 -67
  48. data/lib/artikcloud/api_client.rb +17 -20
  49. data/lib/artikcloud/api_error.rb +8 -18
  50. data/lib/artikcloud/configuration.rb +1 -13
  51. data/lib/artikcloud/models/ack_envelope.rb +4 -16
  52. data/lib/artikcloud/models/acknowledgement.rb +4 -16
  53. data/lib/artikcloud/models/action.rb +4 -16
  54. data/lib/artikcloud/models/action_array.rb +4 -16
  55. data/lib/artikcloud/models/action_details.rb +4 -16
  56. data/lib/artikcloud/models/action_details_array.rb +4 -16
  57. data/lib/artikcloud/models/action_in.rb +4 -16
  58. data/lib/artikcloud/models/action_out.rb +4 -16
  59. data/lib/artikcloud/models/actions.rb +4 -16
  60. data/lib/artikcloud/models/aggregate_data.rb +4 -16
  61. data/lib/artikcloud/models/aggregates_histogram_data.rb +4 -16
  62. data/lib/artikcloud/models/aggregates_histogram_response.rb +4 -16
  63. data/lib/artikcloud/models/aggregates_response.rb +4 -16
  64. data/lib/artikcloud/models/app_properties.rb +8 -16
  65. data/lib/artikcloud/models/check_token_message.rb +4 -16
  66. data/lib/artikcloud/models/check_token_response.rb +4 -16
  67. data/lib/artikcloud/models/device.rb +28 -20
  68. data/lib/artikcloud/models/device_array.rb +4 -16
  69. data/lib/artikcloud/models/device_envelope.rb +8 -16
  70. data/lib/artikcloud/models/device_reg_complete_request.rb +4 -16
  71. data/lib/artikcloud/models/device_reg_confirm_user_request.rb +4 -16
  72. data/lib/artikcloud/models/device_reg_confirm_user_response.rb +4 -16
  73. data/lib/artikcloud/models/device_reg_confirm_user_response_envelope.rb +4 -16
  74. data/lib/artikcloud/models/device_reg_status_response.rb +4 -16
  75. data/lib/artikcloud/models/device_reg_status_response_envelope.rb +4 -16
  76. data/lib/artikcloud/models/device_share_info.rb +188 -0
  77. data/lib/artikcloud/models/device_sharing.rb +218 -0
  78. data/lib/artikcloud/models/device_sharing_array.rb +189 -0
  79. data/lib/artikcloud/models/device_sharing_envelope.rb +214 -0
  80. data/lib/artikcloud/models/device_sharing_id.rb +188 -0
  81. data/lib/artikcloud/models/device_status.rb +196 -0
  82. data/lib/artikcloud/models/device_status_batch.rb +216 -0
  83. data/lib/artikcloud/models/device_status_data.rb +225 -0
  84. data/lib/artikcloud/models/device_status_put.rb +187 -0
  85. data/lib/artikcloud/models/device_status_put_data.rb +187 -0
  86. data/lib/artikcloud/models/device_task.rb +4 -16
  87. data/lib/artikcloud/models/device_task_update_request.rb +4 -16
  88. data/lib/artikcloud/models/device_task_update_response.rb +4 -16
  89. data/lib/artikcloud/models/device_token.rb +20 -16
  90. data/lib/artikcloud/models/device_token_envelope.rb +8 -16
  91. data/lib/artikcloud/models/device_type.rb +4 -16
  92. data/lib/artikcloud/models/device_type_array.rb +4 -16
  93. data/lib/artikcloud/models/device_type_envelope.rb +8 -16
  94. data/lib/artikcloud/models/device_type_info.rb +4 -16
  95. data/lib/artikcloud/models/device_type_info_envelope.rb +4 -16
  96. data/lib/artikcloud/models/device_types_envelope.rb +16 -16
  97. data/lib/artikcloud/models/device_types_info.rb +4 -16
  98. data/lib/artikcloud/models/device_types_info_envelope.rb +4 -16
  99. data/lib/artikcloud/models/devices_envelope.rb +16 -16
  100. data/lib/artikcloud/models/error_envelope.rb +4 -16
  101. data/lib/artikcloud/models/event_feed_data.rb +4 -16
  102. data/lib/artikcloud/models/export_data.rb +4 -16
  103. data/lib/artikcloud/models/export_data_array.rb +4 -16
  104. data/lib/artikcloud/models/export_history_response.rb +4 -16
  105. data/lib/artikcloud/models/export_normalized_messages_response.rb +4 -16
  106. data/lib/artikcloud/models/export_request.rb +4 -16
  107. data/lib/artikcloud/models/export_request_data.rb +4 -16
  108. data/lib/artikcloud/models/export_request_info.rb +4 -16
  109. data/lib/artikcloud/models/export_request_response.rb +4 -16
  110. data/lib/artikcloud/models/export_response.rb +4 -16
  111. data/lib/artikcloud/models/export_status_response.rb +4 -16
  112. data/lib/artikcloud/models/field_path.rb +4 -16
  113. data/lib/artikcloud/models/field_presence.rb +8 -16
  114. data/lib/artikcloud/models/field_presence_envelope.rb +32 -16
  115. data/lib/artikcloud/models/fields_actions.rb +4 -16
  116. data/lib/artikcloud/models/manifest_properties.rb +8 -16
  117. data/lib/artikcloud/models/manifest_properties_envelope.rb +8 -16
  118. data/lib/artikcloud/models/manifest_versions.rb +8 -16
  119. data/lib/artikcloud/models/manifest_versions_envelope.rb +8 -16
  120. data/lib/artikcloud/models/message.rb +4 -16
  121. data/lib/artikcloud/models/message_action.rb +4 -16
  122. data/lib/artikcloud/models/message_id.rb +4 -16
  123. data/lib/artikcloud/models/message_id_envelope.rb +4 -16
  124. data/lib/artikcloud/models/message_in.rb +4 -16
  125. data/lib/artikcloud/models/message_out.rb +4 -16
  126. data/lib/artikcloud/models/metadata_envelope.rb +4 -16
  127. data/lib/artikcloud/models/metadata_properties_envelope.rb +4 -16
  128. data/lib/artikcloud/models/metadata_query_envelope.rb +4 -16
  129. data/lib/artikcloud/models/non_empty_string.rb +4 -16
  130. data/lib/artikcloud/models/normalized_action.rb +36 -16
  131. data/lib/artikcloud/models/normalized_actions_envelope.rb +16 -16
  132. data/lib/artikcloud/models/normalized_message.rb +36 -16
  133. data/lib/artikcloud/models/normalized_messages_envelope.rb +16 -16
  134. data/lib/artikcloud/models/notif_message.rb +252 -0
  135. data/lib/artikcloud/models/notif_message_array.rb +189 -0
  136. data/lib/artikcloud/models/notif_messages_response.rb +223 -0
  137. data/lib/artikcloud/models/output_rule.rb +4 -16
  138. data/lib/artikcloud/models/presence_envelope.rb +4 -16
  139. data/lib/artikcloud/models/presence_model.rb +4 -16
  140. data/lib/artikcloud/models/properties_envelope.rb +8 -16
  141. data/lib/artikcloud/models/refresh_token_response.rb +4 -16
  142. data/lib/artikcloud/models/register_message.rb +4 -16
  143. data/lib/artikcloud/models/rule_array.rb +4 -16
  144. data/lib/artikcloud/models/rule_creation_info.rb +4 -16
  145. data/lib/artikcloud/models/rule_envelope.rb +4 -16
  146. data/lib/artikcloud/models/rule_error.rb +4 -16
  147. data/lib/artikcloud/models/rule_update_info.rb +4 -16
  148. data/lib/artikcloud/models/rule_warning_output.rb +4 -16
  149. data/lib/artikcloud/models/rules_envelope.rb +4 -16
  150. data/lib/artikcloud/models/snapshot_response.rb +4 -16
  151. data/lib/artikcloud/models/snapshot_responses.rb +4 -16
  152. data/lib/artikcloud/models/snapshots_response_envelope.rb +4 -16
  153. data/lib/artikcloud/models/subscription.rb +348 -0
  154. data/lib/artikcloud/models/subscription_array.rb +189 -0
  155. data/lib/artikcloud/models/subscription_envelope.rb +187 -0
  156. data/lib/artikcloud/models/subscription_info.rb +308 -0
  157. data/lib/artikcloud/models/subscriptions_envelope.rb +214 -0
  158. data/lib/artikcloud/models/tag.rb +4 -16
  159. data/lib/artikcloud/models/tag_array.rb +4 -16
  160. data/lib/artikcloud/models/tags_envelope.rb +4 -16
  161. data/lib/artikcloud/models/task.rb +4 -16
  162. data/lib/artikcloud/models/task_by_did.rb +4 -16
  163. data/lib/artikcloud/models/task_by_did_list.rb +4 -16
  164. data/lib/artikcloud/models/task_by_did_list_envelope.rb +4 -16
  165. data/lib/artikcloud/models/task_envelope.rb +4 -16
  166. data/lib/artikcloud/models/task_history.rb +4 -16
  167. data/lib/artikcloud/models/task_history_list.rb +4 -16
  168. data/lib/artikcloud/models/task_list.rb +4 -16
  169. data/lib/artikcloud/models/task_list_envelope.rb +4 -16
  170. data/lib/artikcloud/models/task_parameters.rb +25 -17
  171. data/lib/artikcloud/models/task_request.rb +4 -16
  172. data/lib/artikcloud/models/task_status.rb +4 -16
  173. data/lib/artikcloud/models/task_status_counts.rb +4 -16
  174. data/lib/artikcloud/models/task_statuses.rb +4 -16
  175. data/lib/artikcloud/models/task_statuses_envelope.rb +4 -16
  176. data/lib/artikcloud/models/task_statuses_history_envelope.rb +4 -16
  177. data/lib/artikcloud/models/task_update_request.rb +4 -16
  178. data/lib/artikcloud/models/task_update_response.rb +4 -16
  179. data/lib/artikcloud/models/tasks_status_counts.rb +4 -16
  180. data/lib/artikcloud/models/token.rb +4 -16
  181. data/lib/artikcloud/models/token_info.rb +4 -16
  182. data/lib/artikcloud/models/token_info_success_response.rb +4 -16
  183. data/lib/artikcloud/models/token_request.rb +4 -16
  184. data/lib/artikcloud/models/token_response.rb +4 -16
  185. data/lib/artikcloud/models/unregister_device_response.rb +4 -16
  186. data/lib/artikcloud/models/unregister_device_response_envelope.rb +4 -16
  187. data/lib/artikcloud/models/update_parameters.rb +188 -0
  188. data/lib/artikcloud/models/user.rb +28 -16
  189. data/lib/artikcloud/models/user_envelope.rb +8 -16
  190. data/lib/artikcloud/models/validation_callback_info.rb +198 -0
  191. data/lib/artikcloud/models/web_socket_error.rb +4 -16
  192. data/lib/artikcloud/version.rb +2 -14
  193. data/pom.xml +1 -1
  194. data/spec/api/devicesshares_api_spec.rb +87 -0
  195. data/spec/api/devicestatus_api_spec.rb +75 -0
  196. data/spec/api/subscriptions_api_spec.rb +112 -0
  197. metadata +58 -26
@@ -0,0 +1,189 @@
1
+ =begin
2
+ #ARTIK Cloud API
3
+
4
+ #No description 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
+ =end
11
+
12
+ require 'date'
13
+
14
+ module ArtikCloud
15
+ #
16
+ class SubscriptionArray
17
+ attr_accessor :subscriptions
18
+
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'subscriptions' => :'subscriptions'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ :'subscriptions' => :'Array<Subscription>'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
41
+
42
+ if attributes.has_key?(:'subscriptions')
43
+ if (value = attributes[:'subscriptions']).is_a?(Array)
44
+ self.subscriptions = value
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ # Show invalid properties with the reasons. Usually used together with valid?
51
+ # @return Array for valid properies with the reasons
52
+ def list_invalid_properties
53
+ invalid_properties = Array.new
54
+ return invalid_properties
55
+ end
56
+
57
+ # Check to see if the all the properties in the model are valid
58
+ # @return true if the model is valid
59
+ def valid?
60
+ return true
61
+ end
62
+
63
+ # Checks equality by comparing each attribute.
64
+ # @param [Object] Object to be compared
65
+ def ==(o)
66
+ return true if self.equal?(o)
67
+ self.class == o.class &&
68
+ subscriptions == o.subscriptions
69
+ end
70
+
71
+ # @see the `==` method
72
+ # @param [Object] Object to be compared
73
+ def eql?(o)
74
+ self == o
75
+ end
76
+
77
+ # Calculates hash code according to all attributes.
78
+ # @return [Fixnum] Hash code
79
+ def hash
80
+ [subscriptions].hash
81
+ end
82
+
83
+ # Builds the object from hash
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ # @return [Object] Returns the model itself
86
+ def build_from_hash(attributes)
87
+ return nil unless attributes.is_a?(Hash)
88
+ self.class.swagger_types.each_pair do |key, type|
89
+ if type =~ /\AArray<(.*)>/i
90
+ # check to ensure the input is an array given that the the attribute
91
+ # is documented as an array but the input is not
92
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
93
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
94
+ end
95
+ elsif !attributes[self.class.attribute_map[key]].nil?
96
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
97
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
98
+ end
99
+
100
+ self
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param string type Data type
105
+ # @param string value Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def _deserialize(type, value)
108
+ case type.to_sym
109
+ when :DateTime
110
+ DateTime.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :BOOLEAN
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ temp_model = ArtikCloud.const_get(type).new
141
+ temp_model.build_from_hash(value)
142
+ end
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_hash (backward compatibility)
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+ hash[param] = _to_hash(value)
165
+ end
166
+ hash
167
+ end
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param [Object] value Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map{ |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+
187
+ end
188
+
189
+ end
@@ -0,0 +1,187 @@
1
+ =begin
2
+ #ARTIK Cloud API
3
+
4
+ #No description 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
+ =end
11
+
12
+ require 'date'
13
+
14
+ module ArtikCloud
15
+ #
16
+ class SubscriptionEnvelope
17
+ attr_accessor :data
18
+
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'data' => :'data'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ :'data' => :'Subscription'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
41
+
42
+ if attributes.has_key?(:'data')
43
+ self.data = attributes[:'data']
44
+ end
45
+
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properies with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ return invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ return true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ data == o.data
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [data].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /\AArray<(.*)>/i
88
+ # check to ensure the input is an array given that the the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
92
+ end
93
+ elsif !attributes[self.class.attribute_map[key]].nil?
94
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
95
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ # Deserializes the data based on type
102
+ # @param string type Data type
103
+ # @param string value Value to be deserialized
104
+ # @return [Object] Deserialized data
105
+ def _deserialize(type, value)
106
+ case type.to_sym
107
+ when :DateTime
108
+ DateTime.parse(value)
109
+ when :Date
110
+ Date.parse(value)
111
+ when :String
112
+ value.to_s
113
+ when :Integer
114
+ value.to_i
115
+ when :Float
116
+ value.to_f
117
+ when :BOOLEAN
118
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
119
+ true
120
+ else
121
+ false
122
+ end
123
+ when :Object
124
+ # generic object (usually a Hash), return directly
125
+ value
126
+ when /\AArray<(?<inner_type>.+)>\z/
127
+ inner_type = Regexp.last_match[:inner_type]
128
+ value.map { |v| _deserialize(inner_type, v) }
129
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
130
+ k_type = Regexp.last_match[:k_type]
131
+ v_type = Regexp.last_match[:v_type]
132
+ {}.tap do |hash|
133
+ value.each do |k, v|
134
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
135
+ end
136
+ end
137
+ else # model
138
+ temp_model = ArtikCloud.const_get(type).new
139
+ temp_model.build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # to_body is an alias to to_hash (backward compatibility)
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_body
152
+ to_hash
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ next if value.nil?
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ # Outputs non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ # @param [Object] value Any valid value
170
+ # @return [Hash] Returns the value in the form of hash
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map{ |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+
185
+ end
186
+
187
+ end
@@ -0,0 +1,308 @@
1
+ =begin
2
+ #ARTIK Cloud API
3
+
4
+ #No description 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
+ =end
11
+
12
+ require 'date'
13
+
14
+ module ArtikCloud
15
+ #
16
+ class SubscriptionInfo
17
+ # AWS region (if subscriptionType is awsKinesis
18
+ attr_accessor :aws_region
19
+
20
+ # Description
21
+ attr_accessor :description
22
+
23
+ # AWS key (if subscriptionType is awsKinesis
24
+ attr_accessor :aws_key
25
+
26
+ # AWS secret (if subscriptionType is awsKinesis
27
+ attr_accessor :aws_secret
28
+
29
+ # AWS Kinesis stream name (if subscriptionType is awsKinesis
30
+ attr_accessor :aws_kinesis_stream_name
31
+
32
+ # User ID
33
+ attr_accessor :uid
34
+
35
+ # Message type
36
+ attr_accessor :message_type
37
+
38
+ # Destination device ID
39
+ attr_accessor :ddid
40
+
41
+ # Subscription type (either httpCallback or awsKinesis, default to httpCallback)
42
+ attr_accessor :subscription_type
43
+
44
+ # Name
45
+ attr_accessor :name
46
+
47
+ # Source device ID
48
+ attr_accessor :sdid
49
+
50
+ # Callback URL
51
+ attr_accessor :callback_url
52
+
53
+ # Source device type ID
54
+ attr_accessor :sdtid
55
+
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'aws_region' => :'awsRegion',
61
+ :'description' => :'description',
62
+ :'aws_key' => :'awsKey',
63
+ :'aws_secret' => :'awsSecret',
64
+ :'aws_kinesis_stream_name' => :'awsKinesisStreamName',
65
+ :'uid' => :'uid',
66
+ :'message_type' => :'messageType',
67
+ :'ddid' => :'ddid',
68
+ :'subscription_type' => :'subscriptionType',
69
+ :'name' => :'name',
70
+ :'sdid' => :'sdid',
71
+ :'callback_url' => :'callbackUrl',
72
+ :'sdtid' => :'sdtid'
73
+ }
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.swagger_types
78
+ {
79
+ :'aws_region' => :'String',
80
+ :'description' => :'String',
81
+ :'aws_key' => :'String',
82
+ :'aws_secret' => :'String',
83
+ :'aws_kinesis_stream_name' => :'String',
84
+ :'uid' => :'String',
85
+ :'message_type' => :'String',
86
+ :'ddid' => :'String',
87
+ :'subscription_type' => :'String',
88
+ :'name' => :'String',
89
+ :'sdid' => :'String',
90
+ :'callback_url' => :'String',
91
+ :'sdtid' => :'String'
92
+ }
93
+ end
94
+
95
+ # Initializes the object
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ def initialize(attributes = {})
98
+ return unless attributes.is_a?(Hash)
99
+
100
+ # convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
102
+
103
+ if attributes.has_key?(:'awsRegion')
104
+ self.aws_region = attributes[:'awsRegion']
105
+ end
106
+
107
+ if attributes.has_key?(:'description')
108
+ self.description = attributes[:'description']
109
+ end
110
+
111
+ if attributes.has_key?(:'awsKey')
112
+ self.aws_key = attributes[:'awsKey']
113
+ end
114
+
115
+ if attributes.has_key?(:'awsSecret')
116
+ self.aws_secret = attributes[:'awsSecret']
117
+ end
118
+
119
+ if attributes.has_key?(:'awsKinesisStreamName')
120
+ self.aws_kinesis_stream_name = attributes[:'awsKinesisStreamName']
121
+ end
122
+
123
+ if attributes.has_key?(:'uid')
124
+ self.uid = attributes[:'uid']
125
+ end
126
+
127
+ if attributes.has_key?(:'messageType')
128
+ self.message_type = attributes[:'messageType']
129
+ end
130
+
131
+ if attributes.has_key?(:'ddid')
132
+ self.ddid = attributes[:'ddid']
133
+ end
134
+
135
+ if attributes.has_key?(:'subscriptionType')
136
+ self.subscription_type = attributes[:'subscriptionType']
137
+ end
138
+
139
+ if attributes.has_key?(:'name')
140
+ self.name = attributes[:'name']
141
+ end
142
+
143
+ if attributes.has_key?(:'sdid')
144
+ self.sdid = attributes[:'sdid']
145
+ end
146
+
147
+ if attributes.has_key?(:'callbackUrl')
148
+ self.callback_url = attributes[:'callbackUrl']
149
+ end
150
+
151
+ if attributes.has_key?(:'sdtid')
152
+ self.sdtid = attributes[:'sdtid']
153
+ end
154
+
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properies with the reasons
159
+ def list_invalid_properties
160
+ invalid_properties = Array.new
161
+ return invalid_properties
162
+ end
163
+
164
+ # Check to see if the all the properties in the model are valid
165
+ # @return true if the model is valid
166
+ def valid?
167
+ return true
168
+ end
169
+
170
+ # Checks equality by comparing each attribute.
171
+ # @param [Object] Object to be compared
172
+ def ==(o)
173
+ return true if self.equal?(o)
174
+ self.class == o.class &&
175
+ aws_region == o.aws_region &&
176
+ description == o.description &&
177
+ aws_key == o.aws_key &&
178
+ aws_secret == o.aws_secret &&
179
+ aws_kinesis_stream_name == o.aws_kinesis_stream_name &&
180
+ uid == o.uid &&
181
+ message_type == o.message_type &&
182
+ ddid == o.ddid &&
183
+ subscription_type == o.subscription_type &&
184
+ name == o.name &&
185
+ sdid == o.sdid &&
186
+ callback_url == o.callback_url &&
187
+ sdtid == o.sdtid
188
+ end
189
+
190
+ # @see the `==` method
191
+ # @param [Object] Object to be compared
192
+ def eql?(o)
193
+ self == o
194
+ end
195
+
196
+ # Calculates hash code according to all attributes.
197
+ # @return [Fixnum] Hash code
198
+ def hash
199
+ [aws_region, description, aws_key, aws_secret, aws_kinesis_stream_name, uid, message_type, ddid, subscription_type, name, sdid, callback_url, sdtid].hash
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ self.class.swagger_types.each_pair do |key, type|
208
+ if type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
212
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
213
+ end
214
+ elsif !attributes[self.class.attribute_map[key]].nil?
215
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
216
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
217
+ end
218
+
219
+ self
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def _deserialize(type, value)
227
+ case type.to_sym
228
+ when :DateTime
229
+ DateTime.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :BOOLEAN
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ temp_model = ArtikCloud.const_get(type).new
260
+ temp_model.build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ next if value.nil?
283
+ hash[param] = _to_hash(value)
284
+ end
285
+ hash
286
+ end
287
+
288
+ # Outputs non-array value in the form of hash
289
+ # For object, use to_hash. Otherwise, just return the value
290
+ # @param [Object] value Any valid value
291
+ # @return [Hash] Returns the value in the form of hash
292
+ def _to_hash(value)
293
+ if value.is_a?(Array)
294
+ value.compact.map{ |v| _to_hash(v) }
295
+ elsif value.is_a?(Hash)
296
+ {}.tap do |hash|
297
+ value.each { |k, v| hash[k] = _to_hash(v) }
298
+ end
299
+ elsif value.respond_to? :to_hash
300
+ value.to_hash
301
+ else
302
+ value
303
+ end
304
+ end
305
+
306
+ end
307
+
308
+ end