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.
- checksums.yaml +4 -4
- data/README.md +156 -132
- data/bin/console +4 -4
- data/lib/webhooks_and_callbacks_api/api_helper.rb +10 -0
- data/lib/{cypress_test_api/controllers/base_controller.rb → webhooks_and_callbacks_api/apis/base_api.rb} +17 -10
- data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +34 -0
- data/lib/webhooks_and_callbacks_api/client.rb +76 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/configuration.rb +61 -46
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +66 -0
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +78 -0
- data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +33 -0
- data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +14 -0
- data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +32 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +67 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +86 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +79 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +67 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +39 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/exceptions/api_exception.rb +4 -4
- data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +57 -0
- data/lib/webhooks_and_callbacks_api/http/api_response.rb +19 -0
- data/lib/webhooks_and_callbacks_api/http/auth/api_key.rb +52 -0
- data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +53 -0
- data/lib/webhooks_and_callbacks_api/http/http_call_back.rb +10 -0
- data/lib/webhooks_and_callbacks_api/http/http_method_enum.rb +10 -0
- data/lib/webhooks_and_callbacks_api/http/http_request.rb +10 -0
- data/lib/webhooks_and_callbacks_api/http/http_response.rb +10 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/http/proxy_settings.rb +4 -4
- data/lib/webhooks_and_callbacks_api/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/webhooks_and_callbacks_api/logging/sdk_logger.rb +17 -0
- data/lib/webhooks_and_callbacks_api/models/address.rb +114 -0
- data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +115 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/models/base_model.rb +4 -4
- data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +131 -0
- data/lib/webhooks_and_callbacks_api/models/delivery_details.rb +104 -0
- data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +97 -0
- data/lib/webhooks_and_callbacks_api/models/event.rb +52 -0
- data/lib/webhooks_and_callbacks_api/models/event_type.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type1.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type2.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type3.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +411 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +119 -0
- 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
- data/lib/webhooks_and_callbacks_api/models/order.rb +161 -0
- data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +314 -0
- data/lib/webhooks_and_callbacks_api/models/order_item.rb +102 -0
- data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +100 -0
- data/lib/webhooks_and_callbacks_api/models/package.rb +95 -0
- data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +167 -0
- data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +98 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +89 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +89 -0
- data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +98 -0
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +95 -0
- data/lib/webhooks_and_callbacks_api/models/status.rb +44 -0
- data/lib/webhooks_and_callbacks_api/models/status1.rb +36 -0
- data/lib/webhooks_and_callbacks_api/models/status2.rb +36 -0
- data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/webhook.rb +142 -0
- data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +103 -0
- data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +105 -0
- data/lib/webhooks_and_callbacks_api/utilities/date_time_helper.rb +11 -0
- data/lib/{cypress_test_api → webhooks_and_callbacks_api}/utilities/file_wrapper.rb +4 -4
- data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +172 -0
- data/lib/webhooks_and_callbacks_api.rb +122 -0
- metadata +78 -64
- data/lib/cypress_test_api/api_helper.rb +0 -10
- data/lib/cypress_test_api/client.rb +0 -58
- data/lib/cypress_test_api/controllers/api_controller.rb +0 -102
- data/lib/cypress_test_api/http/http_call_back.rb +0 -10
- data/lib/cypress_test_api/http/http_method_enum.rb +0 -10
- data/lib/cypress_test_api/http/http_request.rb +0 -10
- data/lib/cypress_test_api/http/http_response.rb +0 -10
- data/lib/cypress_test_api/models/custom_enum.rb +0 -40
- data/lib/cypress_test_api/models/deer.rb +0 -68
- data/lib/cypress_test_api/models/item.rb +0 -166
- data/lib/cypress_test_api/models/item_response.rb +0 -80
- data/lib/cypress_test_api/models/lion.rb +0 -68
- data/lib/cypress_test_api/models/message.rb +0 -68
- data/lib/cypress_test_api/models/message2.rb +0 -71
- data/lib/cypress_test_api/models/multiple_arrays_request.rb +0 -70
- data/lib/cypress_test_api/models/nac_tag.rb +0 -265
- data/lib/cypress_test_api/models/response_http400.rb +0 -62
- data/lib/cypress_test_api/models/response_http404.rb +0 -62
- data/lib/cypress_test_api/models/status11_enum.rb +0 -40
- data/lib/cypress_test_api/models/status1_enum.rb +0 -40
- data/lib/cypress_test_api/models/status_enum.rb +0 -40
- data/lib/cypress_test_api/models/tokens_request.rb +0 -60
- data/lib/cypress_test_api/utilities/date_time_helper.rb +0 -11
- data/lib/cypress_test_api.rb +0 -55
- data/test/controllers/controller_test_base.rb +0 -23
- data/test/controllers/test_api_controller.rb +0 -40
- data/test/http_response_catcher.rb +0 -19
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
# InventoryStockIncreaseEvent Model.
|
|
8
|
+
class InventoryStockIncreaseEvent < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_reader :inventory_stock_increase_event_type
|
|
15
|
+
|
|
16
|
+
# A mapping from model property names to API property names.
|
|
17
|
+
def self.names
|
|
18
|
+
@_hash = {} if @_hash.nil?
|
|
19
|
+
@_hash['inventory_stock_increase_event_type'] =
|
|
20
|
+
'inventoryStockIncreaseEventType'
|
|
21
|
+
@_hash
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# An array for optional fields
|
|
25
|
+
def self.optionals
|
|
26
|
+
[]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# An array for nullable fields
|
|
30
|
+
def self.nullables
|
|
31
|
+
[]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def initialize(additional_properties: nil)
|
|
35
|
+
# Add additional model properties to the instance
|
|
36
|
+
additional_properties = {} if additional_properties.nil?
|
|
37
|
+
|
|
38
|
+
@inventory_stock_increase_event_type = 'stock.increase'
|
|
39
|
+
@additional_properties = additional_properties
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Creates an instance of the object from a hash.
|
|
43
|
+
def self.from_hash(hash)
|
|
44
|
+
return nil unless hash
|
|
45
|
+
|
|
46
|
+
# Extract variables from the hash.
|
|
47
|
+
|
|
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
|
+
InventoryStockIncreaseEvent.new(additional_properties: additional_properties)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Validates an instance of the object from a given value.
|
|
61
|
+
# @param [InventoryStockIncreaseEvent | Hash] The value against the validation is performed.
|
|
62
|
+
def self.validate(value)
|
|
63
|
+
if value.instance_of? self
|
|
64
|
+
return APIHelper.valid_type?(value.inventory_stock_increase_event_type,
|
|
65
|
+
->(val) { val.instance_of? String })
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
return false unless value.instance_of? Hash
|
|
69
|
+
|
|
70
|
+
APIHelper.valid_type?(value['inventoryStockIncreaseEventType'],
|
|
71
|
+
->(val) { val.instance_of? String })
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Provides a human-readable string representation of the object.
|
|
75
|
+
def to_s
|
|
76
|
+
class_name = self.class.name.split('::').last
|
|
77
|
+
"<#{class_name} inventory_stock_increase_event_type:"\
|
|
78
|
+
" #{@inventory_stock_increase_event_type}, 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} inventory_stock_increase_event_type:"\
|
|
86
|
+
" #{@inventory_stock_increase_event_type.inspect}, additional_properties:"\
|
|
87
|
+
" #{@additional_properties}>"
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
# NotificationCallback Model.
|
|
8
|
+
class NotificationCallback < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :notification_type
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :subject
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :message
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['notification_type'] = 'notificationType'
|
|
28
|
+
@_hash['subject'] = 'subject'
|
|
29
|
+
@_hash['message'] = 'message'
|
|
30
|
+
@_hash
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for optional fields
|
|
34
|
+
def self.optionals
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# An array for nullable fields
|
|
39
|
+
def self.nullables
|
|
40
|
+
[]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def initialize(notification_type:, subject:, message:,
|
|
44
|
+
additional_properties: nil)
|
|
45
|
+
# Add additional model properties to the instance
|
|
46
|
+
additional_properties = {} if additional_properties.nil?
|
|
47
|
+
|
|
48
|
+
@notification_type = notification_type
|
|
49
|
+
@subject = subject
|
|
50
|
+
@message = message
|
|
51
|
+
@additional_properties = additional_properties
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Creates an instance of the object from a hash.
|
|
55
|
+
def self.from_hash(hash)
|
|
56
|
+
return nil unless hash
|
|
57
|
+
|
|
58
|
+
# Extract variables from the hash.
|
|
59
|
+
notification_type =
|
|
60
|
+
hash.key?('notificationType') ? hash['notificationType'] : nil
|
|
61
|
+
subject = hash.key?('subject') ? hash['subject'] : nil
|
|
62
|
+
message = hash.key?('message') ? hash['message'] : nil
|
|
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
|
+
NotificationCallback.new(notification_type: notification_type,
|
|
73
|
+
subject: subject,
|
|
74
|
+
message: message,
|
|
75
|
+
additional_properties: additional_properties)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Validates an instance of the object from a given value.
|
|
79
|
+
# @param [NotificationCallback | 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.notification_type,
|
|
84
|
+
->(val) { val.instance_of? String }) and
|
|
85
|
+
APIHelper.valid_type?(value.subject,
|
|
86
|
+
->(val) { val.instance_of? String }) and
|
|
87
|
+
APIHelper.valid_type?(value.message,
|
|
88
|
+
->(val) { val.instance_of? String })
|
|
89
|
+
)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
return false unless value.instance_of? Hash
|
|
93
|
+
|
|
94
|
+
(
|
|
95
|
+
APIHelper.valid_type?(value['notificationType'],
|
|
96
|
+
->(val) { val.instance_of? String }) and
|
|
97
|
+
APIHelper.valid_type?(value['subject'],
|
|
98
|
+
->(val) { val.instance_of? String }) and
|
|
99
|
+
APIHelper.valid_type?(value['message'],
|
|
100
|
+
->(val) { val.instance_of? String })
|
|
101
|
+
)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Provides a human-readable string representation of the object.
|
|
105
|
+
def to_s
|
|
106
|
+
class_name = self.class.name.split('::').last
|
|
107
|
+
"<#{class_name} notification_type: #{@notification_type}, subject: #{@subject}, message:"\
|
|
108
|
+
" #{@message}, additional_properties: #{@additional_properties}>"
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
112
|
+
def inspect
|
|
113
|
+
class_name = self.class.name.split('::').last
|
|
114
|
+
"<#{class_name} notification_type: #{@notification_type.inspect}, subject:"\
|
|
115
|
+
" #{@subject.inspect}, message: #{@message.inspect}, additional_properties:"\
|
|
116
|
+
" #{@additional_properties}>"
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# webhooks_and_callbacks_api
|
|
2
2
|
#
|
|
3
|
-
# This file was automatically generated by
|
|
4
|
-
# ( https://www.apimatic.io ).
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module WebhooksAndCallbacksApi
|
|
7
7
|
# OAuth 2 scopes supported by the API
|
|
8
|
-
class
|
|
9
|
-
|
|
10
|
-
# TODO: Write general description for ENUM_FILE_REQUESTSREAD
|
|
8
|
+
class OauthScopeOauthACG
|
|
9
|
+
OAUTH_SCOPE_OAUTH_ACG = [
|
|
10
|
+
# TODO: Write general description for ENUM_FILE_REQUESTSREAD
|
|
11
11
|
ENUM_FILE_REQUESTSREAD = 'file_requests.read'.freeze,
|
|
12
12
|
|
|
13
|
-
# TODO: Write general description for ZAHRA
|
|
13
|
+
# TODO: Write general description for ZAHRA
|
|
14
14
|
ZAHRA = 'zahra'.freeze,
|
|
15
15
|
|
|
16
|
-
# TODO: Write general description for TEST1
|
|
16
|
+
# TODO: Write general description for TEST1
|
|
17
17
|
TEST1 = 'test1'.freeze,
|
|
18
18
|
|
|
19
|
-
# TODO: Write general description for SELECTION
|
|
19
|
+
# TODO: Write general description for SELECTION
|
|
20
20
|
SELECTION = 'selection'.freeze
|
|
21
21
|
].freeze
|
|
22
22
|
|
|
23
23
|
def self.validate(value)
|
|
24
24
|
return false if value.nil?
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
OAUTH_SCOPE_OAUTH_ACG.include?(value)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
def self.from_value(value, default_value = ENUM_FILE_REQUESTSREAD)
|
|
29
|
+
def self.from_value(value, default_value = ENUM_FILE_REQUESTSREAD)
|
|
30
30
|
return default_value if value.nil?
|
|
31
|
-
|
|
32
|
-
str = value.to_s.strip
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
when '
|
|
38
|
-
when '
|
|
32
|
+
str = value.to_s.strip
|
|
33
|
+
|
|
34
|
+
case str.downcase
|
|
35
|
+
when 'enum_file_requestsread' then ENUM_FILE_REQUESTSREAD
|
|
36
|
+
when 'zahra' then ZAHRA
|
|
37
|
+
when 'test1' then TEST1
|
|
38
|
+
when 'selection' then SELECTION
|
|
39
39
|
else
|
|
40
40
|
default_value
|
|
41
41
|
end
|
|
@@ -0,0 +1,161 @@
|
|
|
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
|
+
# Order Model.
|
|
9
|
+
class Order < 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 [String]
|
|
19
|
+
attr_accessor :customer_id
|
|
20
|
+
|
|
21
|
+
# TODO: Write general description for this method
|
|
22
|
+
# @return [Array[OrderItem]]
|
|
23
|
+
attr_accessor :items
|
|
24
|
+
|
|
25
|
+
# TODO: Write general description for this method
|
|
26
|
+
# @return [Float]
|
|
27
|
+
attr_accessor :total_amount
|
|
28
|
+
|
|
29
|
+
# TODO: Write general description for this method
|
|
30
|
+
# @return [Status]
|
|
31
|
+
attr_accessor :status
|
|
32
|
+
|
|
33
|
+
# TODO: Write general description for this method
|
|
34
|
+
# @return [DateTime]
|
|
35
|
+
attr_accessor :created_at
|
|
36
|
+
|
|
37
|
+
# TODO: Write general description for this method
|
|
38
|
+
# @return [DateTime]
|
|
39
|
+
attr_accessor :updated_at
|
|
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['customer_id'] = 'customerId'
|
|
46
|
+
@_hash['items'] = 'items'
|
|
47
|
+
@_hash['total_amount'] = 'totalAmount'
|
|
48
|
+
@_hash['status'] = 'status'
|
|
49
|
+
@_hash['created_at'] = 'createdAt'
|
|
50
|
+
@_hash['updated_at'] = 'updatedAt'
|
|
51
|
+
@_hash
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# An array for optional fields
|
|
55
|
+
def self.optionals
|
|
56
|
+
%w[
|
|
57
|
+
order_id
|
|
58
|
+
customer_id
|
|
59
|
+
items
|
|
60
|
+
total_amount
|
|
61
|
+
status
|
|
62
|
+
created_at
|
|
63
|
+
updated_at
|
|
64
|
+
]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# An array for nullable fields
|
|
68
|
+
def self.nullables
|
|
69
|
+
[]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def initialize(order_id: SKIP, customer_id: SKIP, items: SKIP,
|
|
73
|
+
total_amount: SKIP, status: SKIP, created_at: SKIP,
|
|
74
|
+
updated_at: SKIP, additional_properties: nil)
|
|
75
|
+
# Add additional model properties to the instance
|
|
76
|
+
additional_properties = {} if additional_properties.nil?
|
|
77
|
+
|
|
78
|
+
@order_id = order_id unless order_id == SKIP
|
|
79
|
+
@customer_id = customer_id unless customer_id == SKIP
|
|
80
|
+
@items = items unless items == SKIP
|
|
81
|
+
@total_amount = total_amount unless total_amount == SKIP
|
|
82
|
+
@status = status unless status == SKIP
|
|
83
|
+
@created_at = created_at unless created_at == SKIP
|
|
84
|
+
@updated_at = updated_at unless updated_at == SKIP
|
|
85
|
+
@additional_properties = additional_properties
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Creates an instance of the object from a hash.
|
|
89
|
+
def self.from_hash(hash)
|
|
90
|
+
return nil unless hash
|
|
91
|
+
|
|
92
|
+
# Extract variables from the hash.
|
|
93
|
+
order_id = hash.key?('orderId') ? hash['orderId'] : SKIP
|
|
94
|
+
customer_id = hash.key?('customerId') ? hash['customerId'] : SKIP
|
|
95
|
+
# Parameter is an array, so we need to iterate through it
|
|
96
|
+
items = nil
|
|
97
|
+
unless hash['items'].nil?
|
|
98
|
+
items = []
|
|
99
|
+
hash['items'].each do |structure|
|
|
100
|
+
items << (OrderItem.from_hash(structure) if structure)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
items = SKIP unless hash.key?('items')
|
|
105
|
+
total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : SKIP
|
|
106
|
+
status = hash.key?('status') ? hash['status'] : SKIP
|
|
107
|
+
created_at = if hash.key?('createdAt')
|
|
108
|
+
(DateTimeHelper.from_rfc3339(hash['createdAt']) if hash['createdAt'])
|
|
109
|
+
else
|
|
110
|
+
SKIP
|
|
111
|
+
end
|
|
112
|
+
updated_at = if hash.key?('updatedAt')
|
|
113
|
+
(DateTimeHelper.from_rfc3339(hash['updatedAt']) if hash['updatedAt'])
|
|
114
|
+
else
|
|
115
|
+
SKIP
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Create a new hash for additional properties, removing known properties.
|
|
119
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
120
|
+
|
|
121
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
122
|
+
new_hash, proc { |value| value }
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# Create object from extracted values.
|
|
126
|
+
Order.new(order_id: order_id,
|
|
127
|
+
customer_id: customer_id,
|
|
128
|
+
items: items,
|
|
129
|
+
total_amount: total_amount,
|
|
130
|
+
status: status,
|
|
131
|
+
created_at: created_at,
|
|
132
|
+
updated_at: updated_at,
|
|
133
|
+
additional_properties: additional_properties)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def to_custom_created_at
|
|
137
|
+
DateTimeHelper.to_rfc3339(created_at)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def to_custom_updated_at
|
|
141
|
+
DateTimeHelper.to_rfc3339(updated_at)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Provides a human-readable string representation of the object.
|
|
145
|
+
def to_s
|
|
146
|
+
class_name = self.class.name.split('::').last
|
|
147
|
+
"<#{class_name} order_id: #{@order_id}, customer_id: #{@customer_id}, items: #{@items},"\
|
|
148
|
+
" total_amount: #{@total_amount}, status: #{@status}, created_at: #{@created_at},"\
|
|
149
|
+
" updated_at: #{@updated_at}, additional_properties: #{@additional_properties}>"
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
153
|
+
def inspect
|
|
154
|
+
class_name = self.class.name.split('::').last
|
|
155
|
+
"<#{class_name} order_id: #{@order_id.inspect}, customer_id: #{@customer_id.inspect},"\
|
|
156
|
+
" items: #{@items.inspect}, total_amount: #{@total_amount.inspect}, status:"\
|
|
157
|
+
" #{@status.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
|
|
158
|
+
" #{@updated_at.inspect}, additional_properties: #{@additional_properties}>"
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|