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,164 @@
|
|
1
|
+
=begin
|
2
|
+
ARTIK Cloud API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0.0
|
5
|
+
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
License: MIT
|
9
|
+
http://en.wikipedia.org/wiki/MIT_License
|
10
|
+
|
11
|
+
Terms of Service: http://www.samsung.com/global/business/mobile/info/terms-and-conditions.html
|
12
|
+
|
13
|
+
=end
|
14
|
+
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
module ArtikCloud
|
18
|
+
# User Envelope
|
19
|
+
class UserEnvelope
|
20
|
+
attr_accessor :data
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
|
26
|
+
:'data' => :'data'
|
27
|
+
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.swagger_types
|
33
|
+
{
|
34
|
+
:'data' => :'User'
|
35
|
+
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(attributes = {})
|
40
|
+
return unless attributes.is_a?(Hash)
|
41
|
+
|
42
|
+
# convert string to symbol for hash key
|
43
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
44
|
+
|
45
|
+
|
46
|
+
if attributes[:'data']
|
47
|
+
self.data = attributes[:'data']
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
# Check equality by comparing each attribute.
|
53
|
+
def ==(o)
|
54
|
+
return true if self.equal?(o)
|
55
|
+
self.class == o.class &&
|
56
|
+
data == o.data
|
57
|
+
end
|
58
|
+
|
59
|
+
# @see the `==` method
|
60
|
+
def eql?(o)
|
61
|
+
self == o
|
62
|
+
end
|
63
|
+
|
64
|
+
# Calculate hash code according to all attributes.
|
65
|
+
def hash
|
66
|
+
[data].hash
|
67
|
+
end
|
68
|
+
|
69
|
+
# build the object from hash
|
70
|
+
def build_from_hash(attributes)
|
71
|
+
return nil unless attributes.is_a?(Hash)
|
72
|
+
self.class.swagger_types.each_pair do |key, type|
|
73
|
+
if type =~ /^Array<(.*)>/i
|
74
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
75
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
76
|
+
else
|
77
|
+
#TODO show warning in debug mode
|
78
|
+
end
|
79
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
80
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
81
|
+
else
|
82
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
self
|
87
|
+
end
|
88
|
+
|
89
|
+
def _deserialize(type, value)
|
90
|
+
case type.to_sym
|
91
|
+
when :DateTime
|
92
|
+
DateTime.parse(value)
|
93
|
+
when :Date
|
94
|
+
Date.parse(value)
|
95
|
+
when :String
|
96
|
+
value.to_s
|
97
|
+
when :Integer
|
98
|
+
value.to_i
|
99
|
+
when :Float
|
100
|
+
value.to_f
|
101
|
+
when :BOOLEAN
|
102
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
103
|
+
true
|
104
|
+
else
|
105
|
+
false
|
106
|
+
end
|
107
|
+
when :Object
|
108
|
+
# generic object (usually a Hash), return directly
|
109
|
+
value
|
110
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
111
|
+
inner_type = Regexp.last_match[:inner_type]
|
112
|
+
value.map { |v| _deserialize(inner_type, v) }
|
113
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
114
|
+
k_type = Regexp.last_match[:k_type]
|
115
|
+
v_type = Regexp.last_match[:v_type]
|
116
|
+
{}.tap do |hash|
|
117
|
+
value.each do |k, v|
|
118
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
else # model
|
122
|
+
_model = ArtikCloud.const_get(type).new
|
123
|
+
_model.build_from_hash(value)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def to_s
|
128
|
+
to_hash.to_s
|
129
|
+
end
|
130
|
+
|
131
|
+
# to_body is an alias to to_body (backward compatibility))
|
132
|
+
def to_body
|
133
|
+
to_hash
|
134
|
+
end
|
135
|
+
|
136
|
+
# return the object in the form of hash
|
137
|
+
def to_hash
|
138
|
+
hash = {}
|
139
|
+
self.class.attribute_map.each_pair do |attr, param|
|
140
|
+
value = self.send(attr)
|
141
|
+
next if value.nil?
|
142
|
+
hash[param] = _to_hash(value)
|
143
|
+
end
|
144
|
+
hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# Method to output non-array value in the form of hash
|
148
|
+
# For object, use to_hash. Otherwise, just return the value
|
149
|
+
def _to_hash(value)
|
150
|
+
if value.is_a?(Array)
|
151
|
+
value.compact.map{ |v| _to_hash(v) }
|
152
|
+
elsif value.is_a?(Hash)
|
153
|
+
{}.tap do |hash|
|
154
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
155
|
+
end
|
156
|
+
elsif value.respond_to? :to_hash
|
157
|
+
value.to_hash
|
158
|
+
else
|
159
|
+
value
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
end
|
@@ -0,0 +1,187 @@
|
|
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 Error Information
|
19
|
+
class WebSocketError
|
20
|
+
# Message.
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# Code
|
24
|
+
attr_accessor :code
|
25
|
+
|
26
|
+
# Confirmation ID
|
27
|
+
attr_accessor :cid
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
|
33
|
+
:'message' => :'message',
|
34
|
+
|
35
|
+
:'code' => :'code',
|
36
|
+
|
37
|
+
:'cid' => :'cid'
|
38
|
+
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.swagger_types
|
44
|
+
{
|
45
|
+
:'message' => :'String',
|
46
|
+
:'code' => :'Integer',
|
47
|
+
:'cid' => :'String'
|
48
|
+
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
57
|
+
|
58
|
+
|
59
|
+
if attributes[:'message']
|
60
|
+
self.message = attributes[:'message']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes[:'code']
|
64
|
+
self.code = attributes[:'code']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes[:'cid']
|
68
|
+
self.cid = attributes[:'cid']
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check equality by comparing each attribute.
|
74
|
+
def ==(o)
|
75
|
+
return true if self.equal?(o)
|
76
|
+
self.class == o.class &&
|
77
|
+
message == o.message &&
|
78
|
+
code == o.code &&
|
79
|
+
cid == o.cid
|
80
|
+
end
|
81
|
+
|
82
|
+
# @see the `==` method
|
83
|
+
def eql?(o)
|
84
|
+
self == o
|
85
|
+
end
|
86
|
+
|
87
|
+
# Calculate hash code according to all attributes.
|
88
|
+
def hash
|
89
|
+
[message, code, cid].hash
|
90
|
+
end
|
91
|
+
|
92
|
+
# build the object from hash
|
93
|
+
def build_from_hash(attributes)
|
94
|
+
return nil unless attributes.is_a?(Hash)
|
95
|
+
self.class.swagger_types.each_pair do |key, type|
|
96
|
+
if type =~ /^Array<(.*)>/i
|
97
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
98
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
99
|
+
else
|
100
|
+
#TODO show warning in debug mode
|
101
|
+
end
|
102
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
103
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
104
|
+
else
|
105
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
self
|
110
|
+
end
|
111
|
+
|
112
|
+
def _deserialize(type, value)
|
113
|
+
case type.to_sym
|
114
|
+
when :DateTime
|
115
|
+
DateTime.parse(value)
|
116
|
+
when :Date
|
117
|
+
Date.parse(value)
|
118
|
+
when :String
|
119
|
+
value.to_s
|
120
|
+
when :Integer
|
121
|
+
value.to_i
|
122
|
+
when :Float
|
123
|
+
value.to_f
|
124
|
+
when :BOOLEAN
|
125
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
126
|
+
true
|
127
|
+
else
|
128
|
+
false
|
129
|
+
end
|
130
|
+
when :Object
|
131
|
+
# generic object (usually a Hash), return directly
|
132
|
+
value
|
133
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
134
|
+
inner_type = Regexp.last_match[:inner_type]
|
135
|
+
value.map { |v| _deserialize(inner_type, v) }
|
136
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
137
|
+
k_type = Regexp.last_match[:k_type]
|
138
|
+
v_type = Regexp.last_match[:v_type]
|
139
|
+
{}.tap do |hash|
|
140
|
+
value.each do |k, v|
|
141
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
else # model
|
145
|
+
_model = ArtikCloud.const_get(type).new
|
146
|
+
_model.build_from_hash(value)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def to_s
|
151
|
+
to_hash.to_s
|
152
|
+
end
|
153
|
+
|
154
|
+
# to_body is an alias to to_body (backward compatibility))
|
155
|
+
def to_body
|
156
|
+
to_hash
|
157
|
+
end
|
158
|
+
|
159
|
+
# return the object in the form of hash
|
160
|
+
def to_hash
|
161
|
+
hash = {}
|
162
|
+
self.class.attribute_map.each_pair do |attr, param|
|
163
|
+
value = self.send(attr)
|
164
|
+
next if value.nil?
|
165
|
+
hash[param] = _to_hash(value)
|
166
|
+
end
|
167
|
+
hash
|
168
|
+
end
|
169
|
+
|
170
|
+
# Method to output non-array value in the form of hash
|
171
|
+
# For object, use to_hash. Otherwise, just return the value
|
172
|
+
def _to_hash(value)
|
173
|
+
if value.is_a?(Array)
|
174
|
+
value.compact.map{ |v| _to_hash(v) }
|
175
|
+
elsif value.is_a?(Hash)
|
176
|
+
{}.tap do |hash|
|
177
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
178
|
+
end
|
179
|
+
elsif value.respond_to? :to_hash
|
180
|
+
value.to_hash
|
181
|
+
else
|
182
|
+
value
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|
@@ -0,0 +1,17 @@
|
|
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
|
+
module ArtikCloud
|
16
|
+
VERSION = "2.0.0"
|
17
|
+
end
|
data/lib/artikcloud.rb
ADDED
@@ -0,0 +1,128 @@
|
|
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
|
+
# Common files
|
16
|
+
require 'artikcloud/api_client'
|
17
|
+
require 'artikcloud/api_error'
|
18
|
+
require 'artikcloud/version'
|
19
|
+
require 'artikcloud/configuration'
|
20
|
+
|
21
|
+
# Models
|
22
|
+
require 'artikcloud/models/ack_envelope'
|
23
|
+
require 'artikcloud/models/acknowledgement'
|
24
|
+
require 'artikcloud/models/action_details'
|
25
|
+
require 'artikcloud/models/action_details_array'
|
26
|
+
require 'artikcloud/models/action_in'
|
27
|
+
require 'artikcloud/models/action_out'
|
28
|
+
require 'artikcloud/models/aggregate_data'
|
29
|
+
require 'artikcloud/models/aggregates_histogram_data'
|
30
|
+
require 'artikcloud/models/aggregates_histogram_response'
|
31
|
+
require 'artikcloud/models/aggregates_response'
|
32
|
+
require 'artikcloud/models/app_properties'
|
33
|
+
require 'artikcloud/models/check_token_message'
|
34
|
+
require 'artikcloud/models/check_token_response'
|
35
|
+
require 'artikcloud/models/device'
|
36
|
+
require 'artikcloud/models/device_array'
|
37
|
+
require 'artikcloud/models/device_envelope'
|
38
|
+
require 'artikcloud/models/device_reg_complete_request'
|
39
|
+
require 'artikcloud/models/device_reg_confirm_user_request'
|
40
|
+
require 'artikcloud/models/device_reg_confirm_user_response'
|
41
|
+
require 'artikcloud/models/device_reg_confirm_user_response_envelope'
|
42
|
+
require 'artikcloud/models/device_reg_status_response'
|
43
|
+
require 'artikcloud/models/device_reg_status_response_envelope'
|
44
|
+
require 'artikcloud/models/device_token'
|
45
|
+
require 'artikcloud/models/device_token_envelope'
|
46
|
+
require 'artikcloud/models/device_type'
|
47
|
+
require 'artikcloud/models/device_type_array'
|
48
|
+
require 'artikcloud/models/device_type_envelope'
|
49
|
+
require 'artikcloud/models/device_types_envelope'
|
50
|
+
require 'artikcloud/models/devices_envelope'
|
51
|
+
require 'artikcloud/models/error_envelope'
|
52
|
+
require 'artikcloud/models/export_data'
|
53
|
+
require 'artikcloud/models/export_data_array'
|
54
|
+
require 'artikcloud/models/export_history_response'
|
55
|
+
require 'artikcloud/models/export_normalized_messages_response'
|
56
|
+
require 'artikcloud/models/export_request'
|
57
|
+
require 'artikcloud/models/export_request_data'
|
58
|
+
require 'artikcloud/models/export_request_info'
|
59
|
+
require 'artikcloud/models/export_request_response'
|
60
|
+
require 'artikcloud/models/export_response'
|
61
|
+
require 'artikcloud/models/export_status_response'
|
62
|
+
require 'artikcloud/models/field_path'
|
63
|
+
require 'artikcloud/models/field_presence'
|
64
|
+
require 'artikcloud/models/field_presence_envelope'
|
65
|
+
require 'artikcloud/models/fields_actions'
|
66
|
+
require 'artikcloud/models/manifest_properties'
|
67
|
+
require 'artikcloud/models/manifest_properties_envelope'
|
68
|
+
require 'artikcloud/models/manifest_versions'
|
69
|
+
require 'artikcloud/models/manifest_versions_envelope'
|
70
|
+
require 'artikcloud/models/message_action'
|
71
|
+
require 'artikcloud/models/message_id'
|
72
|
+
require 'artikcloud/models/message_id_envelope'
|
73
|
+
require 'artikcloud/models/message_in'
|
74
|
+
require 'artikcloud/models/message_out'
|
75
|
+
require 'artikcloud/models/non_empty_string'
|
76
|
+
require 'artikcloud/models/normalized_message'
|
77
|
+
require 'artikcloud/models/normalized_messages_envelope'
|
78
|
+
require 'artikcloud/models/output_rule'
|
79
|
+
require 'artikcloud/models/properties_envelope'
|
80
|
+
require 'artikcloud/models/refresh_token_response'
|
81
|
+
require 'artikcloud/models/register_message'
|
82
|
+
require 'artikcloud/models/rule_array'
|
83
|
+
require 'artikcloud/models/rule_creation_info'
|
84
|
+
require 'artikcloud/models/rule_envelope'
|
85
|
+
require 'artikcloud/models/rule_error'
|
86
|
+
require 'artikcloud/models/rule_update_info'
|
87
|
+
require 'artikcloud/models/rule_warning_output'
|
88
|
+
require 'artikcloud/models/rules_envelope'
|
89
|
+
require 'artikcloud/models/tag'
|
90
|
+
require 'artikcloud/models/tag_array'
|
91
|
+
require 'artikcloud/models/tags_envelope'
|
92
|
+
require 'artikcloud/models/token'
|
93
|
+
require 'artikcloud/models/token_request'
|
94
|
+
require 'artikcloud/models/token_response'
|
95
|
+
require 'artikcloud/models/unregister_device_response'
|
96
|
+
require 'artikcloud/models/unregister_device_response_envelope'
|
97
|
+
require 'artikcloud/models/user'
|
98
|
+
require 'artikcloud/models/user_envelope'
|
99
|
+
require 'artikcloud/models/web_socket_error'
|
100
|
+
|
101
|
+
# APIs
|
102
|
+
require 'artikcloud/api/device_types_api'
|
103
|
+
require 'artikcloud/api/devices_api'
|
104
|
+
require 'artikcloud/api/export_api'
|
105
|
+
require 'artikcloud/api/messages_api'
|
106
|
+
require 'artikcloud/api/registrations_api'
|
107
|
+
require 'artikcloud/api/rules_api'
|
108
|
+
require 'artikcloud/api/tags_api'
|
109
|
+
require 'artikcloud/api/tokens_api'
|
110
|
+
require 'artikcloud/api/users_api'
|
111
|
+
|
112
|
+
module ArtikCloud
|
113
|
+
class << self
|
114
|
+
# Customize default settings for the SDK using block.
|
115
|
+
# ArtikCloud.configure do |config|
|
116
|
+
# config.username = "xxx"
|
117
|
+
# config.password = "xxx"
|
118
|
+
# end
|
119
|
+
# If no block given, return the default Configuration object.
|
120
|
+
def configure
|
121
|
+
if block_given?
|
122
|
+
yield(Configuration.default)
|
123
|
+
else
|
124
|
+
Configuration.default
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
data/pom.xml
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
<project>
|
2
|
+
<modelVersion>4.0.0</modelVersion>
|
3
|
+
<groupId>cloud.artik</groupId>
|
4
|
+
<artifactId>RubyArtikCloudClientTests</artifactId>
|
5
|
+
<packaging>pom</packaging>
|
6
|
+
<version>2.0.0</version>
|
7
|
+
<name>Ruby Artik Cloud Client</name>
|
8
|
+
<build>
|
9
|
+
<plugins>
|
10
|
+
<plugin>
|
11
|
+
<artifactId>maven-dependency-plugin</artifactId>
|
12
|
+
<executions>
|
13
|
+
<execution>
|
14
|
+
<phase>package</phase>
|
15
|
+
<goals>
|
16
|
+
<goal>copy-dependencies</goal>
|
17
|
+
</goals>
|
18
|
+
<configuration>
|
19
|
+
<outputDirectory>${project.build.directory}</outputDirectory>
|
20
|
+
</configuration>
|
21
|
+
</execution>
|
22
|
+
</executions>
|
23
|
+
</plugin>
|
24
|
+
<plugin>
|
25
|
+
<groupId>org.codehaus.mojo</groupId>
|
26
|
+
<artifactId>exec-maven-plugin</artifactId>
|
27
|
+
<version>1.2.1</version>
|
28
|
+
<executions>
|
29
|
+
<execution>
|
30
|
+
<id>bundle-install</id>
|
31
|
+
<phase>pre-integration-test</phase>
|
32
|
+
<goals>
|
33
|
+
<goal>exec</goal>
|
34
|
+
</goals>
|
35
|
+
<configuration>
|
36
|
+
<executable>bundle</executable>
|
37
|
+
<arguments>
|
38
|
+
<argument>install</argument>
|
39
|
+
</arguments>
|
40
|
+
</configuration>
|
41
|
+
</execution>
|
42
|
+
<execution>
|
43
|
+
<id>bundle-test</id>
|
44
|
+
<phase>integration-test</phase>
|
45
|
+
<goals>
|
46
|
+
<goal>exec</goal>
|
47
|
+
</goals>
|
48
|
+
<configuration>
|
49
|
+
<executable>bundle</executable>
|
50
|
+
<arguments>
|
51
|
+
<argument>exec</argument>
|
52
|
+
<argument>rspec</argument>
|
53
|
+
</arguments>
|
54
|
+
</configuration>
|
55
|
+
</execution>
|
56
|
+
</executions>
|
57
|
+
</plugin>
|
58
|
+
</plugins>
|
59
|
+
</build>
|
60
|
+
</project>
|
@@ -0,0 +1,79 @@
|
|
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 'spec_helper'
|
16
|
+
require 'json'
|
17
|
+
|
18
|
+
# Unit tests for ArtikCloud::MessagesApi
|
19
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
20
|
+
# Please update as you see appropriate
|
21
|
+
describe 'MessagesApi' do
|
22
|
+
before do
|
23
|
+
# run before each test
|
24
|
+
configuration = ArtikCloud::Configuration.new
|
25
|
+
configuration.access_token = '1eef3e3251e147d1ac707a57f6779c49'
|
26
|
+
api_client = ArtikCloud::ApiClient.new(configuration)
|
27
|
+
@instance = ArtikCloud::MessagesApi.new(api_client)
|
28
|
+
end
|
29
|
+
|
30
|
+
after do
|
31
|
+
# run after each test
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'test an instance of MessagesApi' do
|
35
|
+
it 'should create an instact of MessagesApi' do
|
36
|
+
@instance.should be_a(ArtikCloud::MessagesApi)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# unit tests for send_message_action
|
41
|
+
# Send Message Action
|
42
|
+
# Send a message or an Action:<br/><table><tr><th>Combination</th><th>Parameters</th><th>Description</th></tr><tr><td>Send Message</td><td>sdid, type=message</td><td>Send a message from a Source Device</td></tr><tr><td>Send Action</td><td>ddid, type=action</td><td>Send an action to a Destination Device</td></tr><tr><td>Common</td><td>data, ts, token</td><td>Parameters that can be used with the above combinations.</td></tr></table>
|
43
|
+
# @param data Message or Action object that is passed in the body
|
44
|
+
# @param [Hash] opts the optional parameters
|
45
|
+
# @return [MessageIDEnvelope]
|
46
|
+
describe 'send_message_action test' do
|
47
|
+
it "should work" do
|
48
|
+
message = ArtikCloud::MessageAction.new
|
49
|
+
message.type = "message"
|
50
|
+
message.sdid = "993925c3cd994bf7a51c620884be65e9"
|
51
|
+
message.ts = Time.now.to_f*1000
|
52
|
+
message.data = {
|
53
|
+
:'volume' => 5
|
54
|
+
}
|
55
|
+
|
56
|
+
result = @instance.send_message_action(message)
|
57
|
+
result.should be_a(ArtikCloud::MessageIDEnvelope)
|
58
|
+
message_id = result.data.mid
|
59
|
+
|
60
|
+
sleep(2)
|
61
|
+
|
62
|
+
opts = {
|
63
|
+
:mid => message_id
|
64
|
+
}
|
65
|
+
|
66
|
+
normalized_messages = @instance.get_normalized_messages(opts)
|
67
|
+
normalized_messages.should be_a(ArtikCloud::NormalizedMessagesEnvelope)
|
68
|
+
normalized_messages.size.should == 1
|
69
|
+
|
70
|
+
normalized = normalized_messages.data[0]
|
71
|
+
normalized.mid.should == message_id
|
72
|
+
|
73
|
+
volume = normalized.data["volume"]
|
74
|
+
volume.should_not be_nil
|
75
|
+
volume.should == 5
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|