pcp-server-ruby-sdk 1.12.0 → 1.13.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 (168) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/api-definition.yaml +323 -41
  5. data/lib/PCP-server-Ruby-SDK/endpoints/payment_intent_api_client.rb +37 -0
  6. data/lib/PCP-server-Ruby-SDK/models/address.rb +9 -237
  7. data/lib/PCP-server-Ruby-SDK/models/address_personal.rb +10 -246
  8. data/lib/PCP-server-Ruby-SDK/models/amount_of_money.rb +4 -195
  9. data/lib/PCP-server-Ruby-SDK/models/api_error.rb +27 -232
  10. data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_header_information.rb +6 -194
  11. data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_information.rb +8 -229
  12. data/lib/PCP-server-Ruby-SDK/models/bank_account_information.rb +11 -207
  13. data/lib/PCP-server-Ruby-SDK/models/bank_payout_method_specific_input.rb +4 -187
  14. data/lib/PCP-server-Ruby-SDK/models/cancel_item.rb +6 -195
  15. data/lib/PCP-server-Ruby-SDK/models/cancel_payment_request.rb +6 -222
  16. data/lib/PCP-server-Ruby-SDK/models/cancel_payment_response.rb +4 -190
  17. data/lib/PCP-server-Ruby-SDK/models/cancel_request.rb +6 -224
  18. data/lib/PCP-server-Ruby-SDK/models/cancel_response.rb +4 -190
  19. data/lib/PCP-server-Ruby-SDK/models/capture_output.rb +9 -214
  20. data/lib/PCP-server-Ruby-SDK/models/capture_payment_request.rb +14 -253
  21. data/lib/PCP-server-Ruby-SDK/models/capture_payment_response.rb +7 -239
  22. data/lib/PCP-server-Ruby-SDK/models/card_fraud_results.rb +29 -184
  23. data/lib/PCP-server-Ruby-SDK/models/card_info.rb +3 -182
  24. data/lib/PCP-server-Ruby-SDK/models/card_payment_details.rb +8 -210
  25. data/lib/PCP-server-Ruby-SDK/models/card_payment_method_specific_input.rb +32 -307
  26. data/lib/PCP-server-Ruby-SDK/models/card_payment_method_specific_output.rb +6 -210
  27. data/lib/PCP-server-Ruby-SDK/models/card_recurrence_details.rb +12 -186
  28. data/lib/PCP-server-Ruby-SDK/models/cart_item_data.rb +10 -0
  29. data/lib/PCP-server-Ruby-SDK/models/cart_item_input.rb +5 -198
  30. data/lib/PCP-server-Ruby-SDK/models/cart_item_invoice_data.rb +5 -184
  31. data/lib/PCP-server-Ruby-SDK/models/cart_item_order_status.rb +4 -213
  32. data/lib/PCP-server-Ruby-SDK/models/cart_item_patch.rb +5 -200
  33. data/lib/PCP-server-Ruby-SDK/models/cart_item_result.rb +5 -200
  34. data/lib/PCP-server-Ruby-SDK/models/cart_item_supplier_references.rb +6 -195
  35. data/lib/PCP-server-Ruby-SDK/models/checkout_references.rb +4 -192
  36. data/lib/PCP-server-Ruby-SDK/models/checkout_response.rb +15 -319
  37. data/lib/PCP-server-Ruby-SDK/models/checkouts_response.rb +4 -193
  38. data/lib/PCP-server-Ruby-SDK/models/company_information.rb +3 -182
  39. data/lib/PCP-server-Ruby-SDK/models/complete_financing_payment_method_specific_input.rb +12 -202
  40. data/lib/PCP-server-Ruby-SDK/models/complete_order_request.rb +3 -181
  41. data/lib/PCP-server-Ruby-SDK/models/complete_payment_method_specific_input.rb +4 -191
  42. data/lib/PCP-server-Ruby-SDK/models/complete_payment_product840_specific_input.rb +7 -226
  43. data/lib/PCP-server-Ruby-SDK/models/complete_payment_request.rb +6 -209
  44. data/lib/PCP-server-Ruby-SDK/models/complete_payment_response.rb +5 -199
  45. data/lib/PCP-server-Ruby-SDK/models/complete_redirect_payment_method_specific_input.rb +4 -192
  46. data/lib/PCP-server-Ruby-SDK/models/contact_details.rb +4 -191
  47. data/lib/PCP-server-Ruby-SDK/models/create_checkout_request.rb +13 -240
  48. data/lib/PCP-server-Ruby-SDK/models/create_checkout_response.rb +16 -307
  49. data/lib/PCP-server-Ruby-SDK/models/create_commerce_case_response.rb +7 -219
  50. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent.rb +11 -0
  51. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent_request.rb +13 -0
  52. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent_response.rb +10 -0
  53. data/lib/PCP-server-Ruby-SDK/models/create_payment_response.rb +7 -218
  54. data/lib/PCP-server-Ruby-SDK/models/customer.rb +28 -260
  55. data/lib/PCP-server-Ruby-SDK/models/customer_account.rb +10 -44
  56. data/lib/PCP-server-Ruby-SDK/models/customer_device.rb +8 -209
  57. data/lib/PCP-server-Ruby-SDK/models/deliver_item.rb +6 -195
  58. data/lib/PCP-server-Ruby-SDK/models/deliver_request.rb +10 -246
  59. data/lib/PCP-server-Ruby-SDK/models/deliver_response.rb +4 -191
  60. data/lib/PCP-server-Ruby-SDK/models/delivery_information.rb +3 -185
  61. data/lib/PCP-server-Ruby-SDK/models/error_response.rb +4 -193
  62. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_input.rb +15 -203
  63. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_output.rb +10 -196
  64. data/lib/PCP-server-Ruby-SDK/models/fund_distribution.rb +12 -263
  65. data/lib/PCP-server-Ruby-SDK/models/fund_split.rb +5 -205
  66. data/lib/PCP-server-Ruby-SDK/models/fund_split_request.rb +3 -147
  67. data/lib/PCP-server-Ruby-SDK/models/fund_split_response.rb +10 -174
  68. data/lib/PCP-server-Ruby-SDK/models/installment_option.rb +13 -273
  69. data/lib/PCP-server-Ruby-SDK/models/link_information.rb +4 -196
  70. data/lib/PCP-server-Ruby-SDK/models/merchant_action.rb +16 -194
  71. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_input.rb +13 -246
  72. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_output.rb +7 -219
  73. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_three_dsecure.rb +3 -179
  74. data/lib/PCP-server-Ruby-SDK/models/model_base.rb +147 -0
  75. data/lib/PCP-server-Ruby-SDK/models/order.rb +7 -221
  76. data/lib/PCP-server-Ruby-SDK/models/order_item.rb +6 -197
  77. data/lib/PCP-server-Ruby-SDK/models/order_line_details_input.rb +29 -305
  78. data/lib/PCP-server-Ruby-SDK/models/order_line_details_patch.rb +5 -326
  79. data/lib/PCP-server-Ruby-SDK/models/order_line_details_result.rb +5 -326
  80. data/lib/PCP-server-Ruby-SDK/models/order_request.rb +7 -244
  81. data/lib/PCP-server-Ruby-SDK/models/order_response.rb +4 -192
  82. data/lib/PCP-server-Ruby-SDK/models/patch_checkout_request.rb +8 -228
  83. data/lib/PCP-server-Ruby-SDK/models/patch_commerce_case_request.rb +3 -183
  84. data/lib/PCP-server-Ruby-SDK/models/pause_payment_request.rb +2 -165
  85. data/lib/PCP-server-Ruby-SDK/models/pause_payment_response.rb +3 -186
  86. data/lib/PCP-server-Ruby-SDK/models/payee.rb +6 -204
  87. data/lib/PCP-server-Ruby-SDK/models/payment_creation_output.rb +3 -183
  88. data/lib/PCP-server-Ruby-SDK/models/payment_event.rb +19 -274
  89. data/lib/PCP-server-Ruby-SDK/models/payment_execution.rb +29 -335
  90. data/lib/PCP-server-Ruby-SDK/models/payment_execution_request.rb +4 -191
  91. data/lib/PCP-server-Ruby-SDK/models/payment_execution_specific_input.rb +6 -212
  92. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_request.rb +7 -205
  93. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_response.rb +5 -196
  94. data/lib/PCP-server-Ruby-SDK/models/payment_information_request.rb +10 -249
  95. data/lib/PCP-server-Ruby-SDK/models/payment_information_response.rb +30 -314
  96. data/lib/PCP-server-Ruby-SDK/models/payment_instructions.rb +8 -214
  97. data/lib/PCP-server-Ruby-SDK/models/payment_intent_output.rb +13 -0
  98. data/lib/PCP-server-Ruby-SDK/models/payment_intent_response.rb +13 -0
  99. data/lib/PCP-server-Ruby-SDK/models/payment_intent_response_data.rb +12 -0
  100. data/lib/PCP-server-Ruby-SDK/models/payment_method_specific_input.rb +9 -261
  101. data/lib/PCP-server-Ruby-SDK/models/payment_method_specific_input_for_intent.rb +9 -0
  102. data/lib/PCP-server-Ruby-SDK/models/payment_output.rb +11 -255
  103. data/lib/PCP-server-Ruby-SDK/models/payment_product302_specific_input.rb +11 -225
  104. data/lib/PCP-server-Ruby-SDK/models/payment_product3391_specific_input.rb +6 -197
  105. data/lib/PCP-server-Ruby-SDK/models/payment_product3391_specific_output.rb +3 -185
  106. data/lib/PCP-server-Ruby-SDK/models/payment_product3392_specific_input.rb +3 -185
  107. data/lib/PCP-server-Ruby-SDK/models/payment_product5002_specific_input.rb +7 -203
  108. data/lib/PCP-server-Ruby-SDK/models/payment_product771_specific_output.rb +3 -183
  109. data/lib/PCP-server-Ruby-SDK/models/payment_product840_customer_account.rb +6 -210
  110. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output.rb +5 -209
  111. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output_data.rb +11 -0
  112. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output_for_intent.rb +13 -0
  113. data/lib/PCP-server-Ruby-SDK/models/payment_references.rb +6 -184
  114. data/lib/PCP-server-Ruby-SDK/models/payment_references_for_refund.rb +12 -197
  115. data/lib/PCP-server-Ruby-SDK/models/payment_response.rb +6 -234
  116. data/lib/PCP-server-Ruby-SDK/models/payment_status_output.rb +6 -234
  117. data/lib/PCP-server-Ruby-SDK/models/payout_output.rb +5 -205
  118. data/lib/PCP-server-Ruby-SDK/models/payout_response.rb +6 -215
  119. data/lib/PCP-server-Ruby-SDK/models/personal_information.rb +11 -227
  120. data/lib/PCP-server-Ruby-SDK/models/personal_name.rb +5 -201
  121. data/lib/PCP-server-Ruby-SDK/models/positive_amount_of_money.rb +4 -196
  122. data/lib/PCP-server-Ruby-SDK/models/processing_mandate_information.rb +9 -254
  123. data/lib/PCP-server-Ruby-SDK/models/redirect_data.rb +3 -183
  124. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input.rb +14 -249
  125. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input_for_intent.rb +12 -0
  126. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output.rb +6 -211
  127. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_create_intent.rb +12 -0
  128. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_intent.rb +10 -0
  129. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input.rb +6 -205
  130. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input_data.rb +10 -0
  131. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product900_specific_input.rb +12 -177
  132. data/lib/PCP-server-Ruby-SDK/models/redirection_data.rb +11 -186
  133. data/lib/PCP-server-Ruby-SDK/models/references.rb +47 -205
  134. data/lib/PCP-server-Ruby-SDK/models/refresh_payment_request.rb +3 -186
  135. data/lib/PCP-server-Ruby-SDK/models/refund_error_response.rb +4 -193
  136. data/lib/PCP-server-Ruby-SDK/models/refund_output.rb +8 -211
  137. data/lib/PCP-server-Ruby-SDK/models/refund_payment_response.rb +7 -242
  138. data/lib/PCP-server-Ruby-SDK/models/refund_request.rb +6 -210
  139. data/lib/PCP-server-Ruby-SDK/models/return_information.rb +4 -194
  140. data/lib/PCP-server-Ruby-SDK/models/return_item.rb +6 -196
  141. data/lib/PCP-server-Ruby-SDK/models/return_request.rb +6 -234
  142. data/lib/PCP-server-Ruby-SDK/models/return_response.rb +4 -191
  143. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_specific_input.rb +4 -193
  144. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_specific_output.rb +4 -193
  145. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_product771_specific_input.rb +4 -192
  146. data/lib/PCP-server-Ruby-SDK/models/sepa_transfer_payment_product_772_specific_input.rb +3 -186
  147. data/lib/PCP-server-Ruby-SDK/models/shipping.rb +3 -183
  148. data/lib/PCP-server-Ruby-SDK/models/shipping_address.rb +14 -0
  149. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_data.rb +9 -0
  150. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_input.rb +3 -185
  151. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_patch.rb +3 -185
  152. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_result.rb +3 -185
  153. data/lib/PCP-server-Ruby-SDK/models/status_output.rb +21 -264
  154. data/lib/PCP-server-Ruby-SDK/models/three_d_secure_results.rb +6 -226
  155. data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
  156. data/lib/PCP-server-Ruby-SDK.rb +18 -0
  157. data/package-lock.json +2 -2
  158. data/package.json +1 -1
  159. data/scripts/convert_models_to_model_base.rb +128 -0
  160. data/spec/endpoints/payment_intent_api_client_spec.rb +43 -0
  161. data/spec/models/api_definition_conformance_spec.rb +88 -0
  162. data/spec/models/model_base_spec.rb +87 -0
  163. data/spec/models/payment_intent_models_spec.rb +25 -0
  164. data/spec/models/required_field_validation_spec.rb +5 -5
  165. metadata +35 -11
  166. data/lib/PCP-server-Ruby-SDK/models/action_type.rb +0 -34
  167. data/lib/PCP-server-Ruby-SDK/models/avs_result.rb +0 -52
  168. data/lib/PCP-server-Ruby-SDK/models/business_relation.rb +0 -30
@@ -1,220 +1,11 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
3
  module PCPServerSDK
5
4
  module Models
6
- # Detailed information regarding an occurred payment event.
7
- class CartItemOrderStatus
8
- attr_accessor :cart_item_status
9
-
5
+ class CartItemOrderStatus < ModelBase
6
+ attribute :cart_item_status, :cartItemStatus, :CartItemStatus
10
7
  # Amount of units for which this status is applicable, should be greater than zero
11
- attr_accessor :quantity
12
-
13
- class EnumAttributeValidator
14
- attr_reader :datatype
15
- attr_reader :allowable_values
16
-
17
- def initialize(datatype, allowable_values)
18
- @allowable_values = allowable_values.map do |value|
19
- case datatype.to_s
20
- when /Integer/i
21
- value.to_i
22
- when /Float/i
23
- value.to_f
24
- else
25
- value
26
- end
27
- end
28
- end
29
-
30
- def valid?(value)
31
- !value || allowable_values.include?(value)
32
- end
33
- end
34
-
35
- # Attribute mapping from ruby-style variable name to JSON key.
36
- def self.attribute_map
37
- {
38
- :'cart_item_status' => :'cartItemStatus',
39
- :'quantity' => :'quantity'
40
- }
41
- end
42
-
43
- # Returns all the JSON keys this model knows about
44
- def self.acceptable_attributes
45
- attribute_map.values
46
- end
47
-
48
- # Attribute type mapping.
49
- def self.openapi_types
50
- {
51
- :'cart_item_status' => :'CartItemStatus',
52
- :'quantity' => :'Integer'
53
- }
54
- end
55
-
56
- # List of attributes with nullable: true
57
- def self.openapi_nullable
58
- Set.new([
59
- ])
60
- end
61
-
62
- # Initializes the object
63
- # @param [Hash] attributes Model attributes in the form of hash
64
- def initialize(attributes = {})
65
- if (!attributes.is_a?(Hash))
66
- fail ArgumentError, "The input argument (attributes) must be a hash in `CartItemOrderStatus` initialize method"
67
- end
68
-
69
- # check to see if the attribute exists and convert string to symbol for hash key
70
- attributes = attributes.each_with_object({}) { |(k, v), h|
71
- if (!self.class.attribute_map.key?(k.to_sym))
72
- fail ArgumentError, "`#{k}` is not a valid attribute in `CartItemOrderStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
- end
74
- h[k.to_sym] = v
75
- }
76
-
77
- if attributes.key?(:'cart_item_status')
78
- self.cart_item_status = attributes[:'cart_item_status']
79
- end
80
-
81
- if attributes.key?(:'quantity')
82
- self.quantity = attributes[:'quantity']
83
- end
84
- end
85
-
86
- # Checks equality by comparing each attribute.
87
- # @param [Object] Object to be compared
88
- def ==(o)
89
- return true if self.equal?(o)
90
- self.class == o.class &&
91
- cart_item_status == o.cart_item_status &&
92
- quantity == o.quantity
93
- end
94
-
95
- # @see the `==` method
96
- # @param [Object] Object to be compared
97
- def eql?(o)
98
- self == o
99
- end
100
-
101
- # Calculates hash code according to all attributes.
102
- # @return [Integer] Hash code
103
- def hash
104
- [cart_item_status, quantity].hash
105
- end
106
-
107
- # Builds the object from hash
108
- # @param [Hash] attributes Model attributes in the form of hash
109
- # @return [Object] Returns the model itself
110
- def self.build_from_hash(attributes)
111
- return nil unless attributes.is_a?(Hash)
112
- attributes = attributes.transform_keys(&:to_sym)
113
- transformed_hash = {}
114
- openapi_types.each_pair do |key, type|
115
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
- transformed_hash["#{key}"] = nil
117
- elsif type =~ /\AArray<(.*)>/i
118
- # check to ensure the input is an array given that the attribute
119
- # is documented as an array but the input is not
120
- if attributes[attribute_map[key]].is_a?(Array)
121
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
- end
123
- elsif !attributes[attribute_map[key]].nil?
124
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
125
- end
126
- end
127
- new(transformed_hash)
128
- end
129
-
130
- # Deserializes the data based on type
131
- # @param string type Data type
132
- # @param string value Value to be deserialized
133
- # @return [Object] Deserialized data
134
- def self._deserialize(type, value)
135
- case type.to_sym
136
- when :Time
137
- Time.parse(value)
138
- when :Date
139
- Date.parse(value)
140
- when :String
141
- value.to_s
142
- when :Integer
143
- value.to_i
144
- when :Float
145
- value.to_f
146
- when :Boolean
147
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
- true
149
- else
150
- false
151
- end
152
- when :Object
153
- # generic object (usually a Hash), return directly
154
- value
155
- when /\AArray<(?<inner_type>.+)>\z/
156
- inner_type = Regexp.last_match[:inner_type]
157
- value.map { |v| _deserialize(inner_type, v) }
158
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
- k_type = Regexp.last_match[:k_type]
160
- v_type = Regexp.last_match[:v_type]
161
- {}.tap do |hash|
162
- value.each do |k, v|
163
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
- end
165
- end
166
- else # model
167
- # models (e.g. Pet) or oneOf
168
- klass = PCPServerSDK::Models.const_get(type)
169
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
- end
171
- end
172
-
173
- # Returns the string representation of the object
174
- # @return [String] String presentation of the object
175
- def to_s
176
- to_hash.to_s
177
- end
178
-
179
- # to_body is an alias to to_hash (backward compatibility)
180
- # @return [Hash] Returns the object in the form of hash
181
- def to_body
182
- to_hash
183
- end
184
-
185
- # Returns the object in the form of hash
186
- # @return [Hash] Returns the object in the form of hash
187
- def to_hash
188
- hash = {}
189
- self.class.attribute_map.each_pair do |attr, param|
190
- value = self.send(attr)
191
- if value.nil?
192
- is_nullable = self.class.openapi_nullable.include?(attr)
193
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
- end
195
-
196
- hash[param] = _to_hash(value)
197
- end
198
- hash
199
- end
200
-
201
- # Outputs non-array value in the form of hash
202
- # For object, use to_hash. Otherwise, just return the value
203
- # @param [Object] value Any valid value
204
- # @return [Hash] Returns the value in the form of hash
205
- def _to_hash(value)
206
- if value.is_a?(Array)
207
- value.compact.map { |v| _to_hash(v) }
208
- elsif value.is_a?(Hash)
209
- {}.tap do |hash|
210
- value.each { |k, v| hash[k] = _to_hash(v) }
211
- end
212
- elsif value.respond_to? :to_hash
213
- value.to_hash
214
- else
215
- value
216
- end
217
- end
8
+ attribute :quantity, :quantity, :Integer
218
9
  end
219
10
  end
220
11
  end
@@ -1,206 +1,11 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
3
  module PCPServerSDK
5
4
  module Models
6
- # This object contains information of all items in the cart. If a cart item is provided, the productPrice and quantity is required.
7
- class CartItemPatch
8
- attr_accessor :invoice_data
9
-
10
- attr_accessor :order_line_details
11
-
12
- attr_accessor :supplier_references
13
-
14
- # Attribute mapping from ruby-style variable name to JSON key.
15
- def self.attribute_map
16
- {
17
- :'invoice_data' => :'invoiceData',
18
- :'order_line_details' => :'orderLineDetails',
19
- :'supplier_references' => :'supplierReferences'
20
- }
21
- end
22
-
23
- # Returns all the JSON keys this model knows about
24
- def self.acceptable_attributes
25
- attribute_map.values
26
- end
27
-
28
- # Attribute type mapping.
29
- def self.openapi_types
30
- {
31
- :'invoice_data' => :'CartItemInvoiceData',
32
- :'order_line_details' => :'OrderLineDetailsPatch',
33
- :'supplier_references' => :'CartItemSupplierReferences'
34
- }
35
- end
36
-
37
- # List of attributes with nullable: true
38
- def self.openapi_nullable
39
- Set.new([
40
- ])
41
- end
42
-
43
- # Initializes the object
44
- # @param [Hash] attributes Model attributes in the form of hash
45
- def initialize(attributes = {})
46
- if (!attributes.is_a?(Hash))
47
- fail ArgumentError, "The input argument (attributes) must be a hash in `CartItemPatch` initialize method"
48
- end
49
-
50
- # check to see if the attribute exists and convert string to symbol for hash key
51
- attributes = attributes.each_with_object({}) { |(k, v), h|
52
- if (!self.class.attribute_map.key?(k.to_sym))
53
- fail ArgumentError, "`#{k}` is not a valid attribute in `CartItemPatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
- end
55
- h[k.to_sym] = v
56
- }
57
-
58
- if attributes.key?(:'invoice_data')
59
- self.invoice_data = attributes[:'invoice_data']
60
- end
61
-
62
- if attributes.key?(:'order_line_details')
63
- self.order_line_details = attributes[:'order_line_details']
64
- end
65
-
66
- if attributes.key?(:'supplier_references')
67
- self.supplier_references = attributes[:'supplier_references']
68
- end
69
- end
70
-
71
- # Checks equality by comparing each attribute.
72
- # @param [Object] Object to be compared
73
- def ==(o)
74
- return true if self.equal?(o)
75
- self.class == o.class &&
76
- invoice_data == o.invoice_data &&
77
- order_line_details == o.order_line_details &&
78
- supplier_references == o.supplier_references
79
- end
80
-
81
- # @see the `==` method
82
- # @param [Object] Object to be compared
83
- def eql?(o)
84
- self == o
85
- end
86
-
87
- # Calculates hash code according to all attributes.
88
- # @return [Integer] Hash code
89
- def hash
90
- [invoice_data, order_line_details, supplier_references].hash
91
- end
92
-
93
- # Builds the object from hash
94
- # @param [Hash] attributes Model attributes in the form of hash
95
- # @return [Object] Returns the model itself
96
- def self.build_from_hash(attributes)
97
- return nil unless attributes.is_a?(Hash)
98
- attributes = attributes.transform_keys(&:to_sym)
99
- transformed_hash = {}
100
- openapi_types.each_pair do |key, type|
101
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
102
- transformed_hash["#{key}"] = nil
103
- elsif type =~ /\AArray<(.*)>/i
104
- # check to ensure the input is an array given that the attribute
105
- # is documented as an array but the input is not
106
- if attributes[attribute_map[key]].is_a?(Array)
107
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
108
- end
109
- elsif !attributes[attribute_map[key]].nil?
110
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
111
- end
112
- end
113
- new(transformed_hash)
114
- end
115
-
116
- # Deserializes the data based on type
117
- # @param string type Data type
118
- # @param string value Value to be deserialized
119
- # @return [Object] Deserialized data
120
- def self._deserialize(type, value)
121
- case type.to_sym
122
- when :Time
123
- Time.parse(value)
124
- when :Date
125
- Date.parse(value)
126
- when :String
127
- value.to_s
128
- when :Integer
129
- value.to_i
130
- when :Float
131
- value.to_f
132
- when :Boolean
133
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
134
- true
135
- else
136
- false
137
- end
138
- when :Object
139
- # generic object (usually a Hash), return directly
140
- value
141
- when /\AArray<(?<inner_type>.+)>\z/
142
- inner_type = Regexp.last_match[:inner_type]
143
- value.map { |v| _deserialize(inner_type, v) }
144
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
145
- k_type = Regexp.last_match[:k_type]
146
- v_type = Regexp.last_match[:v_type]
147
- {}.tap do |hash|
148
- value.each do |k, v|
149
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
150
- end
151
- end
152
- else # model
153
- # models (e.g. Pet) or oneOf
154
- klass = PCPServerSDK::Models.const_get(type)
155
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
156
- end
157
- end
158
-
159
- # Returns the string representation of the object
160
- # @return [String] String presentation of the object
161
- def to_s
162
- to_hash.to_s
163
- end
164
-
165
- # to_body is an alias to to_hash (backward compatibility)
166
- # @return [Hash] Returns the object in the form of hash
167
- def to_body
168
- to_hash
169
- end
170
-
171
- # Returns the object in the form of hash
172
- # @return [Hash] Returns the object in the form of hash
173
- def to_hash
174
- hash = {}
175
- self.class.attribute_map.each_pair do |attr, param|
176
- value = self.send(attr)
177
- if value.nil?
178
- is_nullable = self.class.openapi_nullable.include?(attr)
179
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
180
- end
181
-
182
- hash[param] = _to_hash(value)
183
- end
184
- hash
185
- end
186
-
187
- # Outputs non-array value in the form of hash
188
- # For object, use to_hash. Otherwise, just return the value
189
- # @param [Object] value Any valid value
190
- # @return [Hash] Returns the value in the form of hash
191
- def _to_hash(value)
192
- if value.is_a?(Array)
193
- value.compact.map { |v| _to_hash(v) }
194
- elsif value.is_a?(Hash)
195
- {}.tap do |hash|
196
- value.each { |k, v| hash[k] = _to_hash(v) }
197
- end
198
- elsif value.respond_to? :to_hash
199
- value.to_hash
200
- else
201
- value
202
- end
203
- end
5
+ class CartItemPatch < ModelBase
6
+ attribute :invoice_data, :invoiceData, :CartItemInvoiceData
7
+ attribute :order_line_details, :orderLineDetails, :OrderLineDetailsPatch
8
+ attribute :supplier_references, :supplierReferences, :CartItemSupplierReferences
204
9
  end
205
10
  end
206
11
  end
@@ -1,206 +1,11 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
3
  module PCPServerSDK
5
4
  module Models
6
- # This object contains information of all items in the cart. If a cart item is provided, the productPrice and quantity is required.
7
- class CartItemResult
8
- attr_accessor :invoice_data
9
-
10
- attr_accessor :order_line_details
11
-
12
- attr_accessor :supplier_references
13
-
14
- # Attribute mapping from ruby-style variable name to JSON key.
15
- def self.attribute_map
16
- {
17
- :'invoice_data' => :'invoiceData',
18
- :'order_line_details' => :'orderLineDetails',
19
- :'supplier_references' => :'supplierReferences'
20
- }
21
- end
22
-
23
- # Returns all the JSON keys this model knows about
24
- def self.acceptable_attributes
25
- attribute_map.values
26
- end
27
-
28
- # Attribute type mapping.
29
- def self.openapi_types
30
- {
31
- :'invoice_data' => :'CartItemInvoiceData',
32
- :'order_line_details' => :'OrderLineDetailsResult',
33
- :'supplier_references' => :'CartItemSupplierReferences'
34
- }
35
- end
36
-
37
- # List of attributes with nullable: true
38
- def self.openapi_nullable
39
- Set.new([
40
- ])
41
- end
42
-
43
- # Initializes the object
44
- # @param [Hash] attributes Model attributes in the form of hash
45
- def initialize(attributes = {})
46
- if (!attributes.is_a?(Hash))
47
- fail ArgumentError, "The input argument (attributes) must be a hash in `CartItemResult` initialize method"
48
- end
49
-
50
- # check to see if the attribute exists and convert string to symbol for hash key
51
- attributes = attributes.each_with_object({}) { |(k, v), h|
52
- if (!self.class.attribute_map.key?(k.to_sym))
53
- fail ArgumentError, "`#{k}` is not a valid attribute in `CartItemResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
- end
55
- h[k.to_sym] = v
56
- }
57
-
58
- if attributes.key?(:'invoice_data')
59
- self.invoice_data = attributes[:'invoice_data']
60
- end
61
-
62
- if attributes.key?(:'order_line_details')
63
- self.order_line_details = attributes[:'order_line_details']
64
- end
65
-
66
- if attributes.key?(:'supplier_references')
67
- self.supplier_references = attributes[:'supplier_references']
68
- end
69
- end
70
-
71
- # Checks equality by comparing each attribute.
72
- # @param [Object] Object to be compared
73
- def ==(o)
74
- return true if self.equal?(o)
75
- self.class == o.class &&
76
- invoice_data == o.invoice_data &&
77
- order_line_details == o.order_line_details &&
78
- supplier_references == o.supplier_references
79
- end
80
-
81
- # @see the `==` method
82
- # @param [Object] Object to be compared
83
- def eql?(o)
84
- self == o
85
- end
86
-
87
- # Calculates hash code according to all attributes.
88
- # @return [Integer] Hash code
89
- def hash
90
- [invoice_data, order_line_details, supplier_references].hash
91
- end
92
-
93
- # Builds the object from hash
94
- # @param [Hash] attributes Model attributes in the form of hash
95
- # @return [Object] Returns the model itself
96
- def self.build_from_hash(attributes)
97
- return nil unless attributes.is_a?(Hash)
98
- attributes = attributes.transform_keys(&:to_sym)
99
- transformed_hash = {}
100
- openapi_types.each_pair do |key, type|
101
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
102
- transformed_hash["#{key}"] = nil
103
- elsif type =~ /\AArray<(.*)>/i
104
- # check to ensure the input is an array given that the attribute
105
- # is documented as an array but the input is not
106
- if attributes[attribute_map[key]].is_a?(Array)
107
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
108
- end
109
- elsif !attributes[attribute_map[key]].nil?
110
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
111
- end
112
- end
113
- new(transformed_hash)
114
- end
115
-
116
- # Deserializes the data based on type
117
- # @param string type Data type
118
- # @param string value Value to be deserialized
119
- # @return [Object] Deserialized data
120
- def self._deserialize(type, value)
121
- case type.to_sym
122
- when :Time
123
- Time.parse(value)
124
- when :Date
125
- Date.parse(value)
126
- when :String
127
- value.to_s
128
- when :Integer
129
- value.to_i
130
- when :Float
131
- value.to_f
132
- when :Boolean
133
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
134
- true
135
- else
136
- false
137
- end
138
- when :Object
139
- # generic object (usually a Hash), return directly
140
- value
141
- when /\AArray<(?<inner_type>.+)>\z/
142
- inner_type = Regexp.last_match[:inner_type]
143
- value.map { |v| _deserialize(inner_type, v) }
144
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
145
- k_type = Regexp.last_match[:k_type]
146
- v_type = Regexp.last_match[:v_type]
147
- {}.tap do |hash|
148
- value.each do |k, v|
149
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
150
- end
151
- end
152
- else # model
153
- # models (e.g. Pet) or oneOf
154
- klass = PCPServerSDK::Models.const_get(type)
155
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
156
- end
157
- end
158
-
159
- # Returns the string representation of the object
160
- # @return [String] String presentation of the object
161
- def to_s
162
- to_hash.to_s
163
- end
164
-
165
- # to_body is an alias to to_hash (backward compatibility)
166
- # @return [Hash] Returns the object in the form of hash
167
- def to_body
168
- to_hash
169
- end
170
-
171
- # Returns the object in the form of hash
172
- # @return [Hash] Returns the object in the form of hash
173
- def to_hash
174
- hash = {}
175
- self.class.attribute_map.each_pair do |attr, param|
176
- value = self.send(attr)
177
- if value.nil?
178
- is_nullable = self.class.openapi_nullable.include?(attr)
179
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
180
- end
181
-
182
- hash[param] = _to_hash(value)
183
- end
184
- hash
185
- end
186
-
187
- # Outputs non-array value in the form of hash
188
- # For object, use to_hash. Otherwise, just return the value
189
- # @param [Object] value Any valid value
190
- # @return [Hash] Returns the value in the form of hash
191
- def _to_hash(value)
192
- if value.is_a?(Array)
193
- value.compact.map { |v| _to_hash(v) }
194
- elsif value.is_a?(Hash)
195
- {}.tap do |hash|
196
- value.each { |k, v| hash[k] = _to_hash(v) }
197
- end
198
- elsif value.respond_to? :to_hash
199
- value.to_hash
200
- else
201
- value
202
- end
203
- end
5
+ class CartItemResult < ModelBase
6
+ attribute :invoice_data, :invoiceData, :CartItemInvoiceData
7
+ attribute :order_line_details, :orderLineDetails, :OrderLineDetailsResult
8
+ attribute :supplier_references, :supplierReferences, :CartItemSupplierReferences
204
9
  end
205
10
  end
206
11
  end