wesley-key-sdk 3.0.6 → 4.0.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +156 -132
  3. data/bin/console +4 -4
  4. data/lib/webhooks_and_callbacks_api/api_helper.rb +10 -0
  5. data/lib/{cypress_test_api/controllers/base_controller.rb → webhooks_and_callbacks_api/apis/base_api.rb} +17 -10
  6. data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +34 -0
  7. data/lib/webhooks_and_callbacks_api/client.rb +76 -0
  8. data/lib/{cypress_test_api → webhooks_and_callbacks_api}/configuration.rb +61 -46
  9. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +66 -0
  10. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +78 -0
  11. data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +33 -0
  12. data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +14 -0
  13. data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +32 -0
  14. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +67 -0
  15. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +86 -0
  16. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +79 -0
  17. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +67 -0
  18. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +39 -0
  19. data/lib/{cypress_test_api → webhooks_and_callbacks_api}/exceptions/api_exception.rb +4 -4
  20. data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +57 -0
  21. data/lib/webhooks_and_callbacks_api/http/api_response.rb +19 -0
  22. data/lib/webhooks_and_callbacks_api/http/auth/api_key.rb +52 -0
  23. data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +53 -0
  24. data/lib/webhooks_and_callbacks_api/http/http_call_back.rb +10 -0
  25. data/lib/webhooks_and_callbacks_api/http/http_method_enum.rb +10 -0
  26. data/lib/webhooks_and_callbacks_api/http/http_request.rb +10 -0
  27. data/lib/webhooks_and_callbacks_api/http/http_response.rb +10 -0
  28. data/lib/{cypress_test_api → webhooks_and_callbacks_api}/http/proxy_settings.rb +4 -4
  29. data/lib/webhooks_and_callbacks_api/logging/configuration/api_logging_configuration.rb +186 -0
  30. data/lib/webhooks_and_callbacks_api/logging/sdk_logger.rb +17 -0
  31. data/lib/webhooks_and_callbacks_api/models/address.rb +114 -0
  32. data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +115 -0
  33. data/lib/{cypress_test_api → webhooks_and_callbacks_api}/models/base_model.rb +4 -4
  34. data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +131 -0
  35. data/lib/webhooks_and_callbacks_api/models/delivery_details.rb +104 -0
  36. data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +97 -0
  37. data/lib/webhooks_and_callbacks_api/models/event.rb +52 -0
  38. data/lib/webhooks_and_callbacks_api/models/event_type.rb +26 -0
  39. data/lib/webhooks_and_callbacks_api/models/event_type1.rb +26 -0
  40. data/lib/webhooks_and_callbacks_api/models/event_type2.rb +26 -0
  41. data/lib/webhooks_and_callbacks_api/models/event_type3.rb +26 -0
  42. data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +411 -0
  43. data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +40 -0
  44. data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +40 -0
  45. data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +90 -0
  46. data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +90 -0
  47. data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +90 -0
  48. data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +119 -0
  49. data/lib/{cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb → webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb} +19 -19
  50. data/lib/webhooks_and_callbacks_api/models/order.rb +161 -0
  51. data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +314 -0
  52. data/lib/webhooks_and_callbacks_api/models/order_item.rb +102 -0
  53. data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +100 -0
  54. data/lib/webhooks_and_callbacks_api/models/package.rb +95 -0
  55. data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +167 -0
  56. data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +98 -0
  57. data/lib/webhooks_and_callbacks_api/models/payment_status.rb +40 -0
  58. data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +89 -0
  59. data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +89 -0
  60. data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +98 -0
  61. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +40 -0
  62. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +40 -0
  63. data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +95 -0
  64. data/lib/webhooks_and_callbacks_api/models/status.rb +44 -0
  65. data/lib/webhooks_and_callbacks_api/models/status1.rb +36 -0
  66. data/lib/webhooks_and_callbacks_api/models/status2.rb +36 -0
  67. data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +90 -0
  68. data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +90 -0
  69. data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +90 -0
  70. data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +90 -0
  71. data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +90 -0
  72. data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +90 -0
  73. data/lib/webhooks_and_callbacks_api/models/webhook.rb +142 -0
  74. data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +103 -0
  75. data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +105 -0
  76. data/lib/webhooks_and_callbacks_api/utilities/date_time_helper.rb +11 -0
  77. data/lib/{cypress_test_api → webhooks_and_callbacks_api}/utilities/file_wrapper.rb +4 -4
  78. data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +172 -0
  79. data/lib/webhooks_and_callbacks_api.rb +122 -0
  80. metadata +78 -64
  81. data/lib/cypress_test_api/api_helper.rb +0 -10
  82. data/lib/cypress_test_api/client.rb +0 -58
  83. data/lib/cypress_test_api/controllers/api_controller.rb +0 -102
  84. data/lib/cypress_test_api/http/http_call_back.rb +0 -10
  85. data/lib/cypress_test_api/http/http_method_enum.rb +0 -10
  86. data/lib/cypress_test_api/http/http_request.rb +0 -10
  87. data/lib/cypress_test_api/http/http_response.rb +0 -10
  88. data/lib/cypress_test_api/models/custom_enum.rb +0 -40
  89. data/lib/cypress_test_api/models/deer.rb +0 -68
  90. data/lib/cypress_test_api/models/item.rb +0 -166
  91. data/lib/cypress_test_api/models/item_response.rb +0 -80
  92. data/lib/cypress_test_api/models/lion.rb +0 -68
  93. data/lib/cypress_test_api/models/message.rb +0 -68
  94. data/lib/cypress_test_api/models/message2.rb +0 -71
  95. data/lib/cypress_test_api/models/multiple_arrays_request.rb +0 -70
  96. data/lib/cypress_test_api/models/nac_tag.rb +0 -265
  97. data/lib/cypress_test_api/models/response_http400.rb +0 -62
  98. data/lib/cypress_test_api/models/response_http404.rb +0 -62
  99. data/lib/cypress_test_api/models/status11_enum.rb +0 -40
  100. data/lib/cypress_test_api/models/status1_enum.rb +0 -40
  101. data/lib/cypress_test_api/models/status_enum.rb +0 -40
  102. data/lib/cypress_test_api/models/tokens_request.rb +0 -60
  103. data/lib/cypress_test_api/utilities/date_time_helper.rb +0 -11
  104. data/lib/cypress_test_api.rb +0 -55
  105. data/test/controllers/controller_test_base.rb +0 -23
  106. data/test/controllers/test_api_controller.rb +0 -40
  107. data/test/http_response_catcher.rb +0 -19
@@ -0,0 +1,314 @@
1
+ # webhooks_and_callbacks_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module WebhooksAndCallbacksApi
8
+ # OrderCreatedEvent Model.
9
+ class OrderCreatedEvent < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :order_id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [FulfillmentStatus]
19
+ attr_accessor :fulfillment_status
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :tracking_number
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :carrier
28
+
29
+ # List of scopes that apply to the OAuth token
30
+ # @return [Array[OauthScopeOauthACG]]
31
+ attr_accessor :scopes
32
+
33
+ # List of scopes that apply to the OAuth token
34
+ # @return [Date]
35
+ attr_accessor :estimated_delivery
36
+
37
+ # List of scopes that apply to the OAuth token
38
+ # @return [DateTime]
39
+ attr_accessor :timestamp
40
+
41
+ # Binary file upload
42
+ # @return [Binary]
43
+ attr_accessor :document
44
+
45
+ # Binary file upload
46
+ # @return [Float]
47
+ attr_accessor :total_weight
48
+
49
+ # Binary file upload
50
+ # @return [Float]
51
+ attr_accessor :price
52
+
53
+ # Binary file upload
54
+ # @return [Integer]
55
+ attr_accessor :quantity
56
+
57
+ # Binary file upload
58
+ # @return [Integer]
59
+ attr_accessor :long_id
60
+
61
+ # Binary file upload
62
+ # @return [TrueClass | FalseClass]
63
+ attr_accessor :fragile
64
+
65
+ # Explicitly nullable field
66
+ # @return [String]
67
+ attr_accessor :notes
68
+
69
+ # Explicitly nullable field
70
+ # @return [Array[String]]
71
+ attr_accessor :items
72
+
73
+ # Explicitly nullable field
74
+ # @return [Array[Package]]
75
+ attr_accessor :packages
76
+
77
+ # Explicitly nullable field
78
+ # @return [Address]
79
+ attr_accessor :address
80
+
81
+ # Explicitly nullable field
82
+ # @return [Object]
83
+ attr_accessor :metadata
84
+
85
+ # Explicitly nullable field
86
+ # @return [Hash[String, String]]
87
+ attr_accessor :attributes
88
+
89
+ # Explicitly nullable field
90
+ # @return [Object]
91
+ attr_accessor :delivery_details
92
+
93
+ # A mapping from model property names to API property names.
94
+ def self.names
95
+ @_hash = {} if @_hash.nil?
96
+ @_hash['order_id'] = 'orderId'
97
+ @_hash['fulfillment_status'] = 'fulfillmentStatus'
98
+ @_hash['tracking_number'] = 'trackingNumber'
99
+ @_hash['carrier'] = 'carrier'
100
+ @_hash['scopes'] = 'scopes'
101
+ @_hash['estimated_delivery'] = 'estimatedDelivery'
102
+ @_hash['timestamp'] = 'timestamp'
103
+ @_hash['document'] = 'document'
104
+ @_hash['total_weight'] = 'totalWeight'
105
+ @_hash['price'] = 'price'
106
+ @_hash['quantity'] = 'quantity'
107
+ @_hash['long_id'] = 'longId'
108
+ @_hash['fragile'] = 'fragile'
109
+ @_hash['notes'] = 'notes'
110
+ @_hash['items'] = 'items'
111
+ @_hash['packages'] = 'packages'
112
+ @_hash['address'] = 'address'
113
+ @_hash['metadata'] = 'metadata'
114
+ @_hash['attributes'] = 'attributes'
115
+ @_hash['delivery_details'] = 'deliveryDetails'
116
+ @_hash
117
+ end
118
+
119
+ # An array for optional fields
120
+ def self.optionals
121
+ %w[
122
+ tracking_number
123
+ carrier
124
+ scopes
125
+ estimated_delivery
126
+ timestamp
127
+ document
128
+ total_weight
129
+ price
130
+ quantity
131
+ long_id
132
+ fragile
133
+ notes
134
+ items
135
+ packages
136
+ address
137
+ metadata
138
+ attributes
139
+ delivery_details
140
+ ]
141
+ end
142
+
143
+ # An array for nullable fields
144
+ def self.nullables
145
+ %w[
146
+ order_id
147
+ tracking_number
148
+ scopes
149
+ notes
150
+ ]
151
+ end
152
+
153
+ def initialize(order_id:, fulfillment_status:, tracking_number: SKIP,
154
+ carrier: SKIP, scopes: SKIP, estimated_delivery: SKIP,
155
+ timestamp: SKIP, document: SKIP, total_weight: SKIP,
156
+ price: SKIP, quantity: SKIP, long_id: SKIP, fragile: SKIP,
157
+ notes: SKIP, items: SKIP, packages: SKIP, address: SKIP,
158
+ metadata: SKIP, attributes: SKIP, delivery_details: SKIP,
159
+ additional_properties: nil)
160
+ # Add additional model properties to the instance
161
+ additional_properties = {} if additional_properties.nil?
162
+
163
+ @order_id = order_id
164
+ @fulfillment_status = fulfillment_status
165
+ @tracking_number = tracking_number unless tracking_number == SKIP
166
+ @carrier = carrier unless carrier == SKIP
167
+ @scopes = scopes unless scopes == SKIP
168
+ @estimated_delivery = estimated_delivery unless estimated_delivery == SKIP
169
+ @timestamp = timestamp unless timestamp == SKIP
170
+ @document = document unless document == SKIP
171
+ @total_weight = total_weight unless total_weight == SKIP
172
+ @price = price unless price == SKIP
173
+ @quantity = quantity unless quantity == SKIP
174
+ @long_id = long_id unless long_id == SKIP
175
+ @fragile = fragile unless fragile == SKIP
176
+ @notes = notes unless notes == SKIP
177
+ @items = items unless items == SKIP
178
+ @packages = packages unless packages == SKIP
179
+ @address = address unless address == SKIP
180
+ @metadata = metadata unless metadata == SKIP
181
+ @attributes = attributes unless attributes == SKIP
182
+ @delivery_details = delivery_details unless delivery_details == SKIP
183
+ @additional_properties = additional_properties
184
+ end
185
+
186
+ # Creates an instance of the object from a hash.
187
+ def self.from_hash(hash)
188
+ return nil unless hash
189
+
190
+ # Extract variables from the hash.
191
+ order_id = hash.key?('orderId') ? hash['orderId'] : nil
192
+ fulfillment_status =
193
+ hash.key?('fulfillmentStatus') ? hash['fulfillmentStatus'] : nil
194
+ tracking_number =
195
+ hash.key?('trackingNumber') ? hash['trackingNumber'] : SKIP
196
+ carrier = hash.key?('carrier') ? hash['carrier'] : SKIP
197
+ scopes = hash.key?('scopes') ? hash['scopes'] : SKIP
198
+ estimated_delivery =
199
+ hash.key?('estimatedDelivery') ? hash['estimatedDelivery'] : SKIP
200
+ timestamp = if hash.key?('timestamp')
201
+ (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
202
+ else
203
+ SKIP
204
+ end
205
+ document = hash.key?('document') ? hash['document'] : SKIP
206
+ total_weight = hash.key?('totalWeight') ? hash['totalWeight'] : SKIP
207
+ price = hash.key?('price') ? hash['price'] : SKIP
208
+ quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
209
+ long_id = hash.key?('longId') ? hash['longId'] : SKIP
210
+ fragile = hash.key?('fragile') ? hash['fragile'] : SKIP
211
+ notes = hash.key?('notes') ? hash['notes'] : SKIP
212
+ items = hash.key?('items') ? hash['items'] : SKIP
213
+ # Parameter is an array, so we need to iterate through it
214
+ packages = nil
215
+ unless hash['packages'].nil?
216
+ packages = []
217
+ hash['packages'].each do |structure|
218
+ packages << (Package.from_hash(structure) if structure)
219
+ end
220
+ end
221
+
222
+ packages = SKIP unless hash.key?('packages')
223
+ address = Address.from_hash(hash['address']) if hash['address']
224
+ metadata = hash.key?('metadata') ? hash['metadata'] : SKIP
225
+ attributes = hash.key?('attributes') ? hash['attributes'] : SKIP
226
+ delivery_details = hash.key?('deliveryDetails') ? APIHelper.deserialize_union_type(
227
+ UnionTypeLookUp.get(:OrderCreatedEventDeliveryDetails), hash['deliveryDetails']
228
+ ) : SKIP
229
+
230
+ # Create a new hash for additional properties, removing known properties.
231
+ new_hash = hash.reject { |k, _| names.value?(k) }
232
+
233
+ additional_properties = APIHelper.get_additional_properties(
234
+ new_hash, proc { |value| value }
235
+ )
236
+
237
+ # Create object from extracted values.
238
+ OrderCreatedEvent.new(order_id: order_id,
239
+ fulfillment_status: fulfillment_status,
240
+ tracking_number: tracking_number,
241
+ carrier: carrier,
242
+ scopes: scopes,
243
+ estimated_delivery: estimated_delivery,
244
+ timestamp: timestamp,
245
+ document: document,
246
+ total_weight: total_weight,
247
+ price: price,
248
+ quantity: quantity,
249
+ long_id: long_id,
250
+ fragile: fragile,
251
+ notes: notes,
252
+ items: items,
253
+ packages: packages,
254
+ address: address,
255
+ metadata: metadata,
256
+ attributes: attributes,
257
+ delivery_details: delivery_details,
258
+ additional_properties: additional_properties)
259
+ end
260
+
261
+ def to_custom_timestamp
262
+ DateTimeHelper.to_rfc3339(timestamp)
263
+ end
264
+
265
+ # Validates an instance of the object from a given value.
266
+ # @param [OrderCreatedEvent | Hash] The value against the validation is performed.
267
+ def self.validate(value)
268
+ if value.instance_of? self
269
+ return (
270
+ APIHelper.valid_type?(value.order_id,
271
+ ->(val) { val.instance_of? String }) and
272
+ APIHelper.valid_type?(value.fulfillment_status,
273
+ ->(val) { FulfillmentStatus.validate(val) })
274
+ )
275
+ end
276
+
277
+ return false unless value.instance_of? Hash
278
+
279
+ (
280
+ APIHelper.valid_type?(value['orderId'],
281
+ ->(val) { val.instance_of? String }) and
282
+ APIHelper.valid_type?(value['fulfillmentStatus'],
283
+ ->(val) { FulfillmentStatus.validate(val) })
284
+ )
285
+ end
286
+
287
+ # Provides a human-readable string representation of the object.
288
+ def to_s
289
+ class_name = self.class.name.split('::').last
290
+ "<#{class_name} order_id: #{@order_id}, fulfillment_status: #{@fulfillment_status},"\
291
+ " tracking_number: #{@tracking_number}, carrier: #{@carrier}, scopes: #{@scopes},"\
292
+ " estimated_delivery: #{@estimated_delivery}, timestamp: #{@timestamp}, document:"\
293
+ " #{@document}, total_weight: #{@total_weight}, price: #{@price}, quantity: #{@quantity},"\
294
+ " long_id: #{@long_id}, fragile: #{@fragile}, notes: #{@notes}, items: #{@items}, packages:"\
295
+ " #{@packages}, address: #{@address}, metadata: #{@metadata}, attributes: #{@attributes},"\
296
+ " delivery_details: #{@delivery_details}, additional_properties: #{@additional_properties}>"
297
+ end
298
+
299
+ # Provides a debugging-friendly string with detailed object information.
300
+ def inspect
301
+ class_name = self.class.name.split('::').last
302
+ "<#{class_name} order_id: #{@order_id.inspect}, fulfillment_status:"\
303
+ " #{@fulfillment_status.inspect}, tracking_number: #{@tracking_number.inspect}, carrier:"\
304
+ " #{@carrier.inspect}, scopes: #{@scopes.inspect}, estimated_delivery:"\
305
+ " #{@estimated_delivery.inspect}, timestamp: #{@timestamp.inspect}, document:"\
306
+ " #{@document.inspect}, total_weight: #{@total_weight.inspect}, price: #{@price.inspect},"\
307
+ " quantity: #{@quantity.inspect}, long_id: #{@long_id.inspect}, fragile:"\
308
+ " #{@fragile.inspect}, notes: #{@notes.inspect}, items: #{@items.inspect}, packages:"\
309
+ " #{@packages.inspect}, address: #{@address.inspect}, metadata: #{@metadata.inspect},"\
310
+ " attributes: #{@attributes.inspect}, delivery_details: #{@delivery_details.inspect},"\
311
+ " additional_properties: #{@additional_properties}>"
312
+ end
313
+ end
314
+ end
@@ -0,0 +1,102 @@
1
+ # webhooks_and_callbacks_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module WebhooksAndCallbacksApi
7
+ # OrderItem Model.
8
+ class OrderItem < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :product_id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :quantity
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Float]
22
+ attr_accessor :price
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :description
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['product_id'] = 'productId'
32
+ @_hash['quantity'] = 'quantity'
33
+ @_hash['price'] = 'price'
34
+ @_hash['description'] = 'description'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ description
42
+ ]
43
+ end
44
+
45
+ # An array for nullable fields
46
+ def self.nullables
47
+ []
48
+ end
49
+
50
+ def initialize(product_id:, quantity:, price:, description: SKIP,
51
+ additional_properties: nil)
52
+ # Add additional model properties to the instance
53
+ additional_properties = {} if additional_properties.nil?
54
+
55
+ @product_id = product_id
56
+ @quantity = quantity
57
+ @price = price
58
+ @description = description unless description == SKIP
59
+ @additional_properties = additional_properties
60
+ end
61
+
62
+ # Creates an instance of the object from a hash.
63
+ def self.from_hash(hash)
64
+ return nil unless hash
65
+
66
+ # Extract variables from the hash.
67
+ product_id = hash.key?('productId') ? hash['productId'] : nil
68
+ quantity = hash.key?('quantity') ? hash['quantity'] : nil
69
+ price = hash.key?('price') ? hash['price'] : nil
70
+ description = hash.key?('description') ? hash['description'] : SKIP
71
+
72
+ # Create a new hash for additional properties, removing known properties.
73
+ new_hash = hash.reject { |k, _| names.value?(k) }
74
+
75
+ additional_properties = APIHelper.get_additional_properties(
76
+ new_hash, proc { |value| value }
77
+ )
78
+
79
+ # Create object from extracted values.
80
+ OrderItem.new(product_id: product_id,
81
+ quantity: quantity,
82
+ price: price,
83
+ description: description,
84
+ additional_properties: additional_properties)
85
+ end
86
+
87
+ # Provides a human-readable string representation of the object.
88
+ def to_s
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} product_id: #{@product_id}, quantity: #{@quantity}, price: #{@price},"\
91
+ " description: #{@description}, additional_properties: #{@additional_properties}>"
92
+ end
93
+
94
+ # Provides a debugging-friendly string with detailed object information.
95
+ def inspect
96
+ class_name = self.class.name.split('::').last
97
+ "<#{class_name} product_id: #{@product_id.inspect}, quantity: #{@quantity.inspect}, price:"\
98
+ " #{@price.inspect}, description: #{@description.inspect}, additional_properties:"\
99
+ " #{@additional_properties}>"
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,100 @@
1
+ # webhooks_and_callbacks_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module WebhooksAndCallbacksApi
7
+ # OrderUpdatedEvent Model.
8
+ class OrderUpdatedEvent < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [EventType]
14
+ attr_accessor :event_type
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :order_updated_id
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['event_type'] = 'eventType'
24
+ @_hash['order_updated_id'] = 'orderUpdatedId'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ event_type
32
+ ]
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(order_updated_id:, event_type: SKIP,
41
+ additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @event_type = event_type unless event_type == SKIP
46
+ @order_updated_id = order_updated_id
47
+ @additional_properties = additional_properties
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ order_updated_id =
56
+ hash.key?('orderUpdatedId') ? hash['orderUpdatedId'] : nil
57
+ event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
58
+
59
+ # Create a new hash for additional properties, removing known properties.
60
+ new_hash = hash.reject { |k, _| names.value?(k) }
61
+
62
+ additional_properties = APIHelper.get_additional_properties(
63
+ new_hash, proc { |value| value }
64
+ )
65
+
66
+ # Create object from extracted values.
67
+ OrderUpdatedEvent.new(order_updated_id: order_updated_id,
68
+ event_type: event_type,
69
+ additional_properties: additional_properties)
70
+ end
71
+
72
+ # Validates an instance of the object from a given value.
73
+ # @param [OrderUpdatedEvent | Hash] The value against the validation is performed.
74
+ def self.validate(value)
75
+ if value.instance_of? self
76
+ return APIHelper.valid_type?(value.order_updated_id,
77
+ ->(val) { val.instance_of? Integer })
78
+ end
79
+
80
+ return false unless value.instance_of? Hash
81
+
82
+ APIHelper.valid_type?(value['orderUpdatedId'],
83
+ ->(val) { val.instance_of? Integer })
84
+ end
85
+
86
+ # Provides a human-readable string representation of the object.
87
+ def to_s
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} event_type: #{@event_type}, order_updated_id: #{@order_updated_id},"\
90
+ " additional_properties: #{@additional_properties}>"
91
+ end
92
+
93
+ # Provides a debugging-friendly string with detailed object information.
94
+ def inspect
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} event_type: #{@event_type.inspect}, order_updated_id:"\
97
+ " #{@order_updated_id.inspect}, additional_properties: #{@additional_properties}>"
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,95 @@
1
+ # webhooks_and_callbacks_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module WebhooksAndCallbacksApi
7
+ # Package Model.
8
+ class Package < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :package_id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Float]
18
+ attr_accessor :weight
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['package_id'] = 'packageId'
24
+ @_hash['weight'] = 'weight'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ package_id
32
+ weight
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(package_id: SKIP, weight: SKIP, additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @package_id = package_id unless package_id == SKIP
46
+ @weight = weight unless weight == SKIP
47
+ @additional_properties = additional_properties
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ package_id = hash.key?('packageId') ? hash['packageId'] : SKIP
56
+ weight = hash.key?('weight') ? hash['weight'] : SKIP
57
+
58
+ # Create a new hash for additional properties, removing known properties.
59
+ new_hash = hash.reject { |k, _| names.value?(k) }
60
+
61
+ additional_properties = APIHelper.get_additional_properties(
62
+ new_hash, proc { |value| value }
63
+ )
64
+
65
+ # Create object from extracted values.
66
+ Package.new(package_id: package_id,
67
+ weight: weight,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ # Validates an instance of the object from a given value.
72
+ # @param [Package | Hash] The value against the validation is performed.
73
+ def self.validate(value)
74
+ return true if value.instance_of? self
75
+
76
+ return false unless value.instance_of? Hash
77
+
78
+ true
79
+ end
80
+
81
+ # Provides a human-readable string representation of the object.
82
+ def to_s
83
+ class_name = self.class.name.split('::').last
84
+ "<#{class_name} package_id: #{@package_id}, weight: #{@weight}, additional_properties:"\
85
+ " #{@additional_properties}>"
86
+ end
87
+
88
+ # Provides a debugging-friendly string with detailed object information.
89
+ def inspect
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} package_id: #{@package_id.inspect}, weight: #{@weight.inspect},"\
92
+ " additional_properties: #{@additional_properties}>"
93
+ end
94
+ end
95
+ end