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