plainrouter-sdk 0.1.0 → 0.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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/plainrouter/client.rb +73 -1
  4. data/lib/plainrouter/openapi/api/action_dry_run_api_api.rb +96 -0
  5. data/lib/plainrouter/openapi/api/action_proposal_api_api.rb +96 -0
  6. data/lib/plainrouter/openapi/api/action_read_api_api.rb +404 -0
  7. data/lib/plainrouter/openapi/api/event_api.rb +15 -15
  8. data/lib/plainrouter/openapi/api/operations_api.rb +24 -28
  9. data/lib/plainrouter/openapi/api/sandbox_api.rb +74 -17
  10. data/lib/plainrouter/openapi/api_client.rb +2 -2
  11. data/lib/plainrouter/openapi/api_error.rb +2 -2
  12. data/lib/plainrouter/openapi/api_model_base.rb +2 -2
  13. data/lib/plainrouter/openapi/configuration.rb +10 -3
  14. data/lib/plainrouter/openapi/models/action_batch_read.rb +164 -0
  15. data/lib/plainrouter/openapi/models/action_batch_read_data.rb +450 -0
  16. data/lib/plainrouter/openapi/models/action_current_disposition.rb +294 -0
  17. data/lib/plainrouter/openapi/models/action_decision_receipt_read.rb +244 -0
  18. data/lib/plainrouter/openapi/models/action_decision_receipt_read_chain_entry.rb +190 -0
  19. data/lib/plainrouter/openapi/models/action_detail_read.rb +164 -0
  20. data/lib/plainrouter/openapi/models/action_dry_run_read.rb +164 -0
  21. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run.rb +166 -0
  22. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner.rb +103 -0
  23. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner_any_of.rb +376 -0
  24. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner_any_of1.rb +268 -0
  25. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner_any_of_diff.rb +162 -0
  26. data/lib/plainrouter/openapi/models/action_dry_run_read_dry_run_actions_inner_any_of_target_entity.rb +199 -0
  27. data/lib/plainrouter/openapi/models/action_list_read.rb +192 -0
  28. data/lib/plainrouter/openapi/models/action_list_read_meta.rb +242 -0
  29. data/lib/plainrouter/openapi/models/action_policy_read.rb +164 -0
  30. data/lib/plainrouter/openapi/models/action_policy_read_data.rb +380 -0
  31. data/lib/plainrouter/openapi/models/action_proposal_input.rb +378 -0
  32. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner.rb +115 -0
  33. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of.rb +303 -0
  34. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of1.rb +303 -0
  35. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of10.rb +303 -0
  36. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of10_params.rb +356 -0
  37. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of11.rb +303 -0
  38. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of11_params.rb +173 -0
  39. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of12.rb +303 -0
  40. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of12_params.rb +188 -0
  41. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of13.rb +303 -0
  42. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of13_params.rb +259 -0
  43. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of2.rb +303 -0
  44. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of3.rb +303 -0
  45. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of4.rb +303 -0
  46. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of4_target_entity.rb +253 -0
  47. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of5.rb +303 -0
  48. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of6.rb +303 -0
  49. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of7.rb +303 -0
  50. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of8.rb +303 -0
  51. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of9.rb +303 -0
  52. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of_params.rb +173 -0
  53. data/lib/plainrouter/openapi/models/action_proposal_input_actions_inner_any_of_target_entity.rb +264 -0
  54. data/lib/plainrouter/openapi/models/action_proposal_input_evidence_inner.rb +262 -0
  55. data/lib/plainrouter/openapi/models/action_proposal_read.rb +164 -0
  56. data/lib/plainrouter/openapi/models/action_proposal_read_proposal.rb +452 -0
  57. data/lib/plainrouter/openapi/models/action_proposal_read_proposal_actions_inner.rb +386 -0
  58. data/lib/plainrouter/openapi/models/action_proposal_read_proposal_actions_inner_params.rb +103 -0
  59. data/lib/plainrouter/openapi/models/action_proposal_read_proposal_proposed_by.rb +202 -0
  60. data/lib/plainrouter/openapi/models/action_read_item.rb +516 -0
  61. data/lib/plainrouter/openapi/models/create_event200_response.rb +2 -2
  62. data/lib/plainrouter/openapi/models/create_event202_response.rb +218 -0
  63. data/lib/plainrouter/openapi/models/create_event202_response_warnings_inner.rb +240 -0
  64. data/lib/plainrouter/openapi/models/create_event_request.rb +2 -2
  65. data/lib/plainrouter/openapi/models/create_event_request_any_of.rb +2 -2
  66. data/lib/plainrouter/openapi/models/create_event_request_any_of1.rb +2 -2
  67. data/lib/plainrouter/openapi/models/create_event_request_any_of_event_time.rb +2 -2
  68. data/lib/plainrouter/openapi/models/create_event_request_any_of_value_data.rb +2 -2
  69. data/lib/plainrouter/openapi/models/delete_user_data200_response.rb +2 -2
  70. data/lib/plainrouter/openapi/models/delete_user_data_request.rb +35 -36
  71. data/lib/plainrouter/openapi/models/delivery_status.rb +2 -2
  72. data/lib/plainrouter/openapi/models/destination.rb +30 -3
  73. data/lib/plainrouter/openapi/models/destination_credential_source.rb +3 -4
  74. data/lib/plainrouter/openapi/models/destination_status.rb +2 -2
  75. data/lib/plainrouter/openapi/models/destination_type.rb +2 -2
  76. data/lib/plainrouter/openapi/models/emq_snapshot.rb +30 -3
  77. data/lib/plainrouter/openapi/models/error_message.rb +2 -2
  78. data/lib/plainrouter/openapi/models/event.rb +89 -45
  79. data/lib/plainrouter/openapi/models/get_emq_report200_response.rb +2 -2
  80. data/lib/plainrouter/openapi/models/get_emq_report200_response_snapshots_inner.rb +30 -3
  81. data/lib/plainrouter/openapi/models/get_event200_response.rb +2 -2
  82. data/lib/plainrouter/openapi/models/get_event200_response_deliveries_inner.rb +30 -3
  83. data/lib/plainrouter/openapi/models/get_event200_response_event.rb +31 -4
  84. data/lib/plainrouter/openapi/models/get_event200_response_event_consent.rb +2 -2
  85. data/lib/plainrouter/openapi/models/get_event200_response_event_deliveries_inner.rb +30 -3
  86. data/lib/plainrouter/openapi/models/get_event200_response_event_user_data_hashed.rb +104 -0
  87. data/lib/plainrouter/openapi/models/get_event200_response_lineage.rb +2 -2
  88. data/lib/plainrouter/openapi/models/get_event200_response_lineage_children_inner.rb +31 -4
  89. data/lib/plainrouter/openapi/models/get_event200_response_lineage_parent.rb +31 -4
  90. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response.rb +2 -2
  91. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner.rb +30 -3
  92. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_buckets_value.rb +2 -2
  93. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_event_counts.rb +2 -2
  94. data/lib/plainrouter/openapi/models/get_reconciliation_report200_response_reports_inner_event_counts_accepted.rb +2 -2
  95. data/lib/plainrouter/openapi/models/get_sandbox200_response.rb +2 -2
  96. data/lib/plainrouter/openapi/models/get_sandbox200_response_self_serve_key.rb +32 -6
  97. data/lib/plainrouter/openapi/models/{create_sandbox_key201_response.rb → get_sandbox200_response_self_serve_key_issued_key.rb} +6 -6
  98. data/lib/plainrouter/openapi/models/{create_sandbox_key201_response_use.rb → get_sandbox200_response_self_serve_key_issued_key_use.rb} +5 -5
  99. data/lib/plainrouter/openapi/models/get_sandbox200_response_try.rb +2 -2
  100. data/lib/plainrouter/openapi/models/get_sandbox200_response_try_body.rb +2 -2
  101. data/lib/plainrouter/openapi/models/get_sandbox200_response_try_body_value_data.rb +2 -2
  102. data/lib/plainrouter/openapi/models/ingestion_warning_code.rb +39 -0
  103. data/lib/plainrouter/openapi/models/jurisdiction_policy_class.rb +2 -2
  104. data/lib/plainrouter/openapi/models/list_events200_response.rb +2 -2
  105. data/lib/plainrouter/openapi/models/list_events200_response_events.rb +2 -2
  106. data/lib/plainrouter/openapi/models/list_events200_response_events_links_inner.rb +2 -2
  107. data/lib/plainrouter/openapi/models/list_events200_response_metrics.rb +2 -2
  108. data/lib/plainrouter/openapi/models/list_events_by_cursor200_response.rb +2 -2
  109. data/lib/plainrouter/openapi/models/list_events_by_cursor200_response_events.rb +2 -2
  110. data/lib/plainrouter/openapi/models/reconciliation_report.rb +31 -3
  111. data/lib/plainrouter/openapi/models/replay_deliveries202_response.rb +2 -2
  112. data/lib/plainrouter/openapi/models/replay_deliveries_request.rb +2 -2
  113. data/lib/plainrouter/openapi/models/send_test_purchase200_response.rb +2 -2
  114. data/lib/plainrouter/openapi/models/send_test_purchase422_response.rb +2 -2
  115. data/lib/plainrouter/openapi/models/send_test_purchase_request.rb +2 -2
  116. data/lib/plainrouter/openapi/models/set_destination_test_mode200_response.rb +2 -2
  117. data/lib/plainrouter/openapi/models/set_destination_test_mode200_response_destination.rb +30 -3
  118. data/lib/plainrouter/openapi/models/set_destination_test_mode_request.rb +2 -2
  119. data/lib/plainrouter/openapi/models/traffic_class.rb +2 -2
  120. data/lib/plainrouter/openapi/models/validate_sandbox_event200_response.rb +2 -2
  121. data/lib/plainrouter/openapi/models/validate_sandbox_event_request.rb +2 -2
  122. data/lib/plainrouter/openapi/models/validate_sandbox_event_request_value_data.rb +2 -2
  123. data/lib/plainrouter/openapi/models/validation_error.rb +2 -2
  124. data/lib/plainrouter/openapi/version.rb +3 -3
  125. data/lib/plainrouter/openapi.rb +58 -4
  126. data/lib/plainrouter/version.rb +1 -1
  127. metadata +64 -10
@@ -0,0 +1,303 @@
1
+ =begin
2
+ #Plainrouter Conversion API
3
+
4
+ #Plainrouter public Signals Conversion API.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PlainRouter::OpenAPI
17
+ class ActionProposalInputActionsInnerAnyOf10 < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ attr_accessor :target_entity
21
+
22
+ attr_accessor :params
23
+
24
+ attr_accessor :rationale
25
+
26
+ attr_accessor :idempotency_key
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'type' => :'type',
54
+ :'target_entity' => :'target_entity',
55
+ :'params' => :'params',
56
+ :'rationale' => :'rationale',
57
+ :'idempotency_key' => :'idempotency_key'
58
+ }
59
+ end
60
+
61
+ # Returns attribute mapping this model knows about
62
+ def self.acceptable_attribute_map
63
+ attribute_map
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ acceptable_attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'type' => :'String',
75
+ :'target_entity' => :'ActionProposalInputActionsInnerAnyOf4TargetEntity',
76
+ :'params' => :'ActionProposalInputActionsInnerAnyOf10Params',
77
+ :'rationale' => :'String',
78
+ :'idempotency_key' => :'String'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::ActionProposalInputActionsInnerAnyOf10` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ acceptable_attribute_map = self.class.acceptable_attribute_map
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!acceptable_attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::ActionProposalInputActionsInnerAnyOf10`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'type')
105
+ self.type = attributes[:'type']
106
+ else
107
+ self.type = nil
108
+ end
109
+
110
+ if attributes.key?(:'target_entity')
111
+ self.target_entity = attributes[:'target_entity']
112
+ else
113
+ self.target_entity = nil
114
+ end
115
+
116
+ if attributes.key?(:'params')
117
+ self.params = attributes[:'params']
118
+ else
119
+ self.params = nil
120
+ end
121
+
122
+ if attributes.key?(:'rationale')
123
+ self.rationale = attributes[:'rationale']
124
+ else
125
+ self.rationale = nil
126
+ end
127
+
128
+ if attributes.key?(:'idempotency_key')
129
+ self.idempotency_key = attributes[:'idempotency_key']
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
137
+ invalid_properties = Array.new
138
+ if @type.nil?
139
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
140
+ end
141
+
142
+ if @target_entity.nil?
143
+ invalid_properties.push('invalid value for "target_entity", target_entity cannot be nil.')
144
+ end
145
+
146
+ if @params.nil?
147
+ invalid_properties.push('invalid value for "params", params cannot be nil.')
148
+ end
149
+
150
+ if @rationale.nil?
151
+ invalid_properties.push('invalid value for "rationale", rationale cannot be nil.')
152
+ end
153
+
154
+ if @rationale.to_s.length > 2000
155
+ invalid_properties.push('invalid value for "rationale", the character length must be smaller than or equal to 2000.')
156
+ end
157
+
158
+ if !@idempotency_key.nil? && @idempotency_key.to_s.length > 255
159
+ invalid_properties.push('invalid value for "idempotency_key", the character length must be smaller than or equal to 255.')
160
+ end
161
+
162
+ invalid_properties
163
+ end
164
+
165
+ # Check to see if the all the properties in the model are valid
166
+ # @return true if the model is valid
167
+ def valid?
168
+ warn '[DEPRECATED] the `valid?` method is obsolete'
169
+ return false if @type.nil?
170
+ type_validator = EnumAttributeValidator.new('String', ["upload_asset"])
171
+ return false unless type_validator.valid?(@type)
172
+ return false if @target_entity.nil?
173
+ return false if @params.nil?
174
+ return false if @rationale.nil?
175
+ return false if @rationale.to_s.length > 2000
176
+ return false if !@idempotency_key.nil? && @idempotency_key.to_s.length > 255
177
+ true
178
+ end
179
+
180
+ # Custom attribute writer method checking allowed values (enum).
181
+ # @param [Object] type Object to be assigned
182
+ def type=(type)
183
+ validator = EnumAttributeValidator.new('String', ["upload_asset"])
184
+ unless validator.valid?(type)
185
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
186
+ end
187
+ @type = type
188
+ end
189
+
190
+ # Custom attribute writer method with validation
191
+ # @param [Object] target_entity Value to be assigned
192
+ def target_entity=(target_entity)
193
+ if target_entity.nil?
194
+ fail ArgumentError, 'target_entity cannot be nil'
195
+ end
196
+
197
+ @target_entity = target_entity
198
+ end
199
+
200
+ # Custom attribute writer method with validation
201
+ # @param [Object] params Value to be assigned
202
+ def params=(params)
203
+ if params.nil?
204
+ fail ArgumentError, 'params cannot be nil'
205
+ end
206
+
207
+ @params = params
208
+ end
209
+
210
+ # Custom attribute writer method with validation
211
+ # @param [Object] rationale Value to be assigned
212
+ def rationale=(rationale)
213
+ if rationale.nil?
214
+ fail ArgumentError, 'rationale cannot be nil'
215
+ end
216
+
217
+ if rationale.to_s.length > 2000
218
+ fail ArgumentError, 'invalid value for "rationale", the character length must be smaller than or equal to 2000.'
219
+ end
220
+
221
+ @rationale = rationale
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] idempotency_key Value to be assigned
226
+ def idempotency_key=(idempotency_key)
227
+ if idempotency_key.nil?
228
+ fail ArgumentError, 'idempotency_key cannot be nil'
229
+ end
230
+
231
+ if idempotency_key.to_s.length > 255
232
+ fail ArgumentError, 'invalid value for "idempotency_key", the character length must be smaller than or equal to 255.'
233
+ end
234
+
235
+ @idempotency_key = idempotency_key
236
+ end
237
+
238
+ # Checks equality by comparing each attribute.
239
+ # @param [Object] Object to be compared
240
+ def ==(o)
241
+ return true if self.equal?(o)
242
+ self.class == o.class &&
243
+ type == o.type &&
244
+ target_entity == o.target_entity &&
245
+ params == o.params &&
246
+ rationale == o.rationale &&
247
+ idempotency_key == o.idempotency_key
248
+ end
249
+
250
+ # @see the `==` method
251
+ # @param [Object] Object to be compared
252
+ def eql?(o)
253
+ self == o
254
+ end
255
+
256
+ # Calculates hash code according to all attributes.
257
+ # @return [Integer] Hash code
258
+ def hash
259
+ [type, target_entity, params, rationale, idempotency_key].hash
260
+ end
261
+
262
+ # Builds the object from hash
263
+ # @param [Hash] attributes Model attributes in the form of hash
264
+ # @return [Object] Returns the model itself
265
+ def self.build_from_hash(attributes)
266
+ return nil unless attributes.is_a?(Hash)
267
+ attributes = attributes.transform_keys(&:to_sym)
268
+ transformed_hash = {}
269
+ openapi_types.each_pair do |key, type|
270
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
271
+ transformed_hash["#{key}"] = nil
272
+ elsif type =~ /\AArray<(.*)>/i
273
+ # check to ensure the input is an array given that the attribute
274
+ # is documented as an array but the input is not
275
+ if attributes[attribute_map[key]].is_a?(Array)
276
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
277
+ end
278
+ elsif !attributes[attribute_map[key]].nil?
279
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
280
+ end
281
+ end
282
+ new(transformed_hash)
283
+ end
284
+
285
+ # Returns the object in the form of hash
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_hash
288
+ hash = {}
289
+ self.class.attribute_map.each_pair do |attr, param|
290
+ value = self.send(attr)
291
+ if value.nil?
292
+ is_nullable = self.class.openapi_nullable.include?(attr)
293
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
294
+ end
295
+
296
+ hash[param] = _to_hash(value)
297
+ end
298
+ hash
299
+ end
300
+
301
+ end
302
+
303
+ end
@@ -0,0 +1,356 @@
1
+ =begin
2
+ #Plainrouter Conversion API
3
+
4
+ #Plainrouter public Signals Conversion API.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PlainRouter::OpenAPI
17
+ class ActionProposalInputActionsInnerAnyOf10Params < ApiModelBase
18
+ attr_accessor :staged_asset_id
19
+
20
+ attr_accessor :asset_type
21
+
22
+ attr_accessor :filename
23
+
24
+ attr_accessor :content_sha256
25
+
26
+ attr_accessor :mime_type
27
+
28
+ attr_accessor :size_bytes
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'staged_asset_id' => :'staged_asset_id',
56
+ :'asset_type' => :'asset_type',
57
+ :'filename' => :'filename',
58
+ :'content_sha256' => :'content_sha256',
59
+ :'mime_type' => :'mime_type',
60
+ :'size_bytes' => :'size_bytes'
61
+ }
62
+ end
63
+
64
+ # Returns attribute mapping this model knows about
65
+ def self.acceptable_attribute_map
66
+ attribute_map
67
+ end
68
+
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ acceptable_attribute_map.values
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'staged_asset_id' => :'String',
78
+ :'asset_type' => :'String',
79
+ :'filename' => :'String',
80
+ :'content_sha256' => :'String',
81
+ :'mime_type' => :'String',
82
+ :'size_bytes' => :'Integer'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ :'mime_type',
90
+ :'size_bytes'
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::ActionProposalInputActionsInnerAnyOf10Params` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::ActionProposalInputActionsInnerAnyOf10Params`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'staged_asset_id')
111
+ self.staged_asset_id = attributes[:'staged_asset_id']
112
+ else
113
+ self.staged_asset_id = nil
114
+ end
115
+
116
+ if attributes.key?(:'asset_type')
117
+ self.asset_type = attributes[:'asset_type']
118
+ else
119
+ self.asset_type = nil
120
+ end
121
+
122
+ if attributes.key?(:'filename')
123
+ self.filename = attributes[:'filename']
124
+ else
125
+ self.filename = nil
126
+ end
127
+
128
+ if attributes.key?(:'content_sha256')
129
+ self.content_sha256 = attributes[:'content_sha256']
130
+ else
131
+ self.content_sha256 = nil
132
+ end
133
+
134
+ if attributes.key?(:'mime_type')
135
+ self.mime_type = attributes[:'mime_type']
136
+ end
137
+
138
+ if attributes.key?(:'size_bytes')
139
+ self.size_bytes = attributes[:'size_bytes']
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
147
+ invalid_properties = Array.new
148
+ if @staged_asset_id.nil?
149
+ invalid_properties.push('invalid value for "staged_asset_id", staged_asset_id cannot be nil.')
150
+ end
151
+
152
+ if @staged_asset_id.to_s.length > 255
153
+ invalid_properties.push('invalid value for "staged_asset_id", the character length must be smaller than or equal to 255.')
154
+ end
155
+
156
+ pattern = Regexp.new(/^stage_[a-f0-9]{40}$/)
157
+ if @staged_asset_id !~ pattern
158
+ invalid_properties.push("invalid value for \"staged_asset_id\", must conform to the pattern #{pattern}.")
159
+ end
160
+
161
+ if @asset_type.nil?
162
+ invalid_properties.push('invalid value for "asset_type", asset_type cannot be nil.')
163
+ end
164
+
165
+ if @filename.nil?
166
+ invalid_properties.push('invalid value for "filename", filename cannot be nil.')
167
+ end
168
+
169
+ if @filename.to_s.length > 255
170
+ invalid_properties.push('invalid value for "filename", the character length must be smaller than or equal to 255.')
171
+ end
172
+
173
+ if @content_sha256.nil?
174
+ invalid_properties.push('invalid value for "content_sha256", content_sha256 cannot be nil.')
175
+ end
176
+
177
+ pattern = Regexp.new(/^[a-f0-9]{64}$/)
178
+ if @content_sha256 !~ pattern
179
+ invalid_properties.push("invalid value for \"content_sha256\", must conform to the pattern #{pattern}.")
180
+ end
181
+
182
+ if !@mime_type.nil? && @mime_type.to_s.length > 255
183
+ invalid_properties.push('invalid value for "mime_type", the character length must be smaller than or equal to 255.')
184
+ end
185
+
186
+ if !@size_bytes.nil? && @size_bytes < 1
187
+ invalid_properties.push('invalid value for "size_bytes", must be greater than or equal to 1.')
188
+ end
189
+
190
+ invalid_properties
191
+ end
192
+
193
+ # Check to see if the all the properties in the model are valid
194
+ # @return true if the model is valid
195
+ def valid?
196
+ warn '[DEPRECATED] the `valid?` method is obsolete'
197
+ return false if @staged_asset_id.nil?
198
+ return false if @staged_asset_id.to_s.length > 255
199
+ return false if @staged_asset_id !~ Regexp.new(/^stage_[a-f0-9]{40}$/)
200
+ return false if @asset_type.nil?
201
+ asset_type_validator = EnumAttributeValidator.new('String', ["image"])
202
+ return false unless asset_type_validator.valid?(@asset_type)
203
+ return false if @filename.nil?
204
+ return false if @filename.to_s.length > 255
205
+ return false if @content_sha256.nil?
206
+ return false if @content_sha256 !~ Regexp.new(/^[a-f0-9]{64}$/)
207
+ return false if !@mime_type.nil? && @mime_type.to_s.length > 255
208
+ return false if !@size_bytes.nil? && @size_bytes < 1
209
+ true
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] staged_asset_id Value to be assigned
214
+ def staged_asset_id=(staged_asset_id)
215
+ if staged_asset_id.nil?
216
+ fail ArgumentError, 'staged_asset_id cannot be nil'
217
+ end
218
+
219
+ if staged_asset_id.to_s.length > 255
220
+ fail ArgumentError, 'invalid value for "staged_asset_id", the character length must be smaller than or equal to 255.'
221
+ end
222
+
223
+ pattern = Regexp.new(/^stage_[a-f0-9]{40}$/)
224
+ if staged_asset_id !~ pattern
225
+ fail ArgumentError, "invalid value for \"staged_asset_id\", must conform to the pattern #{pattern}."
226
+ end
227
+
228
+ @staged_asset_id = staged_asset_id
229
+ end
230
+
231
+ # Custom attribute writer method checking allowed values (enum).
232
+ # @param [Object] asset_type Object to be assigned
233
+ def asset_type=(asset_type)
234
+ validator = EnumAttributeValidator.new('String', ["image"])
235
+ unless validator.valid?(asset_type)
236
+ fail ArgumentError, "invalid value for \"asset_type\", must be one of #{validator.allowable_values}."
237
+ end
238
+ @asset_type = asset_type
239
+ end
240
+
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] filename Value to be assigned
243
+ def filename=(filename)
244
+ if filename.nil?
245
+ fail ArgumentError, 'filename cannot be nil'
246
+ end
247
+
248
+ if filename.to_s.length > 255
249
+ fail ArgumentError, 'invalid value for "filename", the character length must be smaller than or equal to 255.'
250
+ end
251
+
252
+ @filename = filename
253
+ end
254
+
255
+ # Custom attribute writer method with validation
256
+ # @param [Object] content_sha256 Value to be assigned
257
+ def content_sha256=(content_sha256)
258
+ if content_sha256.nil?
259
+ fail ArgumentError, 'content_sha256 cannot be nil'
260
+ end
261
+
262
+ pattern = Regexp.new(/^[a-f0-9]{64}$/)
263
+ if content_sha256 !~ pattern
264
+ fail ArgumentError, "invalid value for \"content_sha256\", must conform to the pattern #{pattern}."
265
+ end
266
+
267
+ @content_sha256 = content_sha256
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] mime_type Value to be assigned
272
+ def mime_type=(mime_type)
273
+ if !mime_type.nil? && mime_type.to_s.length > 255
274
+ fail ArgumentError, 'invalid value for "mime_type", the character length must be smaller than or equal to 255.'
275
+ end
276
+
277
+ @mime_type = mime_type
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] size_bytes Value to be assigned
282
+ def size_bytes=(size_bytes)
283
+ if !size_bytes.nil? && size_bytes < 1
284
+ fail ArgumentError, 'invalid value for "size_bytes", must be greater than or equal to 1.'
285
+ end
286
+
287
+ @size_bytes = size_bytes
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
+ staged_asset_id == o.staged_asset_id &&
296
+ asset_type == o.asset_type &&
297
+ filename == o.filename &&
298
+ content_sha256 == o.content_sha256 &&
299
+ mime_type == o.mime_type &&
300
+ size_bytes == o.size_bytes
301
+ end
302
+
303
+ # @see the `==` method
304
+ # @param [Object] Object to be compared
305
+ def eql?(o)
306
+ self == o
307
+ end
308
+
309
+ # Calculates hash code according to all attributes.
310
+ # @return [Integer] Hash code
311
+ def hash
312
+ [staged_asset_id, asset_type, filename, content_sha256, mime_type, size_bytes].hash
313
+ end
314
+
315
+ # Builds the object from hash
316
+ # @param [Hash] attributes Model attributes in the form of hash
317
+ # @return [Object] Returns the model itself
318
+ def self.build_from_hash(attributes)
319
+ return nil unless attributes.is_a?(Hash)
320
+ attributes = attributes.transform_keys(&:to_sym)
321
+ transformed_hash = {}
322
+ openapi_types.each_pair do |key, type|
323
+ if attributes.key?(attribute_map[key]) && attributes[attribute_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[attribute_map[key]].is_a?(Array)
329
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
330
+ end
331
+ elsif !attributes[attribute_map[key]].nil?
332
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_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
+ self.class.attribute_map.each_pair do |attr, param|
343
+ value = self.send(attr)
344
+ if value.nil?
345
+ is_nullable = self.class.openapi_nullable.include?(attr)
346
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
347
+ end
348
+
349
+ hash[param] = _to_hash(value)
350
+ end
351
+ hash
352
+ end
353
+
354
+ end
355
+
356
+ end