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,167 @@
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
+ # PaymentCallback Model.
9
+ class PaymentCallback < 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 [PaymentStatus]
19
+ attr_accessor :payment_status
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :transaction_id
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [Float]
27
+ attr_accessor :amount
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [String]
31
+ attr_accessor :currency
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [DateTime]
35
+ attr_accessor :timestamp
36
+
37
+ # Reason for payment failure (if applicable)
38
+ # @return [String]
39
+ attr_accessor :failure_reason
40
+
41
+ # A mapping from model property names to API property names.
42
+ def self.names
43
+ @_hash = {} if @_hash.nil?
44
+ @_hash['order_id'] = 'orderId'
45
+ @_hash['payment_status'] = 'paymentStatus'
46
+ @_hash['transaction_id'] = 'transactionId'
47
+ @_hash['amount'] = 'amount'
48
+ @_hash['currency'] = 'currency'
49
+ @_hash['timestamp'] = 'timestamp'
50
+ @_hash['failure_reason'] = 'failureReason'
51
+ @_hash
52
+ end
53
+
54
+ # An array for optional fields
55
+ def self.optionals
56
+ %w[
57
+ amount
58
+ currency
59
+ timestamp
60
+ failure_reason
61
+ ]
62
+ end
63
+
64
+ # An array for nullable fields
65
+ def self.nullables
66
+ []
67
+ end
68
+
69
+ def initialize(order_id:, payment_status:, transaction_id:, amount: SKIP,
70
+ currency: SKIP, timestamp: SKIP, failure_reason: SKIP,
71
+ additional_properties: nil)
72
+ # Add additional model properties to the instance
73
+ additional_properties = {} if additional_properties.nil?
74
+
75
+ @order_id = order_id
76
+ @payment_status = payment_status
77
+ @transaction_id = transaction_id
78
+ @amount = amount unless amount == SKIP
79
+ @currency = currency unless currency == SKIP
80
+ @timestamp = timestamp unless timestamp == SKIP
81
+ @failure_reason = failure_reason unless failure_reason == SKIP
82
+ @additional_properties = additional_properties
83
+ end
84
+
85
+ # Creates an instance of the object from a hash.
86
+ def self.from_hash(hash)
87
+ return nil unless hash
88
+
89
+ # Extract variables from the hash.
90
+ order_id = hash.key?('orderId') ? hash['orderId'] : nil
91
+ payment_status = hash.key?('paymentStatus') ? hash['paymentStatus'] : nil
92
+ transaction_id = hash.key?('transactionId') ? hash['transactionId'] : nil
93
+ amount = hash.key?('amount') ? hash['amount'] : SKIP
94
+ currency = hash.key?('currency') ? hash['currency'] : SKIP
95
+ timestamp = if hash.key?('timestamp')
96
+ (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
97
+ else
98
+ SKIP
99
+ end
100
+ failure_reason = hash.key?('failureReason') ? hash['failureReason'] : SKIP
101
+
102
+ # Create a new hash for additional properties, removing known properties.
103
+ new_hash = hash.reject { |k, _| names.value?(k) }
104
+
105
+ additional_properties = APIHelper.get_additional_properties(
106
+ new_hash, proc { |value| value }
107
+ )
108
+
109
+ # Create object from extracted values.
110
+ PaymentCallback.new(order_id: order_id,
111
+ payment_status: payment_status,
112
+ transaction_id: transaction_id,
113
+ amount: amount,
114
+ currency: currency,
115
+ timestamp: timestamp,
116
+ failure_reason: failure_reason,
117
+ additional_properties: additional_properties)
118
+ end
119
+
120
+ def to_custom_timestamp
121
+ DateTimeHelper.to_rfc3339(timestamp)
122
+ end
123
+
124
+ # Validates an instance of the object from a given value.
125
+ # @param [PaymentCallback | Hash] The value against the validation is performed.
126
+ def self.validate(value)
127
+ if value.instance_of? self
128
+ return (
129
+ APIHelper.valid_type?(value.order_id,
130
+ ->(val) { val.instance_of? String }) and
131
+ APIHelper.valid_type?(value.payment_status,
132
+ ->(val) { PaymentStatus.validate(val) }) and
133
+ APIHelper.valid_type?(value.transaction_id,
134
+ ->(val) { val.instance_of? String })
135
+ )
136
+ end
137
+
138
+ return false unless value.instance_of? Hash
139
+
140
+ (
141
+ APIHelper.valid_type?(value['orderId'],
142
+ ->(val) { val.instance_of? String }) and
143
+ APIHelper.valid_type?(value['paymentStatus'],
144
+ ->(val) { PaymentStatus.validate(val) }) and
145
+ APIHelper.valid_type?(value['transactionId'],
146
+ ->(val) { val.instance_of? String })
147
+ )
148
+ end
149
+
150
+ # Provides a human-readable string representation of the object.
151
+ def to_s
152
+ class_name = self.class.name.split('::').last
153
+ "<#{class_name} order_id: #{@order_id}, payment_status: #{@payment_status}, transaction_id:"\
154
+ " #{@transaction_id}, amount: #{@amount}, currency: #{@currency}, timestamp: #{@timestamp},"\
155
+ " failure_reason: #{@failure_reason}, additional_properties: #{@additional_properties}>"
156
+ end
157
+
158
+ # Provides a debugging-friendly string with detailed object information.
159
+ def inspect
160
+ class_name = self.class.name.split('::').last
161
+ "<#{class_name} order_id: #{@order_id.inspect}, payment_status: #{@payment_status.inspect},"\
162
+ " transaction_id: #{@transaction_id.inspect}, amount: #{@amount.inspect}, currency:"\
163
+ " #{@currency.inspect}, timestamp: #{@timestamp.inspect}, failure_reason:"\
164
+ " #{@failure_reason.inspect}, additional_properties: #{@additional_properties}>"
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,98 @@
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
+ # PaymentCompletedEvent Model.
8
+ class PaymentCompletedEvent < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [EventType1]
14
+ attr_accessor :event_type
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :payment_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['payment_id'] = 'paymentId'
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(payment_id:, event_type: SKIP, additional_properties: nil)
41
+ # Add additional model properties to the instance
42
+ additional_properties = {} if additional_properties.nil?
43
+
44
+ @event_type = event_type unless event_type == SKIP
45
+ @payment_id = payment_id
46
+ @additional_properties = additional_properties
47
+ end
48
+
49
+ # Creates an instance of the object from a hash.
50
+ def self.from_hash(hash)
51
+ return nil unless hash
52
+
53
+ # Extract variables from the hash.
54
+ payment_id = hash.key?('paymentId') ? hash['paymentId'] : nil
55
+ event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
56
+
57
+ # Create a new hash for additional properties, removing known properties.
58
+ new_hash = hash.reject { |k, _| names.value?(k) }
59
+
60
+ additional_properties = APIHelper.get_additional_properties(
61
+ new_hash, proc { |value| value }
62
+ )
63
+
64
+ # Create object from extracted values.
65
+ PaymentCompletedEvent.new(payment_id: payment_id,
66
+ event_type: event_type,
67
+ additional_properties: additional_properties)
68
+ end
69
+
70
+ # Validates an instance of the object from a given value.
71
+ # @param [PaymentCompletedEvent | Hash] The value against the validation is performed.
72
+ def self.validate(value)
73
+ if value.instance_of? self
74
+ return APIHelper.valid_type?(value.payment_id,
75
+ ->(val) { val.instance_of? Integer })
76
+ end
77
+
78
+ return false unless value.instance_of? Hash
79
+
80
+ APIHelper.valid_type?(value['paymentId'],
81
+ ->(val) { val.instance_of? Integer })
82
+ end
83
+
84
+ # Provides a human-readable string representation of the object.
85
+ def to_s
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} event_type: #{@event_type}, payment_id: #{@payment_id},"\
88
+ " additional_properties: #{@additional_properties}>"
89
+ end
90
+
91
+ # Provides a debugging-friendly string with detailed object information.
92
+ def inspect
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} event_type: #{@event_type.inspect}, payment_id: #{@payment_id.inspect},"\
95
+ " additional_properties: #{@additional_properties}>"
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,40 @@
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
+ # PaymentStatus.
8
+ class PaymentStatus
9
+ PAYMENT_STATUS = [
10
+ # TODO: Write general description for SUCCESS
11
+ SUCCESS = 'success'.freeze,
12
+
13
+ # TODO: Write general description for FAILED
14
+ FAILED = 'failed'.freeze,
15
+
16
+ # TODO: Write general description for PENDING
17
+ PENDING = 'pending'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ PAYMENT_STATUS.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = SUCCESS)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'success' then SUCCESS
33
+ when 'failed' then FAILED
34
+ when 'pending' then PENDING
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,89 @@
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
+ # PaymentStatusCreatedEvent Model.
8
+ class PaymentStatusCreatedEvent < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :payment_status_created_id
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['payment_status_created_id'] = 'paymentStatusCreatedId'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(payment_status_created_id:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @payment_status_created_id = payment_status_created_id
38
+ @additional_properties = additional_properties
39
+ end
40
+
41
+ # Creates an instance of the object from a hash.
42
+ def self.from_hash(hash)
43
+ return nil unless hash
44
+
45
+ # Extract variables from the hash.
46
+ payment_status_created_id =
47
+ hash.key?('paymentStatusCreatedId') ? hash['paymentStatusCreatedId'] : nil
48
+
49
+ # Create a new hash for additional properties, removing known properties.
50
+ new_hash = hash.reject { |k, _| names.value?(k) }
51
+
52
+ additional_properties = APIHelper.get_additional_properties(
53
+ new_hash, proc { |value| value }
54
+ )
55
+
56
+ # Create object from extracted values.
57
+ PaymentStatusCreatedEvent.new(payment_status_created_id: payment_status_created_id,
58
+ additional_properties: additional_properties)
59
+ end
60
+
61
+ # Validates an instance of the object from a given value.
62
+ # @param [PaymentStatusCreatedEvent | Hash] The value against the validation is performed.
63
+ def self.validate(value)
64
+ if value.instance_of? self
65
+ return APIHelper.valid_type?(value.payment_status_created_id,
66
+ ->(val) { val.instance_of? String })
67
+ end
68
+
69
+ return false unless value.instance_of? Hash
70
+
71
+ APIHelper.valid_type?(value['paymentStatusCreatedId'],
72
+ ->(val) { val.instance_of? String })
73
+ end
74
+
75
+ # Provides a human-readable string representation of the object.
76
+ def to_s
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} payment_status_created_id: #{@payment_status_created_id},"\
79
+ " additional_properties: #{@additional_properties}>"
80
+ end
81
+
82
+ # Provides a debugging-friendly string with detailed object information.
83
+ def inspect
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} payment_status_created_id: #{@payment_status_created_id.inspect},"\
86
+ " additional_properties: #{@additional_properties}>"
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,89 @@
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
+ # PaymentStatusUpdatedEvent Model.
8
+ class PaymentStatusUpdatedEvent < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :payment_status_id
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['payment_status_id'] = 'paymentStatusId'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(payment_status_id:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @payment_status_id = payment_status_id
38
+ @additional_properties = additional_properties
39
+ end
40
+
41
+ # Creates an instance of the object from a hash.
42
+ def self.from_hash(hash)
43
+ return nil unless hash
44
+
45
+ # Extract variables from the hash.
46
+ payment_status_id =
47
+ hash.key?('paymentStatusId') ? hash['paymentStatusId'] : nil
48
+
49
+ # Create a new hash for additional properties, removing known properties.
50
+ new_hash = hash.reject { |k, _| names.value?(k) }
51
+
52
+ additional_properties = APIHelper.get_additional_properties(
53
+ new_hash, proc { |value| value }
54
+ )
55
+
56
+ # Create object from extracted values.
57
+ PaymentStatusUpdatedEvent.new(payment_status_id: payment_status_id,
58
+ additional_properties: additional_properties)
59
+ end
60
+
61
+ # Validates an instance of the object from a given value.
62
+ # @param [PaymentStatusUpdatedEvent | Hash] The value against the validation is performed.
63
+ def self.validate(value)
64
+ if value.instance_of? self
65
+ return APIHelper.valid_type?(value.payment_status_id,
66
+ ->(val) { val.instance_of? String })
67
+ end
68
+
69
+ return false unless value.instance_of? Hash
70
+
71
+ APIHelper.valid_type?(value['paymentStatusId'],
72
+ ->(val) { val.instance_of? String })
73
+ end
74
+
75
+ # Provides a human-readable string representation of the object.
76
+ def to_s
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} payment_status_id: #{@payment_status_id}, additional_properties:"\
79
+ " #{@additional_properties}>"
80
+ end
81
+
82
+ # Provides a debugging-friendly string with detailed object information.
83
+ def inspect
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} payment_status_id: #{@payment_status_id.inspect}, additional_properties:"\
86
+ " #{@additional_properties}>"
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,98 @@
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
+ # PrimitiveCollectionEvent Model.
8
+ class PrimitiveCollectionEvent < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [EventType2]
14
+ attr_accessor :event_type
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Array[Integer]]
18
+ attr_accessor :ids
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['ids'] = 'ids'
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(ids:, event_type: SKIP, additional_properties: nil)
41
+ # Add additional model properties to the instance
42
+ additional_properties = {} if additional_properties.nil?
43
+
44
+ @event_type = event_type unless event_type == SKIP
45
+ @ids = ids
46
+ @additional_properties = additional_properties
47
+ end
48
+
49
+ # Creates an instance of the object from a hash.
50
+ def self.from_hash(hash)
51
+ return nil unless hash
52
+
53
+ # Extract variables from the hash.
54
+ ids = hash.key?('ids') ? hash['ids'] : nil
55
+ event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
56
+
57
+ # Create a new hash for additional properties, removing known properties.
58
+ new_hash = hash.reject { |k, _| names.value?(k) }
59
+
60
+ additional_properties = APIHelper.get_additional_properties(
61
+ new_hash, proc { |value| value }
62
+ )
63
+
64
+ # Create object from extracted values.
65
+ PrimitiveCollectionEvent.new(ids: ids,
66
+ event_type: event_type,
67
+ additional_properties: additional_properties)
68
+ end
69
+
70
+ # Validates an instance of the object from a given value.
71
+ # @param [PrimitiveCollectionEvent | Hash] The value against the validation is performed.
72
+ def self.validate(value)
73
+ if value.instance_of? self
74
+ return APIHelper.valid_type?(value.ids,
75
+ ->(val) { val.instance_of? Integer })
76
+ end
77
+
78
+ return false unless value.instance_of? Hash
79
+
80
+ APIHelper.valid_type?(value['ids'],
81
+ ->(val) { val.instance_of? Integer })
82
+ end
83
+
84
+ # Provides a human-readable string representation of the object.
85
+ def to_s
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} event_type: #{@event_type}, ids: #{@ids}, additional_properties:"\
88
+ " #{@additional_properties}>"
89
+ end
90
+
91
+ # Provides a debugging-friendly string with detailed object information.
92
+ def inspect
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} event_type: #{@event_type.inspect}, ids: #{@ids.inspect},"\
95
+ " additional_properties: #{@additional_properties}>"
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,40 @@
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
+ # RootLevelPrimitiveOneOfEvent Request.
8
+ class RootLevelPrimitiveOneOfEventRequest
9
+ ROOT_LEVEL_PRIMITIVE_ONE_OF_EVENT_REQUEST = [
10
+ # TODO: Write general description for ON
11
+ ON = 'on'.freeze,
12
+
13
+ # TODO: Write general description for OFF
14
+ OFF = 'off'.freeze,
15
+
16
+ # TODO: Write general description for PENDING
17
+ PENDING = 'pending'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ ROOT_LEVEL_PRIMITIVE_ONE_OF_EVENT_REQUEST.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = ON)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'on' then ON
33
+ when 'off' then OFF
34
+ when 'pending' then PENDING
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
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
+ # RootLevelPrimitiveOneOfEvent Request1.
8
+ class RootLevelPrimitiveOneOfEventRequest1
9
+ ROOT_LEVEL_PRIMITIVE_ONE_OF_EVENT_REQUEST1 = [
10
+ # TODO: Write general description for ALPHA
11
+ ALPHA = 'alpha'.freeze,
12
+
13
+ # TODO: Write general description for BETA
14
+ BETA = 'beta'.freeze,
15
+
16
+ # TODO: Write general description for GAMMA
17
+ GAMMA = 'gamma'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ ROOT_LEVEL_PRIMITIVE_ONE_OF_EVENT_REQUEST1.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = ALPHA)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'alpha' then ALPHA
33
+ when 'beta' then BETA
34
+ when 'gamma' then GAMMA
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end