artikcloud 2.1.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,197 @@
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 CertificateData
17
+ # certificate id
18
+ attr_accessor :id
19
+
20
+ attr_accessor :certificate_fields
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'id' => :'id',
27
+ :'certificate_fields' => :'certificateFields'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'id' => :'CertificateId',
35
+ :'certificate_fields' => :'CertificateFields'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
46
+
47
+ if attributes.has_key?(:'id')
48
+ self.id = attributes[:'id']
49
+ end
50
+
51
+ if attributes.has_key?(:'certificateFields')
52
+ self.certificate_fields = attributes[:'certificateFields']
53
+ end
54
+
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properies with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ return invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ return true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ id == o.id &&
76
+ certificate_fields == o.certificate_fields
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [id, certificate_fields].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = ArtikCloud.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map{ |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+
197
+ 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 CertificateEnvelope
17
+ # Output Certificate Data
18
+ attr_accessor :id
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'id' => :'id'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'id' => :'CertificateData'
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?(:'id')
44
+ self.id = attributes[:'id']
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
+ id == o.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
+ [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,237 @@
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 CertificateFields
17
+ # version
18
+ attr_accessor :version
19
+
20
+ # serialNumber
21
+ attr_accessor :serial_number
22
+
23
+ # signatureAlgorithm
24
+ attr_accessor :signature_algorithm
25
+
26
+ # subject
27
+ attr_accessor :subject
28
+
29
+ # issuer
30
+ attr_accessor :issuer
31
+
32
+ attr_accessor :validity
33
+
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'version' => :'version',
39
+ :'serial_number' => :'serialNumber',
40
+ :'signature_algorithm' => :'signatureAlgorithm',
41
+ :'subject' => :'subject',
42
+ :'issuer' => :'issuer',
43
+ :'validity' => :'validity'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'version' => :'Integer',
51
+ :'serial_number' => :'String',
52
+ :'signature_algorithm' => :'String',
53
+ :'subject' => :'String',
54
+ :'issuer' => :'String',
55
+ :'validity' => :'ValidityPeriod'
56
+ }
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
66
+
67
+ if attributes.has_key?(:'version')
68
+ self.version = attributes[:'version']
69
+ end
70
+
71
+ if attributes.has_key?(:'serialNumber')
72
+ self.serial_number = attributes[:'serialNumber']
73
+ end
74
+
75
+ if attributes.has_key?(:'signatureAlgorithm')
76
+ self.signature_algorithm = attributes[:'signatureAlgorithm']
77
+ end
78
+
79
+ if attributes.has_key?(:'subject')
80
+ self.subject = attributes[:'subject']
81
+ end
82
+
83
+ if attributes.has_key?(:'issuer')
84
+ self.issuer = attributes[:'issuer']
85
+ end
86
+
87
+ if attributes.has_key?(:'validity')
88
+ self.validity = attributes[:'validity']
89
+ end
90
+
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properies with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ return invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ version == o.version &&
112
+ serial_number == o.serial_number &&
113
+ signature_algorithm == o.signature_algorithm &&
114
+ subject == o.subject &&
115
+ issuer == o.issuer &&
116
+ validity == o.validity
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Fixnum] Hash code
127
+ def hash
128
+ [version, serial_number, signature_algorithm, subject, issuer, validity].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.swagger_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :BOOLEAN
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ temp_model = ArtikCloud.const_get(type).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map{ |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end