artikcloud 2.0.5 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -1
  3. data/LICENSE +1 -2
  4. data/README.md +50 -4
  5. data/artikcloud.gemspec +29 -5
  6. data/docs/DeviceTask.md +13 -0
  7. data/docs/DeviceTaskUpdateRequest.md +8 -0
  8. data/docs/DeviceTaskUpdateResponse.md +8 -0
  9. data/docs/DeviceTypeInfo.md +14 -0
  10. data/docs/DeviceTypeInfoEnvelope.md +8 -0
  11. data/docs/DeviceTypesApi.md +61 -0
  12. data/docs/DeviceTypesInfo.md +14 -0
  13. data/docs/DeviceTypesInfoEnvelope.md +8 -0
  14. data/docs/DevicesManagementApi.md +870 -0
  15. data/docs/EventFeedData.md +10 -0
  16. data/docs/MetadataEnvelope.md +8 -0
  17. data/docs/MetadataPropertiesEnvelope.md +8 -0
  18. data/docs/MetadataQueryEnvelope.md +11 -0
  19. data/docs/MetadataRequest.md +7 -0
  20. data/docs/Task.md +18 -0
  21. data/docs/TaskByDid.md +19 -0
  22. data/docs/TaskByDidList.md +8 -0
  23. data/docs/TaskByDidListEnvelope.md +11 -0
  24. data/docs/TaskEnvelope.md +8 -0
  25. data/docs/TaskHistory.md +13 -0
  26. data/docs/TaskHistoryList.md +8 -0
  27. data/docs/TaskList.md +8 -0
  28. data/docs/TaskListEnvelope.md +12 -0
  29. data/docs/TaskParameters.md +9 -0
  30. data/docs/TaskRequest.md +13 -0
  31. data/docs/TaskStatus.md +13 -0
  32. data/docs/TaskStatusCounts.md +12 -0
  33. data/docs/TaskStatuses.md +19 -0
  34. data/docs/TaskStatusesEnvelope.md +11 -0
  35. data/docs/TaskStatusesHistoryEnvelope.md +8 -0
  36. data/docs/TaskUpdateRequest.md +8 -0
  37. data/docs/TaskUpdateResponse.md +8 -0
  38. data/docs/TasksStatusCounts.md +11 -0
  39. data/lib/artikcloud/api/device_types_api.rb +66 -0
  40. data/lib/artikcloud/api/devices_management_api.rb +971 -0
  41. data/lib/artikcloud/models/device_task.rb +250 -0
  42. data/lib/artikcloud/models/device_task_update_request.rb +200 -0
  43. data/lib/artikcloud/models/device_task_update_response.rb +200 -0
  44. data/lib/artikcloud/models/device_type_info.rb +260 -0
  45. data/lib/artikcloud/models/device_type_info_envelope.rb +199 -0
  46. data/lib/artikcloud/models/device_types_info.rb +260 -0
  47. data/lib/artikcloud/models/device_types_info_envelope.rb +199 -0
  48. data/lib/artikcloud/models/event_feed_data.rb +222 -0
  49. data/lib/artikcloud/models/metadata_envelope.rb +202 -0
  50. data/lib/artikcloud/models/metadata_properties_envelope.rb +201 -0
  51. data/lib/artikcloud/models/metadata_query_envelope.rb +232 -0
  52. data/lib/artikcloud/models/metadata_request.rb +190 -0
  53. data/lib/artikcloud/models/task.rb +302 -0
  54. data/lib/artikcloud/models/task_by_did.rb +314 -0
  55. data/lib/artikcloud/models/task_by_did_list.rb +202 -0
  56. data/lib/artikcloud/models/task_by_did_list_envelope.rb +230 -0
  57. data/lib/artikcloud/models/task_envelope.rb +200 -0
  58. data/lib/artikcloud/models/task_history.rb +250 -0
  59. data/lib/artikcloud/models/task_history_list.rb +202 -0
  60. data/lib/artikcloud/models/task_list.rb +202 -0
  61. data/lib/artikcloud/models/task_list_envelope.rb +240 -0
  62. data/lib/artikcloud/models/task_parameters.rb +210 -0
  63. data/lib/artikcloud/models/task_request.rb +252 -0
  64. data/lib/artikcloud/models/task_status.rb +250 -0
  65. data/lib/artikcloud/models/task_status_counts.rb +240 -0
  66. data/lib/artikcloud/models/task_statuses.rb +314 -0
  67. data/lib/artikcloud/models/task_statuses_envelope.rb +230 -0
  68. data/lib/artikcloud/models/task_statuses_history_envelope.rb +200 -0
  69. data/lib/artikcloud/models/task_update_request.rb +200 -0
  70. data/lib/artikcloud/models/task_update_response.rb +200 -0
  71. data/lib/artikcloud/models/tasks_status_counts.rb +230 -0
  72. data/lib/artikcloud/version.rb +1 -1
  73. data/lib/artikcloud.rb +31 -0
  74. data/pom.xml +1 -1
  75. data/spec/api/devices_api_spec.rb +7 -10
  76. data/spec/api/devices_management_api_spec.rb +251 -0
  77. data/spec/api/messages_api_spec.rb +67 -25
  78. data/spec/api/tokens_api_spec.rb +10 -33
  79. data/spec/api/users_api_spec.rb +65 -14
  80. data/spec/api_client_spec.rb +237 -0
  81. data/spec/configuration_spec.rb +53 -0
  82. data/spec/factories/devices.rb +32 -0
  83. data/spec/factories/users.rb +31 -0
  84. data/spec/fixtures/cassettes/DevicesApi/get_device_presence_test/should_work.yml +50 -0
  85. data/spec/fixtures/cassettes/MessagesApi/get_message_snapshots/should_work.yml +54 -0
  86. data/spec/fixtures/cassettes/MessagesApi/send_actions/should_work.yml +93 -0
  87. data/spec/fixtures/cassettes/MessagesApi/send_message_action_test/should_work.yml +99 -0
  88. data/spec/fixtures/cassettes/TokensApi/refresh_token_test/should_work.yml +43 -0
  89. data/spec/fixtures/cassettes/TokensApi/token_info_test/should_work.yml +38 -0
  90. data/spec/fixtures/cassettes/UsersApi/get_self_test/should_work.yml +53 -0
  91. data/spec/fixtures/cassettes/UsersApi/get_user_device_types_test/should_work.yml +55 -0
  92. data/spec/fixtures/cassettes/UsersApi/get_user_devices_test/should_work.yml +55 -0
  93. data/spec/fixtures/cassettes/UsersApi/get_user_properties_update_user_properties_and_delete_user_properties_test/should_work.yml +52 -0
  94. data/spec/fixtures/cassettes/UsersApi/get_user_rules_test/should_work.yml +58 -0
  95. data/spec/spec_helper.rb +20 -5
  96. metadata +142 -46
@@ -0,0 +1,250 @@
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
+ #
28
+ class TaskStatus
29
+ # Number of attempts
30
+ attr_accessor :num_attempts
31
+
32
+ # Error Message
33
+ attr_accessor :error_message
34
+
35
+ # Error Code
36
+ attr_accessor :error_code
37
+
38
+ # Device ID
39
+ attr_accessor :did
40
+
41
+ # Status
42
+ attr_accessor :status
43
+
44
+ # Timestamp of most recent status change
45
+ attr_accessor :ts
46
+
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'num_attempts' => :'numAttempts',
52
+ :'error_message' => :'errorMessage',
53
+ :'error_code' => :'errorCode',
54
+ :'did' => :'did',
55
+ :'status' => :'status',
56
+ :'ts' => :'ts'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+ :'num_attempts' => :'Integer',
64
+ :'error_message' => :'String',
65
+ :'error_code' => :'String',
66
+ :'did' => :'String',
67
+ :'status' => :'String',
68
+ :'ts' => :'Integer'
69
+ }
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ return unless attributes.is_a?(Hash)
76
+
77
+ # convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
79
+
80
+ if attributes.has_key?(:'numAttempts')
81
+ self.num_attempts = attributes[:'numAttempts']
82
+ end
83
+
84
+ if attributes.has_key?(:'errorMessage')
85
+ self.error_message = attributes[:'errorMessage']
86
+ end
87
+
88
+ if attributes.has_key?(:'errorCode')
89
+ self.error_code = attributes[:'errorCode']
90
+ end
91
+
92
+ if attributes.has_key?(:'did')
93
+ self.did = attributes[:'did']
94
+ end
95
+
96
+ if attributes.has_key?(:'status')
97
+ self.status = attributes[:'status']
98
+ end
99
+
100
+ if attributes.has_key?(:'ts')
101
+ self.ts = attributes[:'ts']
102
+ end
103
+
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properies with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ return invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ return true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ num_attempts == o.num_attempts &&
125
+ error_message == o.error_message &&
126
+ error_code == o.error_code &&
127
+ did == o.did &&
128
+ status == o.status &&
129
+ ts == o.ts
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Fixnum] Hash code
140
+ def hash
141
+ [num_attempts, error_message, error_code, did, status, ts].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ self.class.swagger_types.each_pair do |key, type|
150
+ if type =~ /^Array<(.*)>/i
151
+ # check to ensure the input is an array given that the the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
154
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
155
+ end
156
+ elsif !attributes[self.class.attribute_map[key]].nil?
157
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
159
+ end
160
+
161
+ self
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def _deserialize(type, value)
169
+ case type.to_sym
170
+ when :DateTime
171
+ DateTime.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :BOOLEAN
181
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ temp_model = ArtikCloud.const_get(type).new
202
+ temp_model.build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ next if value.nil?
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map{ |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -0,0 +1,240 @@
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
+ #
28
+ class TaskStatusCounts
29
+ # Number failed
30
+ attr_accessor :num_failed
31
+
32
+ # Number cancelled
33
+ attr_accessor :num_cancelled
34
+
35
+ # Total devices
36
+ attr_accessor :total_devices
37
+
38
+ # Number completed
39
+ attr_accessor :num_completed
40
+
41
+ # Number succeeded
42
+ attr_accessor :num_succeeded
43
+
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'num_failed' => :'numFailed',
49
+ :'num_cancelled' => :'numCancelled',
50
+ :'total_devices' => :'totalDevices',
51
+ :'num_completed' => :'numCompleted',
52
+ :'num_succeeded' => :'numSucceeded'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'num_failed' => :'Integer',
60
+ :'num_cancelled' => :'Integer',
61
+ :'total_devices' => :'Integer',
62
+ :'num_completed' => :'Integer',
63
+ :'num_succeeded' => :'Integer'
64
+ }
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ return unless attributes.is_a?(Hash)
71
+
72
+ # convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
74
+
75
+ if attributes.has_key?(:'numFailed')
76
+ self.num_failed = attributes[:'numFailed']
77
+ end
78
+
79
+ if attributes.has_key?(:'numCancelled')
80
+ self.num_cancelled = attributes[:'numCancelled']
81
+ end
82
+
83
+ if attributes.has_key?(:'totalDevices')
84
+ self.total_devices = attributes[:'totalDevices']
85
+ end
86
+
87
+ if attributes.has_key?(:'numCompleted')
88
+ self.num_completed = attributes[:'numCompleted']
89
+ end
90
+
91
+ if attributes.has_key?(:'numSucceeded')
92
+ self.num_succeeded = attributes[:'numSucceeded']
93
+ end
94
+
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properies with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ return invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ return true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ num_failed == o.num_failed &&
116
+ num_cancelled == o.num_cancelled &&
117
+ total_devices == o.total_devices &&
118
+ num_completed == o.num_completed &&
119
+ num_succeeded == o.num_succeeded
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Fixnum] Hash code
130
+ def hash
131
+ [num_failed, num_cancelled, total_devices, num_completed, num_succeeded].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ self.class.swagger_types.each_pair do |key, type|
140
+ if type =~ /^Array<(.*)>/i
141
+ # check to ensure the input is an array given that the the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :DateTime
161
+ DateTime.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :BOOLEAN
171
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ temp_model = ArtikCloud.const_get(type).new
192
+ temp_model.build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ next if value.nil?
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map{ |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end