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