wesley-key-sdk 4.0.0 → 4.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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +47 -34
  3. data/bin/console +4 -4
  4. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/api_helper.rb +2 -2
  5. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/apis/base_api.rb +3 -3
  6. data/lib/swagger_petstore_open_api30/apis/pet_api.rb +287 -0
  7. data/lib/swagger_petstore_open_api30/apis/store_api.rb +131 -0
  8. data/lib/swagger_petstore_open_api30/apis/user_api.rb +233 -0
  9. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/client.rb +34 -15
  10. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/configuration.rb +30 -20
  11. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/exceptions/api_exception.rb +2 -2
  12. data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +64 -0
  13. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/api_response.rb +2 -2
  14. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/auth/api_key.rb +15 -15
  15. data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +112 -0
  16. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_call_back.rb +2 -2
  17. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_method_enum.rb +2 -2
  18. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_request.rb +2 -2
  19. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_response.rb +2 -2
  20. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/proxy_settings.rb +2 -2
  21. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/logging/configuration/api_logging_configuration.rb +2 -2
  22. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/logging/sdk_logger.rb +2 -2
  23. data/lib/swagger_petstore_open_api30/models/api_response.rb +118 -0
  24. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/models/base_model.rb +2 -2
  25. data/lib/{webhooks_and_callbacks_api/models/package.rb → swagger_petstore_open_api30/models/category.rb} +39 -29
  26. data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +62 -0
  27. data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +36 -0
  28. data/lib/swagger_petstore_open_api30/models/oauth_token.rb +125 -0
  29. data/lib/swagger_petstore_open_api30/models/order.rb +167 -0
  30. data/lib/swagger_petstore_open_api30/models/order_status.rb +40 -0
  31. data/lib/swagger_petstore_open_api30/models/pet.rb +168 -0
  32. data/lib/swagger_petstore_open_api30/models/pet_status.rb +40 -0
  33. data/lib/{webhooks_and_callbacks_api/models/delivery_details.rb → swagger_petstore_open_api30/models/tag.rb} +36 -35
  34. data/lib/swagger_petstore_open_api30/models/user.rb +182 -0
  35. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/utilities/date_time_helper.rb +2 -2
  36. data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/utilities/file_wrapper.rb +2 -2
  37. data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +12 -0
  38. data/lib/swagger_petstore_open_api30.rb +62 -0
  39. metadata +37 -78
  40. data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +0 -34
  41. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +0 -66
  42. data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +0 -78
  43. data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +0 -33
  44. data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +0 -14
  45. data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +0 -32
  46. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +0 -67
  47. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +0 -86
  48. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +0 -79
  49. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +0 -67
  50. data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +0 -39
  51. data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +0 -57
  52. data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +0 -53
  53. data/lib/webhooks_and_callbacks_api/models/address.rb +0 -114
  54. data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +0 -115
  55. data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +0 -131
  56. data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +0 -97
  57. data/lib/webhooks_and_callbacks_api/models/event.rb +0 -52
  58. data/lib/webhooks_and_callbacks_api/models/event_type.rb +0 -26
  59. data/lib/webhooks_and_callbacks_api/models/event_type1.rb +0 -26
  60. data/lib/webhooks_and_callbacks_api/models/event_type2.rb +0 -26
  61. data/lib/webhooks_and_callbacks_api/models/event_type3.rb +0 -26
  62. data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +0 -411
  63. data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +0 -40
  64. data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +0 -40
  65. data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +0 -90
  66. data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +0 -90
  67. data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +0 -90
  68. data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +0 -119
  69. data/lib/webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb +0 -44
  70. data/lib/webhooks_and_callbacks_api/models/order.rb +0 -161
  71. data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +0 -314
  72. data/lib/webhooks_and_callbacks_api/models/order_item.rb +0 -102
  73. data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +0 -100
  74. data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +0 -167
  75. data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +0 -98
  76. data/lib/webhooks_and_callbacks_api/models/payment_status.rb +0 -40
  77. data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +0 -89
  78. data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +0 -89
  79. data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +0 -98
  80. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +0 -40
  81. data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +0 -40
  82. data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +0 -95
  83. data/lib/webhooks_and_callbacks_api/models/status.rb +0 -44
  84. data/lib/webhooks_and_callbacks_api/models/status1.rb +0 -36
  85. data/lib/webhooks_and_callbacks_api/models/status2.rb +0 -36
  86. data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +0 -90
  87. data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +0 -90
  88. data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +0 -90
  89. data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +0 -90
  90. data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +0 -90
  91. data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +0 -90
  92. data/lib/webhooks_and_callbacks_api/models/webhook.rb +0 -142
  93. data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +0 -103
  94. data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +0 -105
  95. data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +0 -172
  96. data/lib/webhooks_and_callbacks_api.rb +0 -122
@@ -1,32 +0,0 @@
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
- # Represents an unrecognized or unsupported event during processing.
8
- class UnknownEvent
9
- # @return [Array<String>]
10
- attr_reader :errors
11
-
12
- # Initialize with the errors that caused the failure.
13
- # @param errors [Array<String>] A list of error messages describing the reasons for verification failure.
14
- def initialize(errors)
15
- @errors = errors
16
- end
17
-
18
- # Provides a user-friendly string representation of the failure.
19
- # @return [String]
20
- def to_s
21
- class_name = self.class.name.split('::').last
22
- "<#{class_name} errors: #{@errors}>"
23
- end
24
-
25
- # Provides a debugging-friendly string with detailed object information.
26
- # @return [String]
27
- def inspect
28
- class_name = self.class.name.split('::').last
29
- "<#{class_name} errors: #{@errors.inspect}>"
30
- end
31
- end
32
- end
@@ -1,67 +0,0 @@
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
- # WebhooksAHandler is responsible for verifying request signatures
8
- # and parsing incoming webhooksA events into strongly typed objects.
9
- class WebhooksAHandler
10
- include CoreLibrary
11
- # Creates a new instance of the WebhooksAHandler.
12
- # Initializes the handler.
13
- # @param [String] secret_key
14
- # The secret used to generate and validate HMAC signatures for verifying request authenticity.
15
- # @raise [ArgumentError] If the secret_key is not provided.
16
- def initialize(secret_key)
17
- raise ArgumentError, 'secret_key must be provided for signature verification.' unless secret_key
18
-
19
- @verifier = HmacSignatureVerifier.new(
20
- secret_key: secret_key,
21
- signature_header: 'X-Signature',
22
- hash_algorithm: 'sha256',
23
- encoder: HexEncoder.new,
24
- signature_value_template: 'sha256={digest}'
25
- )
26
- end
27
-
28
- # Perform signature verification and return the result.
29
- #
30
- # @param [Rack::Request] request The incoming HTTP request to verify.
31
- # @return [SignatureVerificationResult] The result of the signature verification.
32
- def verify(request)
33
- @verifier.verify(request)
34
- end
35
-
36
- # Verify the request signature and parse the event.
37
- #
38
- # @param [Rack::Request] request The incoming HTTP request containing the event payload.
39
- # @return[PaymentStatusUpdatedEvent, PaymentStatusCreatedEvent,
40
- # SignatureVerificationFailure, UnknownEvent]
41
- # PaymentStatusUpdatedEvent, PaymentStatusCreatedEvent for successful
42
- # parsing;
43
- # SignatureVerificationFailure when signature fails;
44
- #
45
- # UnknownEvent for unknown events.
46
- def verify_and_parse_event(request)
47
- unless request.respond_to?(:env) && request.env.is_a?(Hash)
48
- return SignatureVerificationFailure.new(['Invalid request env.'])
49
- end
50
-
51
- raw_body = RackRequestHelper.read_raw_body(request)
52
- return SignatureVerificationFailure.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
53
-
54
- verification_result = verify(request)
55
- return SignatureVerificationFailure.new(verification_result.errors) unless verification_result.ok
56
-
57
- # Deserialize payload
58
- begin
59
- union = UnionTypeLookUp.get(:WebhooksA)
60
- raw = RackRequestHelper.read_raw_body(request)
61
- APIHelper.deserialize_union_type(union, raw, false, true)
62
- rescue StandardError => e
63
- UnknownEvent.new(['Deserialization failed.', e.message])
64
- end
65
- end
66
- end
67
- end
@@ -1,86 +0,0 @@
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
- # WebhooksBHandler is responsible for verifying request signatures
8
- # and parsing incoming webhooksB events into strongly typed objects.
9
- class WebhooksBHandler
10
- include CoreLibrary
11
- # Creates a new instance of the WebhooksBHandler.
12
- # Initializes the handler.
13
- # @param [String] secret_key
14
- # The secret used to generate and validate HMAC signatures for verifying request authenticity.
15
- # @raise [ArgumentError] If the secret_key is not provided.
16
- def initialize(secret_key)
17
- raise ArgumentError, 'secret_key must be provided for signature verification.' unless secret_key
18
-
19
- @verifier = HmacSignatureVerifier.new(
20
- secret_key: secret_key,
21
- signature_header: 'X-Webhook-Signature',
22
- hash_algorithm: 'sha512',
23
- encoder: Base64Encoder.new,
24
- signature_value_template: 'v1={digest}',
25
- canonical_message_builder: method(:_canonical_message_builder)
26
- )
27
- end
28
-
29
- # Perform signature verification and return the result.
30
- #
31
- # @param [Rack::Request] request The incoming HTTP request to verify.
32
- # @return [SignatureVerificationResult] The result of the signature verification.
33
- def verify(request)
34
- @verifier.verify(request)
35
- end
36
-
37
- # Verify the request signature and parse the event.
38
- #
39
- # @param [Rack::Request] request The incoming HTTP request containing the event payload.
40
- # @return[UserActionNotificationEvent, UserStatusNotificationEvent,
41
- # UserPreferenceNotificationEvent, SystemAlertNotificationEvent,
42
- # SystemMaintenanceNotificationEvent, SystemPerformanceNotificationEvent,
43
- # InventoryStockIncreaseEvent, InventoryStockDecreaseEvent,
44
- # InventoryStockDepletedEvent, SignatureVerificationFailure, UnknownEvent]
45
- # UserActionNotificationEvent, UserStatusNotificationEvent,
46
- # UserPreferenceNotificationEvent, SystemAlertNotificationEvent,
47
- # SystemMaintenanceNotificationEvent, SystemPerformanceNotificationEvent,
48
- # InventoryStockIncreaseEvent, InventoryStockDecreaseEvent,
49
- # InventoryStockDepletedEvent for successful parsing;
50
- #
51
- # SignatureVerificationFailure when signature fails;
52
- # UnknownEvent for
53
- # unknown events.
54
- def verify_and_parse_event(request)
55
- unless request.respond_to?(:env) && request.env.is_a?(Hash)
56
- return SignatureVerificationFailure.new(['Invalid request env.'])
57
- end
58
-
59
- raw_body = RackRequestHelper.read_raw_body(request)
60
- return SignatureVerificationFailure.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
61
-
62
- verification_result = verify(request)
63
- return SignatureVerificationFailure.new(verification_result.errors) unless verification_result.ok
64
-
65
- # Deserialize payload
66
- begin
67
- union = UnionTypeLookUp.get(:WebhooksB)
68
- raw = RackRequestHelper.read_raw_body(request)
69
- APIHelper.deserialize_union_type(union, raw, false, true)
70
- rescue StandardError => e
71
- UnknownEvent.new(['Deserialization failed.', e.message])
72
- end
73
- end
74
-
75
- # Builds the canonical message from the request for the signature verification.
76
- #
77
- # @param [Rack::Request] request The incoming HTTP request.
78
- # @return [String, nil] The canonical message as a string, or nil if it could not be constructed.
79
- def _canonical_message_builder(request)
80
- payload = RackRequestHelper.read_raw_body(request)
81
- method = request.request_method
82
- x_timestamp = request.get_header(RackRequestHelper.prepend_header('X-Timestamp'))
83
- "#{method}|#{x_timestamp}|#{payload}"
84
- end
85
- end
86
- end
@@ -1,79 +0,0 @@
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
- # WebhooksCHandler is responsible for verifying request signatures
8
- # and parsing incoming webhooksC events into strongly typed objects.
9
- class WebhooksCHandler
10
- include CoreLibrary
11
- # Creates a new instance of the WebhooksCHandler.
12
- # Initializes the handler.
13
- # @param [String] secret_key
14
- # The secret used to generate and validate HMAC signatures for verifying request authenticity.
15
- # @raise [ArgumentError] If the secret_key is not provided.
16
- def initialize(secret_key)
17
- raise ArgumentError, 'secret_key must be provided for signature verification.' unless secret_key
18
-
19
- @verifier = HmacSignatureVerifier.new(
20
- secret_key: secret_key,
21
- signature_header: 'X-Webhook-Signature',
22
- hash_algorithm: 'sha512',
23
- encoder: Base64UrlEncoder.new,
24
- signature_value_template: 'v1={digest}',
25
- canonical_message_builder: method(:_canonical_message_builder)
26
- )
27
- end
28
-
29
- # Perform signature verification and return the result.
30
- #
31
- # @param [Rack::Request] request The incoming HTTP request to verify.
32
- # @return [SignatureVerificationResult] The result of the signature verification.
33
- def verify(request)
34
- @verifier.verify(request)
35
- end
36
-
37
- # Verify the request signature and parse the event.
38
- #
39
- # @param [Rack::Request] request The incoming HTTP request containing the event payload.
40
- # @return[String, Integer, Array<Float>, Hash[String, String],
41
- # SignatureVerificationFailure, UnknownEvent]
42
- # String, Integer, Array[Float], Hash[String, String] for successful
43
- # parsing;
44
- # SignatureVerificationFailure when signature fails;
45
- #
46
- # UnknownEvent for unknown events.
47
- def verify_and_parse_event(request)
48
- unless request.respond_to?(:env) && request.env.is_a?(Hash)
49
- return SignatureVerificationFailure.new(['Invalid request env.'])
50
- end
51
-
52
- raw_body = RackRequestHelper.read_raw_body(request)
53
- return SignatureVerificationFailure.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
54
-
55
- verification_result = verify(request)
56
- return SignatureVerificationFailure.new(verification_result.errors) unless verification_result.ok
57
-
58
- # Deserialize payload
59
- begin
60
- union = UnionTypeLookUp.get(:WebhooksC)
61
- raw = RackRequestHelper.read_raw_body(request)
62
- APIHelper.deserialize_union_type(union, raw, false, true)
63
- rescue StandardError => e
64
- UnknownEvent.new(['Deserialization failed.', e.message])
65
- end
66
- end
67
-
68
- # Builds the canonical message from the request for the signature verification.
69
- #
70
- # @param [Rack::Request] request The incoming HTTP request.
71
- # @return [String, nil] The canonical message as a string, or nil if it could not be constructed.
72
- def _canonical_message_builder(request)
73
- payload = RackRequestHelper.read_raw_body(request)
74
- method = request.request_method
75
- x_timestamp = request.get_header(RackRequestHelper.prepend_header('X-Timestamp'))
76
- "#{method}|#{x_timestamp}|#{payload}"
77
- end
78
- end
79
- end
@@ -1,67 +0,0 @@
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
- # WebhooksHandler is responsible for verifying request signatures
8
- # and parsing incoming webhooks events into strongly typed objects.
9
- class WebhooksHandler
10
- include CoreLibrary
11
- # Creates a new instance of the WebhooksHandler.
12
- # Initializes the handler.
13
- # @param [String] secret_key
14
- # The secret used to generate and validate HMAC signatures for verifying request authenticity.
15
- # @raise [ArgumentError] If the secret_key is not provided.
16
- def initialize(secret_key)
17
- raise ArgumentError, 'secret_key must be provided for signature verification.' unless secret_key
18
-
19
- @verifier = HmacSignatureVerifier.new(
20
- secret_key: secret_key,
21
- signature_header: 'X-Signature',
22
- hash_algorithm: 'sha256',
23
- encoder: HexEncoder.new
24
- )
25
- end
26
-
27
- # Perform signature verification and return the result.
28
- #
29
- # @param [Rack::Request] request The incoming HTTP request to verify.
30
- # @return [SignatureVerificationResult] The result of the signature verification.
31
- def verify(request)
32
- @verifier.verify(request)
33
- end
34
-
35
- # Verify the request signature and parse the event.
36
- #
37
- # @param [Rack::Request] request The incoming HTTP request containing the event payload.
38
- # @return[OrderCreatedEvent, OrderUpdatedEvent, PaymentCompletedEvent,
39
- # PrimitiveCollectionEvent, SignatureVerificationFailure, UnknownEvent]
40
- # OrderCreatedEvent, OrderUpdatedEvent, PaymentCompletedEvent,
41
- # PrimitiveCollectionEvent for successful parsing;
42
- #
43
- # SignatureVerificationFailure when signature fails;
44
- # UnknownEvent for
45
- # unknown events.
46
- def verify_and_parse_event(request)
47
- unless request.respond_to?(:env) && request.env.is_a?(Hash)
48
- return SignatureVerificationFailure.new(['Invalid request env.'])
49
- end
50
-
51
- raw_body = RackRequestHelper.read_raw_body(request)
52
- return SignatureVerificationFailure.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
53
-
54
- verification_result = verify(request)
55
- return SignatureVerificationFailure.new(verification_result.errors) unless verification_result.ok
56
-
57
- # Deserialize payload
58
- begin
59
- union = UnionTypeLookUp.get(:Webhooks)
60
- raw = RackRequestHelper.read_raw_body(request)
61
- APIHelper.deserialize_union_type(union, raw, false, true)
62
- rescue StandardError => e
63
- UnknownEvent.new(['Deserialization failed.', e.message])
64
- end
65
- end
66
- end
67
- end
@@ -1,39 +0,0 @@
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
- # WebhooksNoVerificationHandler is responsible for verifying request signatures
8
- # and parsing incoming webhooksNoVerification events into strongly typed objects.
9
- class WebhooksNoVerificationHandler
10
- include CoreLibrary
11
- # Creates a new instance of the WebhooksNoVerificationHandler.
12
- def initialize; end
13
-
14
- # Parse the event.
15
- #
16
- # @param [Rack::Request] request The incoming HTTP request containing the event payload.
17
- # @return[AuditLogEvent, RootLevelPrimitiveOneOfEventRequest, Integer,
18
- # Array<RootLevelPrimitiveOneOfEventRequest1>, Array<Integer>, UnknownEvent]
19
- # AuditLogEvent, RootLevelPrimitiveOneOfEventRequest, Integer,
20
- # Array[RootLevelPrimitiveOneOfEventRequest1], Array[Integer] for successful
21
- # parsing;
22
- # UnknownEvent for unknown events.
23
- def parse_event(request)
24
- return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash)
25
-
26
- raw_body = RackRequestHelper.read_raw_body(request)
27
- return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
28
-
29
- # Deserialize payload
30
- begin
31
- union = UnionTypeLookUp.get(:WebhooksNoVerification)
32
- raw = RackRequestHelper.read_raw_body(request)
33
- APIHelper.deserialize_union_type(union, raw, false, true)
34
- rescue StandardError => e
35
- UnknownEvent.new(['Deserialization failed.', e.message])
36
- end
37
- end
38
- end
39
- end
@@ -1,57 +0,0 @@
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
- # Error class.
8
- class ErrorException < APIException
9
- SKIP = Object.new
10
- private_constant :SKIP
11
-
12
- # Error code
13
- # @return [String]
14
- attr_accessor :error
15
-
16
- # Human-readable error message
17
- # @return [String]
18
- attr_accessor :message
19
-
20
- # Additional error details
21
- # @return [Object]
22
- attr_accessor :details
23
-
24
- # The constructor.
25
- # @param [String] reason The reason for raising an exception.
26
- # @param [HttpResponse] response The HttpReponse of the API call.
27
- def initialize(reason, response)
28
- super(reason, response)
29
- hash = APIHelper.json_deserialize(@response.raw_body)
30
- unbox(hash)
31
- end
32
-
33
- # Populates this object by extracting properties from a hash.
34
- # @param [Hash] hash The deserialized response sent by the server in the
35
- # response body.
36
- def unbox(hash)
37
- return nil unless hash
38
-
39
- @error = hash.key?('error') ? hash['error'] : nil
40
- @message = hash.key?('message') ? hash['message'] : nil
41
- @details = hash.key?('details') ? hash['details'] : SKIP
42
- end
43
-
44
- # Provides a human-readable string representation of the object.
45
- def to_s
46
- class_name = self.class.name.split('::').last
47
- "<#{class_name} error: #{@error}, message: #{@message}, details: #{@details}>"
48
- end
49
-
50
- # Provides a debugging-friendly string with detailed object information.
51
- def inspect
52
- class_name = self.class.name.split('::').last
53
- "<#{class_name} error: #{@error.inspect}, message: #{@message.inspect}, details:"\
54
- " #{@details.inspect}>"
55
- end
56
- end
57
- end
@@ -1,53 +0,0 @@
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
- # Utility class for OAuth 2 authorization and token management.
8
- class BearerAuth < CoreLibrary::HeaderAuth
9
- include CoreLibrary
10
- # Display error message on occurrence of authentication failure.
11
- # @returns [String] The oAuth error message.
12
- def error_message
13
- 'BearerAuth: access_token is undefined.'
14
- end
15
-
16
- # Initialization constructor.
17
- def initialize(bearer_auth_credentials)
18
- auth_params = {}
19
- @_access_token = bearer_auth_credentials.access_token unless
20
- bearer_auth_credentials.nil? || bearer_auth_credentials.access_token.nil?
21
- auth_params[:Authorization] = "Bearer #{@_access_token}" unless @_access_token.nil?
22
-
23
- super auth_params
24
- end
25
- end
26
-
27
- # Data class for BearerAuthCredentials.
28
- class BearerAuthCredentials
29
- attr_reader :access_token
30
-
31
- def initialize(access_token:)
32
- raise ArgumentError, 'access_token cannot be nil' if access_token.nil?
33
-
34
- @access_token = access_token
35
- end
36
-
37
- def self.from_env
38
- access_token = ENV['BEARER_AUTH_ACCESS_TOKEN']
39
- all_nil = [
40
- access_token
41
- ].all?(&:nil?)
42
- return nil if all_nil
43
-
44
- new(access_token: access_token)
45
- end
46
-
47
- def clone_with(access_token: nil)
48
- access_token ||= self.access_token
49
-
50
- BearerAuthCredentials.new(access_token: access_token)
51
- end
52
- end
53
- end
@@ -1,114 +0,0 @@
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
- # Address Model.
8
- class Address < BaseModel
9
- SKIP = Object.new
10
- private_constant :SKIP
11
-
12
- # TODO: Write general description for this method
13
- # @return [String]
14
- attr_accessor :street
15
-
16
- # TODO: Write general description for this method
17
- # @return [String]
18
- attr_accessor :city
19
-
20
- # TODO: Write general description for this method
21
- # @return [String]
22
- attr_accessor :zip
23
-
24
- # A mapping from model property names to API property names.
25
- def self.names
26
- @_hash = {} if @_hash.nil?
27
- @_hash['street'] = 'street'
28
- @_hash['city'] = 'city'
29
- @_hash['zip'] = 'zip'
30
- @_hash
31
- end
32
-
33
- # An array for optional fields
34
- def self.optionals
35
- %w[
36
- zip
37
- ]
38
- end
39
-
40
- # An array for nullable fields
41
- def self.nullables
42
- []
43
- end
44
-
45
- def initialize(street:, city:, zip: SKIP, additional_properties: nil)
46
- # Add additional model properties to the instance
47
- additional_properties = {} if additional_properties.nil?
48
-
49
- @street = street
50
- @city = city
51
- @zip = zip unless zip == SKIP
52
- @additional_properties = additional_properties
53
- end
54
-
55
- # Creates an instance of the object from a hash.
56
- def self.from_hash(hash)
57
- return nil unless hash
58
-
59
- # Extract variables from the hash.
60
- street = hash.key?('street') ? hash['street'] : nil
61
- city = hash.key?('city') ? hash['city'] : nil
62
- zip = hash.key?('zip') ? hash['zip'] : SKIP
63
-
64
- # Create a new hash for additional properties, removing known properties.
65
- new_hash = hash.reject { |k, _| names.value?(k) }
66
-
67
- additional_properties = APIHelper.get_additional_properties(
68
- new_hash, proc { |value| value }
69
- )
70
-
71
- # Create object from extracted values.
72
- Address.new(street: street,
73
- city: city,
74
- zip: zip,
75
- additional_properties: additional_properties)
76
- end
77
-
78
- # Validates an instance of the object from a given value.
79
- # @param [Address | Hash] The value against the validation is performed.
80
- def self.validate(value)
81
- if value.instance_of? self
82
- return (
83
- APIHelper.valid_type?(value.street,
84
- ->(val) { val.instance_of? String }) and
85
- APIHelper.valid_type?(value.city,
86
- ->(val) { val.instance_of? String })
87
- )
88
- end
89
-
90
- return false unless value.instance_of? Hash
91
-
92
- (
93
- APIHelper.valid_type?(value['street'],
94
- ->(val) { val.instance_of? String }) and
95
- APIHelper.valid_type?(value['city'],
96
- ->(val) { val.instance_of? String })
97
- )
98
- end
99
-
100
- # Provides a human-readable string representation of the object.
101
- def to_s
102
- class_name = self.class.name.split('::').last
103
- "<#{class_name} street: #{@street}, city: #{@city}, zip: #{@zip}, additional_properties:"\
104
- " #{@additional_properties}>"
105
- end
106
-
107
- # Provides a debugging-friendly string with detailed object information.
108
- def inspect
109
- class_name = self.class.name.split('::').last
110
- "<#{class_name} street: #{@street.inspect}, city: #{@city.inspect}, zip: #{@zip.inspect},"\
111
- " additional_properties: #{@additional_properties}>"
112
- end
113
- end
114
- end