appnigma-sdk 2.1.0 → 2.2.0

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 (168) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +567 -26
  4. data/exe/appnigma +8 -0
  5. data/lib/appnigma/actions.rb +33 -0
  6. data/lib/appnigma/checks.rb +13 -0
  7. data/lib/appnigma/client.rb +30 -13
  8. data/lib/appnigma/command.rb +154 -0
  9. data/lib/appnigma/command_files.rb +46 -0
  10. data/lib/appnigma/connect_fields.rb +83 -0
  11. data/lib/appnigma/connections.rb +58 -5
  12. data/lib/appnigma/constants.rb +57 -0
  13. data/lib/appnigma/end_customers.rb +29 -0
  14. data/lib/appnigma/errors.rb +44 -6
  15. data/lib/appnigma/features.rb +19 -0
  16. data/lib/appnigma/files.rb +26 -0
  17. data/lib/appnigma/generated/api/default_api.rb +2103 -402
  18. data/lib/appnigma/generated/api_client.rb +1 -1
  19. data/lib/appnigma/generated/api_error.rb +1 -1
  20. data/lib/appnigma/generated/api_model_base.rb +1 -1
  21. data/lib/appnigma/generated/configuration.rb +1 -1
  22. data/lib/appnigma/generated/models/action_entry.rb +1 -1
  23. data/lib/appnigma/generated/models/check_logic_input.rb +276 -0
  24. data/lib/appnigma/generated/models/check_logic_output.rb +193 -0
  25. data/lib/appnigma/generated/models/client_event.rb +309 -0
  26. data/lib/appnigma/generated/models/client_event_delivery.rb +306 -0
  27. data/lib/appnigma/generated/models/client_event_type.rb +44 -0
  28. data/lib/appnigma/generated/models/client_webhook.rb +346 -0
  29. data/lib/appnigma/generated/models/connect_end_customer_input.rb +243 -0
  30. data/lib/appnigma/generated/models/connect_end_customer_output.rb +294 -0
  31. data/lib/appnigma/generated/models/connect_field.rb +308 -0
  32. data/lib/appnigma/generated/models/connection_status.rb +1 -1
  33. data/lib/appnigma/generated/models/create_connection_link_input.rb +1 -1
  34. data/lib/appnigma/generated/models/create_connection_link_output.rb +1 -1
  35. data/lib/appnigma/generated/models/create_logic_input.rb +273 -0
  36. data/lib/appnigma/generated/models/create_logic_input_trigger.rb +104 -0
  37. data/lib/appnigma/generated/models/create_logic_input_trigger_any_of.rb +257 -0
  38. data/lib/appnigma/generated/models/create_logic_input_trigger_any_of1.rb +238 -0
  39. data/lib/appnigma/generated/models/create_logic_output.rb +230 -0
  40. data/lib/appnigma/generated/models/create_portal_link_input.rb +2 -18
  41. data/lib/appnigma/generated/models/create_portal_link_output.rb +1 -1
  42. data/lib/appnigma/generated/models/create_webhook_input.rb +187 -0
  43. data/lib/appnigma/generated/models/create_webhook_output.rb +204 -0
  44. data/lib/appnigma/generated/models/crm_company.rb +1 -1
  45. data/lib/appnigma/generated/models/crm_company_get_output.rb +1 -1
  46. data/lib/appnigma/generated/models/crm_company_list_output.rb +1 -1
  47. data/lib/appnigma/generated/models/crm_company_write_output.rb +1 -1
  48. data/lib/appnigma/generated/models/crm_contact.rb +1 -1
  49. data/lib/appnigma/generated/models/crm_contact_get_output.rb +1 -1
  50. data/lib/appnigma/generated/models/crm_contact_list_output.rb +1 -1
  51. data/lib/appnigma/generated/models/crm_contact_write_output.rb +1 -1
  52. data/lib/appnigma/generated/models/crm_create_input.rb +1 -1
  53. data/lib/appnigma/generated/models/crm_custom_field.rb +1 -1
  54. data/lib/appnigma/generated/models/crm_deal.rb +1 -1
  55. data/lib/appnigma/generated/models/crm_deal_create_input.rb +1 -1
  56. data/lib/appnigma/generated/models/crm_deal_get_output.rb +1 -1
  57. data/lib/appnigma/generated/models/crm_deal_list_output.rb +1 -1
  58. data/lib/appnigma/generated/models/crm_deal_write_output.rb +1 -1
  59. data/lib/appnigma/generated/models/crm_email.rb +1 -1
  60. data/lib/appnigma/generated/models/crm_get_input.rb +1 -1
  61. data/lib/appnigma/generated/models/crm_labelled.rb +1 -1
  62. data/lib/appnigma/generated/models/crm_list_input.rb +1 -1
  63. data/lib/appnigma/generated/models/crm_phone.rb +1 -1
  64. data/lib/appnigma/generated/models/crm_update_input.rb +1 -1
  65. data/lib/appnigma/generated/models/delete_end_customer_input.rb +178 -0
  66. data/lib/appnigma/generated/models/delete_end_customer_output.rb +286 -0
  67. data/lib/appnigma/generated/models/delete_end_customer_output_connections_inner.rb +238 -0
  68. data/lib/appnigma/generated/models/delete_end_customer_output_logic_folder.rb +255 -0
  69. data/lib/appnigma/generated/models/delete_end_customer_output_steps_inner.rb +257 -0
  70. data/lib/appnigma/generated/models/delete_webhook_input.rb +189 -0
  71. data/lib/appnigma/generated/models/delete_webhook_output.rb +228 -0
  72. data/lib/appnigma/generated/models/discard_logic_input.rb +292 -0
  73. data/lib/appnigma/generated/models/discard_logic_output.rb +254 -0
  74. data/lib/appnigma/generated/models/disconnect_connection_input.rb +1 -1
  75. data/lib/appnigma/generated/models/disconnect_connection_output.rb +18 -5
  76. data/lib/appnigma/generated/models/edit_logic_input.rb +368 -0
  77. data/lib/appnigma/generated/models/edit_logic_output.rb +298 -0
  78. data/lib/appnigma/generated/models/encrypted_fields.rb +357 -0
  79. data/lib/appnigma/generated/models/end_customer.rb +17 -3
  80. data/lib/appnigma/generated/models/end_customer_connection.rb +1 -1
  81. data/lib/appnigma/generated/models/function_entry.rb +1 -1
  82. data/lib/appnigma/generated/models/function_owner.rb +1 -1
  83. data/lib/appnigma/generated/models/function_owner_one_of.rb +1 -1
  84. data/lib/appnigma/generated/models/function_owner_one_of1.rb +1 -1
  85. data/lib/appnigma/generated/models/get_alerts_output.rb +180 -0
  86. data/lib/appnigma/generated/models/get_connect_key_output.rb +256 -0
  87. data/lib/appnigma/generated/models/get_connection_input.rb +1 -1
  88. data/lib/appnigma/generated/models/get_connection_output.rb +34 -7
  89. data/lib/appnigma/generated/models/get_guide_output.rb +1 -1
  90. data/lib/appnigma/generated/models/get_logic_go_live_status_input.rb +247 -0
  91. data/lib/appnigma/generated/models/get_logic_go_live_status_output.rb +296 -0
  92. data/lib/appnigma/generated/models/get_logic_input.rb +247 -0
  93. data/lib/appnigma/generated/models/get_logic_output.rb +240 -0
  94. data/lib/appnigma/generated/models/get_logic_output_file.rb +204 -0
  95. data/lib/appnigma/generated/models/get_platform_input.rb +188 -0
  96. data/lib/appnigma/generated/models/get_platform_output.rb +326 -0
  97. data/lib/appnigma/generated/models/get_sync_output.rb +207 -0
  98. data/lib/appnigma/generated/models/go_live_logic_input.rb +316 -0
  99. data/lib/appnigma/generated/models/go_live_logic_output.rb +281 -0
  100. data/lib/appnigma/generated/models/json_value.rb +1 -1
  101. data/lib/appnigma/generated/models/list_actions_output.rb +1 -1
  102. data/lib/appnigma/generated/models/list_connections_output.rb +3 -3
  103. data/lib/appnigma/generated/models/list_events_input.rb +302 -0
  104. data/lib/appnigma/generated/models/list_events_output.rb +193 -0
  105. data/lib/appnigma/generated/models/list_features_output.rb +179 -0
  106. data/lib/appnigma/generated/models/list_features_output_features_inner.rb +229 -0
  107. data/lib/appnigma/generated/models/list_functions_output.rb +1 -1
  108. data/lib/appnigma/generated/models/list_logic_input.rb +162 -0
  109. data/lib/appnigma/generated/models/list_logic_output.rb +209 -0
  110. data/lib/appnigma/generated/models/list_logic_runs_input.rb +275 -0
  111. data/lib/appnigma/generated/models/list_logic_runs_output.rb +193 -0
  112. data/lib/appnigma/generated/models/list_platforms_output.rb +1 -1
  113. data/lib/appnigma/generated/models/list_record_changes_input.rb +375 -0
  114. data/lib/appnigma/generated/models/list_record_changes_output.rb +193 -0
  115. data/lib/appnigma/generated/models/list_webhooks_output.rb +180 -0
  116. data/lib/appnigma/generated/models/logic_check_problem.rb +203 -0
  117. data/lib/appnigma/generated/models/logic_conditional.rb +3 -3
  118. data/lib/appnigma/generated/models/logic_draft.rb +257 -0
  119. data/lib/appnigma/generated/models/logic_entry.rb +441 -0
  120. data/lib/appnigma/generated/models/logic_entry_failure.rb +205 -0
  121. data/lib/appnigma/generated/models/logic_folder_problem.rb +218 -0
  122. data/lib/appnigma/generated/models/logic_run.rb +483 -0
  123. data/lib/appnigma/generated/models/logic_test_call.rb +269 -0
  124. data/lib/appnigma/generated/models/platform_entry.rb +63 -6
  125. data/lib/appnigma/generated/models/platform_entry_coverage_inner.rb +1 -1
  126. data/lib/appnigma/generated/models/platform_request_input.rb +1 -1
  127. data/lib/appnigma/generated/models/platform_request_input_body.rb +1 -1
  128. data/lib/appnigma/generated/models/platform_request_output.rb +1 -1
  129. data/lib/appnigma/generated/models/ran_as.rb +1 -1
  130. data/lib/appnigma/generated/models/record_change.rb +231 -0
  131. data/lib/appnigma/generated/models/record_change_record.rb +105 -0
  132. data/lib/appnigma/generated/models/run_action_input.rb +1 -1
  133. data/lib/appnigma/generated/models/run_action_output.rb +1 -1
  134. data/lib/appnigma/generated/models/run_input.rb +1 -1
  135. data/lib/appnigma/generated/models/run_output.rb +1 -1
  136. data/lib/appnigma/generated/models/sdk_error.rb +1 -1
  137. data/lib/appnigma/generated/models/sdk_error_error.rb +3 -3
  138. data/lib/appnigma/generated/models/sdk_error_error_details.rb +81 -6
  139. data/lib/appnigma/generated/models/sdk_problem.rb +1 -1
  140. data/lib/appnigma/generated/models/set_alerts_input.rb +197 -0
  141. data/lib/appnigma/generated/models/set_alerts_output.rb +180 -0
  142. data/lib/appnigma/generated/models/set_sync_input.rb +177 -0
  143. data/lib/appnigma/generated/models/set_sync_output.rb +207 -0
  144. data/lib/appnigma/generated/models/switch_logic_off_input.rb +200 -0
  145. data/lib/appnigma/generated/models/switch_logic_off_output.rb +315 -0
  146. data/lib/appnigma/generated/models/switch_logic_on_input.rb +200 -0
  147. data/lib/appnigma/generated/models/switch_logic_on_output.rb +315 -0
  148. data/lib/appnigma/generated/models/sync_health.rb +231 -0
  149. data/lib/appnigma/generated/models/test_logic_input.rb +355 -0
  150. data/lib/appnigma/generated/models/test_logic_output.rb +418 -0
  151. data/lib/appnigma/generated/models/test_logic_output_error.rb +231 -0
  152. data/lib/appnigma/generated/models/update_logic_input.rb +359 -0
  153. data/lib/appnigma/generated/models/update_logic_output.rb +205 -0
  154. data/lib/appnigma/generated/version.rb +1 -1
  155. data/lib/appnigma/generated.rb +75 -1
  156. data/lib/appnigma/logic.rb +176 -0
  157. data/lib/appnigma/names.rb +4 -4
  158. data/lib/appnigma/platforms.rb +11 -1
  159. data/lib/appnigma/portal.rb +8 -5
  160. data/lib/appnigma/records.rb +46 -0
  161. data/lib/appnigma/schema_type.rb +149 -0
  162. data/lib/appnigma/sync.rb +30 -0
  163. data/lib/appnigma/types_printer.rb +154 -0
  164. data/lib/appnigma/verify_webhook.rb +107 -0
  165. data/lib/appnigma/version.rb +2 -2
  166. data/lib/appnigma/webhooks.rb +79 -0
  167. data/lib/appnigma.rb +1 -0
  168. metadata +93 -3
@@ -0,0 +1,298 @@
1
+ =begin
2
+ #Appnigma SDK API
3
+
4
+ #The routes a customer's product calls through an Appnigma SDK. Every answer carries a request id in X-Request-Id; quote it when you write to support.
5
+
6
+ The version of the OpenAPI document: 5.4.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Appnigma::Generated
17
+ class EditLogicOutput < ApiModelBase
18
+ attr_accessor :platform
19
+
20
+ attr_accessor :name
21
+
22
+ # Whether the change passed the quick check and was saved as the draft. Nothing goes live either way.
23
+ attr_accessor :saved
24
+
25
+ # Why nothing was saved: the quick check's problems, by line and column in rejectedSource, or one problem with no line when the change could not be written. Empty when saved.
26
+ attr_accessor :problems
27
+
28
+ # What changed, in plain words for the person who asked; null when the change could not be written
29
+ attr_accessor :summary
30
+
31
+ # The draft now: the new one when saved, else as it was; null when there is still only the file on main
32
+ attr_accessor :draft
33
+
34
+ # When the change failed the check, the file that was written, so the problems can be shown in it; null otherwise
35
+ attr_accessor :rejected_source
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'platform' => :'platform',
41
+ :'name' => :'name',
42
+ :'saved' => :'saved',
43
+ :'problems' => :'problems',
44
+ :'summary' => :'summary',
45
+ :'draft' => :'draft',
46
+ :'rejected_source' => :'rejectedSource'
47
+ }
48
+ end
49
+
50
+ # Returns attribute mapping this model knows about
51
+ def self.acceptable_attribute_map
52
+ attribute_map
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ acceptable_attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'platform' => :'String',
64
+ :'name' => :'String',
65
+ :'saved' => :'Boolean',
66
+ :'problems' => :'Array<LogicCheckProblem>',
67
+ :'summary' => :'String',
68
+ :'draft' => :'LogicDraft',
69
+ :'rejected_source' => :'String'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ :'summary',
77
+ :'draft',
78
+ :'rejected_source'
79
+ ])
80
+ end
81
+
82
+ # Returns attribute type mapping
83
+ def self.acceptable_openapi_types
84
+ openapi_types
85
+ end
86
+
87
+ # Returns the nullable attributes
88
+ def self.acceptable_openapi_nullable
89
+ openapi_nullable
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Appnigma::Generated::EditLogicOutput` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ acceptable_attribute_map = self.class.acceptable_attribute_map
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!acceptable_attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Appnigma::Generated::EditLogicOutput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'platform')
109
+ self.platform = attributes[:'platform']
110
+ else
111
+ self.platform = nil
112
+ end
113
+
114
+ if attributes.key?(:'name')
115
+ self.name = attributes[:'name']
116
+ else
117
+ self.name = nil
118
+ end
119
+
120
+ if attributes.key?(:'saved')
121
+ self.saved = attributes[:'saved']
122
+ else
123
+ self.saved = nil
124
+ end
125
+
126
+ if attributes.key?(:'problems')
127
+ if (value = attributes[:'problems']).is_a?(Array)
128
+ self.problems = value
129
+ end
130
+ else
131
+ self.problems = nil
132
+ end
133
+
134
+ if attributes.key?(:'summary')
135
+ self.summary = attributes[:'summary']
136
+ else
137
+ self.summary = nil
138
+ end
139
+
140
+ if attributes.key?(:'draft')
141
+ self.draft = attributes[:'draft']
142
+ else
143
+ self.draft = nil
144
+ end
145
+
146
+ if attributes.key?(:'rejected_source')
147
+ self.rejected_source = attributes[:'rejected_source']
148
+ else
149
+ self.rejected_source = nil
150
+ end
151
+ end
152
+
153
+ # Show invalid properties with the reasons. Usually used together with valid?
154
+ # @return Array for valid properties with the reasons
155
+ def list_invalid_properties
156
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
157
+ invalid_properties = Array.new
158
+ if @platform.nil?
159
+ invalid_properties.push('invalid value for "platform", platform cannot be nil.')
160
+ end
161
+
162
+ if @name.nil?
163
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
164
+ end
165
+
166
+ if @saved.nil?
167
+ invalid_properties.push('invalid value for "saved", saved cannot be nil.')
168
+ end
169
+
170
+ if @problems.nil?
171
+ invalid_properties.push('invalid value for "problems", problems cannot be nil.')
172
+ end
173
+
174
+ invalid_properties
175
+ end
176
+
177
+ # Check to see if the all the properties in the model are valid
178
+ # @return true if the model is valid
179
+ def valid?
180
+ warn '[DEPRECATED] the `valid?` method is obsolete'
181
+ return false if @platform.nil?
182
+ return false if @name.nil?
183
+ return false if @saved.nil?
184
+ return false if @problems.nil?
185
+ true
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] platform Value to be assigned
190
+ def platform=(platform)
191
+ if platform.nil?
192
+ fail ArgumentError, 'platform cannot be nil'
193
+ end
194
+
195
+ @platform = platform
196
+ end
197
+
198
+ # Custom attribute writer method with validation
199
+ # @param [Object] name Value to be assigned
200
+ def name=(name)
201
+ if name.nil?
202
+ fail ArgumentError, 'name cannot be nil'
203
+ end
204
+
205
+ @name = name
206
+ end
207
+
208
+ # Custom attribute writer method with validation
209
+ # @param [Object] saved Value to be assigned
210
+ def saved=(saved)
211
+ if saved.nil?
212
+ fail ArgumentError, 'saved cannot be nil'
213
+ end
214
+
215
+ @saved = saved
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] problems Value to be assigned
220
+ def problems=(problems)
221
+ if problems.nil?
222
+ fail ArgumentError, 'problems cannot be nil'
223
+ end
224
+
225
+ @problems = problems
226
+ end
227
+
228
+ # Checks equality by comparing each attribute.
229
+ # @param [Object] Object to be compared
230
+ def ==(o)
231
+ return true if self.equal?(o)
232
+ self.class == o.class &&
233
+ platform == o.platform &&
234
+ name == o.name &&
235
+ saved == o.saved &&
236
+ problems == o.problems &&
237
+ summary == o.summary &&
238
+ draft == o.draft &&
239
+ rejected_source == o.rejected_source
240
+ end
241
+
242
+ # @see the `==` method
243
+ # @param [Object] Object to be compared
244
+ def eql?(o)
245
+ self == o
246
+ end
247
+
248
+ # Calculates hash code according to all attributes.
249
+ # @return [Integer] Hash code
250
+ def hash
251
+ [platform, name, saved, problems, summary, draft, rejected_source].hash
252
+ end
253
+
254
+ # Builds the object from hash
255
+ # @param [Hash] attributes Model attributes in the form of hash
256
+ # @return [Object] Returns the model itself
257
+ def self.build_from_hash(attributes)
258
+ return nil unless attributes.is_a?(Hash)
259
+ attributes = attributes.transform_keys(&:to_sym)
260
+ # include attributes inherited from allOf parents (the nearest declaration wins)
261
+ map = acceptable_attribute_map
262
+ transformed_hash = {}
263
+ acceptable_openapi_types.each_pair do |key, type|
264
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
265
+ transformed_hash["#{key}"] = nil
266
+ elsif type =~ /\AArray<(.*)>/i
267
+ # check to ensure the input is an array given that the attribute
268
+ # is documented as an array but the input is not
269
+ if attributes[map[key]].is_a?(Array)
270
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
271
+ end
272
+ elsif !attributes[map[key]].nil?
273
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
274
+ end
275
+ end
276
+ new(transformed_hash)
277
+ end
278
+
279
+ # Returns the object in the form of hash
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_hash
282
+ hash = {}
283
+ # include attributes inherited from allOf parents (the nearest declaration wins)
284
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
285
+ value = self.send(attr)
286
+ if value.nil?
287
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
288
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
289
+ end
290
+
291
+ hash[param] = _to_hash(value)
292
+ end
293
+ hash
294
+ end
295
+
296
+ end
297
+
298
+ end
@@ -0,0 +1,357 @@
1
+ =begin
2
+ #Appnigma SDK API
3
+
4
+ #The routes a customer's product calls through an Appnigma SDK. Every answer carries a request id in X-Request-Id; quote it when you write to support.
5
+
6
+ The version of the OpenAPI document: 5.4.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Appnigma::Generated
17
+ class EncryptedFields < ApiModelBase
18
+ # The keyId getConnectKey answered with, unchanged. A keyId that is not the current key's is CONNECT_KEY_CHANGED.
19
+ attr_accessor :key_id
20
+
21
+ # The one-time AES key, encrypted with the public key from getConnectKey (RSA-OAEP, SHA-256 for the hash and MGF1), in standard base64.
22
+ attr_accessor :wrapped_key
23
+
24
+ # The 12-byte AES-GCM IV, random for every call, in standard base64.
25
+ attr_accessor :iv
26
+
27
+ # The fields object's JSON text encrypted with AES-256-GCM, its 16-byte tag after it, in standard base64.
28
+ attr_accessor :ciphertext
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'key_id' => :'keyId',
34
+ :'wrapped_key' => :'wrappedKey',
35
+ :'iv' => :'iv',
36
+ :'ciphertext' => :'ciphertext'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'key_id' => :'String',
54
+ :'wrapped_key' => :'String',
55
+ :'iv' => :'String',
56
+ :'ciphertext' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Returns attribute type mapping
67
+ def self.acceptable_openapi_types
68
+ openapi_types
69
+ end
70
+
71
+ # Returns the nullable attributes
72
+ def self.acceptable_openapi_nullable
73
+ openapi_nullable
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Appnigma::Generated::EncryptedFields` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Appnigma::Generated::EncryptedFields`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'key_id')
93
+ self.key_id = attributes[:'key_id']
94
+ else
95
+ self.key_id = nil
96
+ end
97
+
98
+ if attributes.key?(:'wrapped_key')
99
+ self.wrapped_key = attributes[:'wrapped_key']
100
+ else
101
+ self.wrapped_key = nil
102
+ end
103
+
104
+ if attributes.key?(:'iv')
105
+ self.iv = attributes[:'iv']
106
+ else
107
+ self.iv = nil
108
+ end
109
+
110
+ if attributes.key?(:'ciphertext')
111
+ self.ciphertext = attributes[:'ciphertext']
112
+ else
113
+ self.ciphertext = nil
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @key_id.nil?
123
+ invalid_properties.push('invalid value for "key_id", key_id cannot be nil.')
124
+ end
125
+
126
+ pattern = Regexp.new(/^[0-9a-f]{16}$/)
127
+ if @key_id !~ pattern
128
+ invalid_properties.push("invalid value for \"key_id\", must conform to the pattern #{pattern}.")
129
+ end
130
+
131
+ if @wrapped_key.nil?
132
+ invalid_properties.push('invalid value for "wrapped_key", wrapped_key cannot be nil.')
133
+ end
134
+
135
+ if @wrapped_key.to_s.length > 1024
136
+ invalid_properties.push('invalid value for "wrapped_key", the character length must be smaller than or equal to 1024.')
137
+ end
138
+
139
+ if @wrapped_key.to_s.length < 1
140
+ invalid_properties.push('invalid value for "wrapped_key", the character length must be greater than or equal to 1.')
141
+ end
142
+
143
+ pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
144
+ if @wrapped_key !~ pattern
145
+ invalid_properties.push("invalid value for \"wrapped_key\", must conform to the pattern #{pattern}.")
146
+ end
147
+
148
+ if @iv.nil?
149
+ invalid_properties.push('invalid value for "iv", iv cannot be nil.')
150
+ end
151
+
152
+ if @iv.to_s.length > 16
153
+ invalid_properties.push('invalid value for "iv", the character length must be smaller than or equal to 16.')
154
+ end
155
+
156
+ if @iv.to_s.length < 16
157
+ invalid_properties.push('invalid value for "iv", the character length must be greater than or equal to 16.')
158
+ end
159
+
160
+ pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
161
+ if @iv !~ pattern
162
+ invalid_properties.push("invalid value for \"iv\", must conform to the pattern #{pattern}.")
163
+ end
164
+
165
+ if @ciphertext.nil?
166
+ invalid_properties.push('invalid value for "ciphertext", ciphertext cannot be nil.')
167
+ end
168
+
169
+ if @ciphertext.to_s.length > 328640
170
+ invalid_properties.push('invalid value for "ciphertext", the character length must be smaller than or equal to 328640.')
171
+ end
172
+
173
+ if @ciphertext.to_s.length < 1
174
+ invalid_properties.push('invalid value for "ciphertext", the character length must be greater than or equal to 1.')
175
+ end
176
+
177
+ pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
178
+ if @ciphertext !~ pattern
179
+ invalid_properties.push("invalid value for \"ciphertext\", must conform to the pattern #{pattern}.")
180
+ end
181
+
182
+ invalid_properties
183
+ end
184
+
185
+ # Check to see if the all the properties in the model are valid
186
+ # @return true if the model is valid
187
+ def valid?
188
+ warn '[DEPRECATED] the `valid?` method is obsolete'
189
+ return false if @key_id.nil?
190
+ return false if @key_id !~ Regexp.new(/^[0-9a-f]{16}$/)
191
+ return false if @wrapped_key.nil?
192
+ return false if @wrapped_key.to_s.length > 1024
193
+ return false if @wrapped_key.to_s.length < 1
194
+ return false if @wrapped_key !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
195
+ return false if @iv.nil?
196
+ return false if @iv.to_s.length > 16
197
+ return false if @iv.to_s.length < 16
198
+ return false if @iv !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
199
+ return false if @ciphertext.nil?
200
+ return false if @ciphertext.to_s.length > 328640
201
+ return false if @ciphertext.to_s.length < 1
202
+ return false if @ciphertext !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
203
+ true
204
+ end
205
+
206
+ # Custom attribute writer method with validation
207
+ # @param [Object] key_id Value to be assigned
208
+ def key_id=(key_id)
209
+ if key_id.nil?
210
+ fail ArgumentError, 'key_id cannot be nil'
211
+ end
212
+
213
+ pattern = Regexp.new(/^[0-9a-f]{16}$/)
214
+ if key_id !~ pattern
215
+ fail ArgumentError, "invalid value for \"key_id\", must conform to the pattern #{pattern}."
216
+ end
217
+
218
+ @key_id = key_id
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] wrapped_key Value to be assigned
223
+ def wrapped_key=(wrapped_key)
224
+ if wrapped_key.nil?
225
+ fail ArgumentError, 'wrapped_key cannot be nil'
226
+ end
227
+
228
+ if wrapped_key.to_s.length > 1024
229
+ fail ArgumentError, 'invalid value for "wrapped_key", the character length must be smaller than or equal to 1024.'
230
+ end
231
+
232
+ if wrapped_key.to_s.length < 1
233
+ fail ArgumentError, 'invalid value for "wrapped_key", the character length must be greater than or equal to 1.'
234
+ end
235
+
236
+ pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
237
+ if wrapped_key !~ pattern
238
+ fail ArgumentError, "invalid value for \"wrapped_key\", must conform to the pattern #{pattern}."
239
+ end
240
+
241
+ @wrapped_key = wrapped_key
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] iv Value to be assigned
246
+ def iv=(iv)
247
+ if iv.nil?
248
+ fail ArgumentError, 'iv cannot be nil'
249
+ end
250
+
251
+ if iv.to_s.length > 16
252
+ fail ArgumentError, 'invalid value for "iv", the character length must be smaller than or equal to 16.'
253
+ end
254
+
255
+ if iv.to_s.length < 16
256
+ fail ArgumentError, 'invalid value for "iv", the character length must be greater than or equal to 16.'
257
+ end
258
+
259
+ pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
260
+ if iv !~ pattern
261
+ fail ArgumentError, "invalid value for \"iv\", must conform to the pattern #{pattern}."
262
+ end
263
+
264
+ @iv = iv
265
+ end
266
+
267
+ # Custom attribute writer method with validation
268
+ # @param [Object] ciphertext Value to be assigned
269
+ def ciphertext=(ciphertext)
270
+ if ciphertext.nil?
271
+ fail ArgumentError, 'ciphertext cannot be nil'
272
+ end
273
+
274
+ if ciphertext.to_s.length > 328640
275
+ fail ArgumentError, 'invalid value for "ciphertext", the character length must be smaller than or equal to 328640.'
276
+ end
277
+
278
+ if ciphertext.to_s.length < 1
279
+ fail ArgumentError, 'invalid value for "ciphertext", the character length must be greater than or equal to 1.'
280
+ end
281
+
282
+ pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
283
+ if ciphertext !~ pattern
284
+ fail ArgumentError, "invalid value for \"ciphertext\", must conform to the pattern #{pattern}."
285
+ end
286
+
287
+ @ciphertext = ciphertext
288
+ end
289
+
290
+ # Checks equality by comparing each attribute.
291
+ # @param [Object] Object to be compared
292
+ def ==(o)
293
+ return true if self.equal?(o)
294
+ self.class == o.class &&
295
+ key_id == o.key_id &&
296
+ wrapped_key == o.wrapped_key &&
297
+ iv == o.iv &&
298
+ ciphertext == o.ciphertext
299
+ end
300
+
301
+ # @see the `==` method
302
+ # @param [Object] Object to be compared
303
+ def eql?(o)
304
+ self == o
305
+ end
306
+
307
+ # Calculates hash code according to all attributes.
308
+ # @return [Integer] Hash code
309
+ def hash
310
+ [key_id, wrapped_key, iv, ciphertext].hash
311
+ end
312
+
313
+ # Builds the object from hash
314
+ # @param [Hash] attributes Model attributes in the form of hash
315
+ # @return [Object] Returns the model itself
316
+ def self.build_from_hash(attributes)
317
+ return nil unless attributes.is_a?(Hash)
318
+ attributes = attributes.transform_keys(&:to_sym)
319
+ # include attributes inherited from allOf parents (the nearest declaration wins)
320
+ map = acceptable_attribute_map
321
+ transformed_hash = {}
322
+ acceptable_openapi_types.each_pair do |key, type|
323
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
324
+ transformed_hash["#{key}"] = nil
325
+ elsif type =~ /\AArray<(.*)>/i
326
+ # check to ensure the input is an array given that the attribute
327
+ # is documented as an array but the input is not
328
+ if attributes[map[key]].is_a?(Array)
329
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
330
+ end
331
+ elsif !attributes[map[key]].nil?
332
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
333
+ end
334
+ end
335
+ new(transformed_hash)
336
+ end
337
+
338
+ # Returns the object in the form of hash
339
+ # @return [Hash] Returns the object in the form of hash
340
+ def to_hash
341
+ hash = {}
342
+ # include attributes inherited from allOf parents (the nearest declaration wins)
343
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
344
+ value = self.send(attr)
345
+ if value.nil?
346
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
347
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
348
+ end
349
+
350
+ hash[param] = _to_hash(value)
351
+ end
352
+ hash
353
+ end
354
+
355
+ end
356
+
357
+ end