artikcloud 2.1.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -3
  3. data/artikcloud.gemspec +3 -4
  4. data/docs/ActionOut.md +6 -0
  5. data/docs/CertificateData.md +9 -0
  6. data/docs/CertificateEnvelope.md +8 -0
  7. data/docs/CertificateFields.md +13 -0
  8. data/docs/CertificateId.md +8 -0
  9. data/docs/ContactInfo.md +9 -0
  10. data/docs/DevicePricingTier.md +16 -0
  11. data/docs/DevicePricingTierEnvelope.md +8 -0
  12. data/docs/DevicePricingTierRequest.md +8 -0
  13. data/docs/DevicePricingTiers.md +8 -0
  14. data/docs/DevicePricingTiersEnvelope.md +8 -0
  15. data/docs/DeviceShareInfo.md +1 -1
  16. data/docs/DeviceTypePricingList.md +8 -0
  17. data/docs/DeviceTypePricingTier.md +17 -0
  18. data/docs/DeviceTypePricingTiersEnvelope.md +8 -0
  19. data/docs/DeviceTypeUpdateInput.md +8 -0
  20. data/docs/DevicesSharesApi.md +235 -0
  21. data/docs/DevicesStatusApi.md +183 -0
  22. data/docs/MessageOut.md +6 -0
  23. data/docs/MonetizationApi.md +289 -0
  24. data/docs/OutputRule.md +1 -0
  25. data/docs/RejectedCSVRow.md +8 -0
  26. data/docs/RejectedCSVRowsEnvelope.md +11 -0
  27. data/docs/Tier.md +17 -0
  28. data/docs/UpgradePath.md +8 -0
  29. data/docs/UpgradePathEnvelope.md +8 -0
  30. data/docs/UpgradePathUserToken.md +10 -0
  31. data/docs/UpgradePathUserTokenEnvelope.md +8 -0
  32. data/docs/UploadIdEnvelope.md +8 -0
  33. data/docs/UploadStatusEnvelope.md +8 -0
  34. data/docs/UsersApi.md +6 -2
  35. data/docs/ValidityPeriod.md +9 -0
  36. data/docs/Whitelist.md +10 -0
  37. data/docs/WhitelistEnvelope.md +8 -0
  38. data/docs/WhitelistResultEnvelope.md +12 -0
  39. data/docs/WhitelistingApi.md +515 -0
  40. data/lib/artikcloud/api/monetization_api.rb +296 -0
  41. data/lib/artikcloud/api/users_api.rb +3 -0
  42. data/lib/artikcloud/api/whitelisting_api.rb +519 -0
  43. data/lib/artikcloud/models/action_out.rb +62 -1
  44. data/lib/artikcloud/models/certificate_data.rb +197 -0
  45. data/lib/artikcloud/models/certificate_envelope.rb +188 -0
  46. data/lib/artikcloud/models/certificate_fields.rb +237 -0
  47. data/lib/artikcloud/models/certificate_id.rb +188 -0
  48. data/lib/artikcloud/models/contact_info.rb +198 -0
  49. data/lib/artikcloud/models/device_pricing_tier.rb +268 -0
  50. data/lib/artikcloud/models/device_pricing_tier_envelope.rb +188 -0
  51. data/lib/artikcloud/models/device_pricing_tier_request.rb +188 -0
  52. data/lib/artikcloud/models/device_pricing_tiers.rb +190 -0
  53. data/lib/artikcloud/models/device_pricing_tiers_envelope.rb +188 -0
  54. data/lib/artikcloud/models/device_share_info.rb +7 -7
  55. data/lib/artikcloud/models/device_type_pricing_list.rb +190 -0
  56. data/lib/artikcloud/models/device_type_pricing_tier.rb +280 -0
  57. data/lib/artikcloud/models/device_type_pricing_tiers_envelope.rb +188 -0
  58. data/lib/artikcloud/models/device_type_update_input.rb +188 -0
  59. data/lib/artikcloud/models/message_out.rb +65 -1
  60. data/lib/artikcloud/models/output_rule.rb +46 -4
  61. data/lib/artikcloud/models/rejected_csv_row.rb +188 -0
  62. data/lib/artikcloud/models/rejected_csv_rows_envelope.rb +220 -0
  63. data/lib/artikcloud/models/tier.rb +278 -0
  64. data/lib/artikcloud/models/upgrade_path.rb +188 -0
  65. data/lib/artikcloud/models/upgrade_path_envelope.rb +188 -0
  66. data/lib/artikcloud/models/upgrade_path_user_token.rb +208 -0
  67. data/lib/artikcloud/models/upgrade_path_user_token_envelope.rb +187 -0
  68. data/lib/artikcloud/models/upload_id_envelope.rb +188 -0
  69. data/lib/artikcloud/models/upload_status_envelope.rb +188 -0
  70. data/lib/artikcloud/models/validity_period.rb +198 -0
  71. data/lib/artikcloud/models/whitelist.rb +208 -0
  72. data/lib/artikcloud/models/whitelist_envelope.rb +190 -0
  73. data/lib/artikcloud/models/whitelist_result_envelope.rb +230 -0
  74. data/lib/artikcloud/version.rb +1 -2
  75. data/lib/artikcloud.rb +33 -3
  76. data/pom.xml +1 -1
  77. data/spec/api/device_types_api_spec.rb +3 -15
  78. data/spec/api/devices_api_spec.rb +6 -22
  79. data/spec/api/devices_management_api_spec.rb +1 -13
  80. data/spec/api/export_api_spec.rb +2 -14
  81. data/spec/api/messages_api_spec.rb +115 -74
  82. data/spec/api/monetization_api_spec.rb +99 -0
  83. data/spec/api/registrations_api_spec.rb +1 -13
  84. data/spec/api/rules_api_spec.rb +3 -15
  85. data/spec/api/tags_api_spec.rb +0 -12
  86. data/spec/api/tokens_api_spec.rb +24 -14
  87. data/spec/api/users_api_spec.rb +119 -57
  88. data/spec/api/whitelisting_api_spec.rb +152 -0
  89. data/spec/factories/users.rb +12 -12
  90. data/spec/models/action_out_spec.rb +36 -0
  91. data/spec/models/certificate_data_spec.rb +47 -0
  92. data/spec/models/certificate_envelope_spec.rb +41 -0
  93. data/spec/models/certificate_fields_spec.rb +71 -0
  94. data/spec/models/certificate_id_spec.rb +41 -0
  95. data/spec/models/contact_info_spec.rb +47 -0
  96. data/spec/models/device_pricing_tier_envelope_spec.rb +41 -0
  97. data/spec/models/device_pricing_tier_request_spec.rb +41 -0
  98. data/spec/models/device_pricing_tier_spec.rb +89 -0
  99. data/spec/models/device_pricing_tiers_envelope_spec.rb +41 -0
  100. data/spec/models/device_pricing_tiers_spec.rb +41 -0
  101. data/spec/models/device_share_info_spec.rb +1 -1
  102. data/spec/models/device_type_pricing_list_spec.rb +41 -0
  103. data/spec/models/device_type_pricing_tier_spec.rb +95 -0
  104. data/spec/models/device_type_pricing_tiers_envelope_spec.rb +41 -0
  105. data/spec/models/device_type_update_input_spec.rb +41 -0
  106. data/spec/models/message_out_spec.rb +36 -0
  107. data/spec/models/output_rule_spec.rb +10 -0
  108. data/spec/models/rejected_csv_row_spec.rb +41 -0
  109. data/spec/models/rejected_csv_rows_envelope_spec.rb +59 -0
  110. data/spec/models/tier_spec.rb +95 -0
  111. data/spec/models/upgrade_path_envelope_spec.rb +41 -0
  112. data/spec/models/upgrade_path_spec.rb +41 -0
  113. data/spec/models/upgrade_path_user_token_envelope_spec.rb +41 -0
  114. data/spec/models/upgrade_path_user_token_spec.rb +53 -0
  115. data/spec/models/upload_id_envelope_spec.rb +41 -0
  116. data/spec/models/upload_status_envelope_spec.rb +41 -0
  117. data/spec/models/validity_period_spec.rb +47 -0
  118. data/spec/models/whitelist_envelope_spec.rb +41 -0
  119. data/spec/models/whitelist_result_envelope_spec.rb +65 -0
  120. data/spec/models/whitelist_spec.rb +53 -0
  121. metadata +121 -11
  122. data/docs/.DS_Store +0 -0
  123. data/lib/.DS_Store +0 -0
  124. data/lib/artikcloud/.DS_Store +0 -0
  125. data/lib/artikcloud/api/.DS_Store +0 -0
  126. data/lib/artikcloud/models/.DS_Store +0 -0
  127. data/spec/.DS_Store +0 -0
  128. data/spec/api/.DS_Store +0 -0
@@ -0,0 +1,187 @@
1
+ =begin
2
+ #ARTIK Cloud API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module ArtikCloud
15
+ #
16
+ class UpgradePathUserTokenEnvelope
17
+ attr_accessor :data
18
+
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'data' => :'data'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ :'data' => :'UpgradePathUserToken'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
41
+
42
+ if attributes.has_key?(:'data')
43
+ self.data = attributes[:'data']
44
+ end
45
+
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properies with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ return invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ return true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ data == o.data
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [data].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /\AArray<(.*)>/i
88
+ # check to ensure the input is an array given that the the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
92
+ end
93
+ elsif !attributes[self.class.attribute_map[key]].nil?
94
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
95
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ # Deserializes the data based on type
102
+ # @param string type Data type
103
+ # @param string value Value to be deserialized
104
+ # @return [Object] Deserialized data
105
+ def _deserialize(type, value)
106
+ case type.to_sym
107
+ when :DateTime
108
+ DateTime.parse(value)
109
+ when :Date
110
+ Date.parse(value)
111
+ when :String
112
+ value.to_s
113
+ when :Integer
114
+ value.to_i
115
+ when :Float
116
+ value.to_f
117
+ when :BOOLEAN
118
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
119
+ true
120
+ else
121
+ false
122
+ end
123
+ when :Object
124
+ # generic object (usually a Hash), return directly
125
+ value
126
+ when /\AArray<(?<inner_type>.+)>\z/
127
+ inner_type = Regexp.last_match[:inner_type]
128
+ value.map { |v| _deserialize(inner_type, v) }
129
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
130
+ k_type = Regexp.last_match[:k_type]
131
+ v_type = Regexp.last_match[:v_type]
132
+ {}.tap do |hash|
133
+ value.each do |k, v|
134
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
135
+ end
136
+ end
137
+ else # model
138
+ temp_model = ArtikCloud.const_get(type).new
139
+ temp_model.build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # to_body is an alias to to_hash (backward compatibility)
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_body
152
+ to_hash
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ next if value.nil?
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ # Outputs non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ # @param [Object] value Any valid value
170
+ # @return [Hash] Returns the value in the form of hash
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map{ |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+
185
+ end
186
+
187
+ end
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #ARTIK Cloud API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module ArtikCloud
15
+ #
16
+ class UploadIdEnvelope
17
+ # Id identifying the uploaded CSV.
18
+ attr_accessor :upload_id
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'upload_id' => :'uploadId'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'upload_id' => :'String'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes.has_key?(:'uploadId')
44
+ self.upload_id = attributes[:'uploadId']
45
+ end
46
+
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properies with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ return invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ return true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ upload_id == o.upload_id
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(o)
73
+ self == o
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [upload_id].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :BOOLEAN
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ temp_model = ArtikCloud.const_get(type).new
140
+ temp_model.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
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
+
188
+ end
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #ARTIK Cloud API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module ArtikCloud
15
+ #
16
+ class UploadStatusEnvelope
17
+ # The uploaded CSV status, like 'Processing', 'Completed' or 'Failed'
18
+ attr_accessor :status
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'status' => :'status'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'status' => :'String'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes.has_key?(:'status')
44
+ self.status = attributes[:'status']
45
+ end
46
+
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properies with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ return invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ return true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ status == o.status
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(o)
73
+ self == o
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [status].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :BOOLEAN
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ temp_model = ArtikCloud.const_get(type).new
140
+ temp_model.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
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
+
188
+ end