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,287 +1,27 @@
1
-
2
- require 'date'
3
- require 'time'
1
+ require_relative 'model_base'
4
2
 
5
3
  module PCPServerSDK
6
4
  module Models
7
- class InstallmentOption
5
+ class InstallmentOption < ModelBase
8
6
  # Installment option Identifier. Use this in the Complete Payment for the selected installment option.
9
- attr_accessor :installment_option_id
10
-
7
+ attribute :installment_option_id, :installmentOptionId, :String
11
8
  # The number of monthly payments for this installment.
12
- attr_accessor :number_of_payments
13
-
9
+ attribute :number_of_payments, :numberOfPayments, :Integer
14
10
  # Monthly rate amount.
15
- attr_accessor :monthly_amount
16
-
11
+ attribute :monthly_amount, :monthlyAmount, :AmountOfMoney
17
12
  # Last rate amount.
18
- attr_accessor :last_rate_amount
19
-
13
+ attribute :last_rate_amount, :lastRateAmount, :AmountOfMoney
20
14
  # Effective interest amount in percent with two decimals.
21
- attr_accessor :effective_interest_rate
22
-
15
+ attribute :effective_interest_rate, :effectiveInterestRate, :Integer
23
16
  # Nominal interest amount in percent with two decimals.
24
- attr_accessor :nominal_interest_rate
25
-
17
+ attribute :nominal_interest_rate, :nominalInterestRate, :Integer
26
18
  # Total rate amount.
27
- attr_accessor :total_amount
28
-
29
- # Due date of first rate. Format: YYYYMMDD
30
- attr_accessor :first_rate_date
31
-
19
+ attribute :total_amount, :totalAmount, :AmountOfMoney
20
+ # Due date of first rate.
21
+ # Format: YYYYMMDD
22
+ attribute :first_rate_date, :firstRateDate, :String
32
23
  # Link with credit information.
33
- attr_accessor :credit_information
34
-
35
- # Attribute mapping from ruby-style variable name to JSON key.
36
- def self.attribute_map
37
- {
38
- :'installment_option_id' => :'installmentOptionId',
39
- :'number_of_payments' => :'numberOfPayments',
40
- :'monthly_amount' => :'monthlyAmount',
41
- :'last_rate_amount' => :'lastRateAmount',
42
- :'effective_interest_rate' => :'effectiveInterestRate',
43
- :'nominal_interest_rate' => :'nominalInterestRate',
44
- :'total_amount' => :'totalAmount',
45
- :'first_rate_date' => :'firstRateDate',
46
- :'credit_information' => :'creditInformation'
47
- }
48
- end
49
-
50
- # Returns all the JSON keys this model knows about
51
- def self.acceptable_attributes
52
- attribute_map.values
53
- end
54
-
55
- # Attribute type mapping.
56
- def self.openapi_types
57
- {
58
- :'installment_option_id' => :'String',
59
- :'number_of_payments' => :'Integer',
60
- :'monthly_amount' => :'AmountOfMoney',
61
- :'last_rate_amount' => :'AmountOfMoney',
62
- :'effective_interest_rate' => :'Integer',
63
- :'nominal_interest_rate' => :'Integer',
64
- :'total_amount' => :'AmountOfMoney',
65
- :'first_rate_date' => :'String',
66
- :'credit_information' => :'LinkInformation'
67
- }
68
- end
69
-
70
- # List of attributes with nullable: true
71
- def self.openapi_nullable
72
- Set.new([
73
- ])
74
- end
75
-
76
- # Initializes the object
77
- # @param [Hash] attributes Model attributes in the form of hash
78
- def initialize(attributes = {})
79
- if (!attributes.is_a?(Hash))
80
- fail ArgumentError, "The input argument (attributes) must be a hash in `InstallmentOption` initialize method"
81
- end
82
-
83
- # check to see if the attribute exists and convert string to symbol for hash key
84
- attributes = attributes.each_with_object({}) { |(k, v), h|
85
- if (!self.class.attribute_map.key?(k.to_sym))
86
- fail ArgumentError, "`#{k}` is not a valid attribute in `InstallmentOption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
- end
88
- h[k.to_sym] = v
89
- }
90
-
91
- if attributes.key?(:'installment_option_id')
92
- self.installment_option_id = attributes[:'installment_option_id']
93
- else
94
- self.installment_option_id = nil
95
- end
96
-
97
- if attributes.key?(:'number_of_payments')
98
- self.number_of_payments = attributes[:'number_of_payments']
99
- else
100
- self.number_of_payments = nil
101
- end
102
-
103
- if attributes.key?(:'monthly_amount')
104
- self.monthly_amount = attributes[:'monthly_amount']
105
- else
106
- self.monthly_amount = nil
107
- end
108
-
109
- if attributes.key?(:'last_rate_amount')
110
- self.last_rate_amount = attributes[:'last_rate_amount']
111
- else
112
- self.last_rate_amount = nil
113
- end
114
-
115
- if attributes.key?(:'effective_interest_rate')
116
- self.effective_interest_rate = attributes[:'effective_interest_rate']
117
- else
118
- self.effective_interest_rate = nil
119
- end
120
-
121
- if attributes.key?(:'nominal_interest_rate')
122
- self.nominal_interest_rate = attributes[:'nominal_interest_rate']
123
- else
124
- self.nominal_interest_rate = nil
125
- end
126
-
127
- if attributes.key?(:'total_amount')
128
- self.total_amount = attributes[:'total_amount']
129
- else
130
- self.total_amount = nil
131
- end
132
-
133
- if attributes.key?(:'first_rate_date')
134
- self.first_rate_date = attributes[:'first_rate_date']
135
- else
136
- self.first_rate_date = nil
137
- end
138
-
139
- if attributes.key?(:'credit_information')
140
- self.credit_information = attributes[:'credit_information']
141
- else
142
- self.credit_information = nil
143
- end
144
- end
145
-
146
- # Checks equality by comparing each attribute.
147
- # @param [Object] Object to be compared
148
- def ==(o)
149
- return true if self.equal?(o)
150
- self.class == o.class &&
151
- installment_option_id == o.installment_option_id &&
152
- number_of_payments == o.number_of_payments &&
153
- monthly_amount == o.monthly_amount &&
154
- last_rate_amount == o.last_rate_amount &&
155
- effective_interest_rate == o.effective_interest_rate &&
156
- nominal_interest_rate == o.nominal_interest_rate &&
157
- total_amount == o.total_amount &&
158
- first_rate_date == o.first_rate_date &&
159
- credit_information == o.credit_information
160
- end
161
-
162
- # @see the `==` method
163
- # @param [Object] Object to be compared
164
- def eql?(o)
165
- self == o
166
- end
167
-
168
- # Calculates hash code according to all attributes.
169
- # @return [Integer] Hash code
170
- def hash
171
- [installment_option_id, number_of_payments, monthly_amount, last_rate_amount, effective_interest_rate, nominal_interest_rate, total_amount, first_rate_date, credit_information].hash
172
- end
173
-
174
- # Builds the object from hash
175
- # @param [Hash] attributes Model attributes in the form of hash
176
- # @return [Object] Returns the model itself
177
- def self.build_from_hash(attributes)
178
- return nil unless attributes.is_a?(Hash)
179
- attributes = attributes.transform_keys(&:to_sym)
180
- transformed_hash = {}
181
- openapi_types.each_pair do |key, type|
182
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
183
- transformed_hash["#{key}"] = nil
184
- elsif type =~ /\AArray<(.*)>/i
185
- # check to ensure the input is an array given that the attribute
186
- # is documented as an array but the input is not
187
- if attributes[attribute_map[key]].is_a?(Array)
188
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
189
- end
190
- elsif !attributes[attribute_map[key]].nil?
191
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
192
- end
193
- end
194
- new(transformed_hash)
195
- end
196
-
197
- # Deserializes the data based on type
198
- # @param string type Data type
199
- # @param string value Value to be deserialized
200
- # @return [Object] Deserialized data
201
- def self._deserialize(type, value)
202
- case type.to_sym
203
- when :Time
204
- Time.parse(value)
205
- when :Date
206
- Date.parse(value)
207
- when :String
208
- value.to_s
209
- when :Integer
210
- value.to_i
211
- when :Float
212
- value.to_f
213
- when :Boolean
214
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
215
- true
216
- else
217
- false
218
- end
219
- when :Object
220
- # generic object (usually a Hash), return directly
221
- value
222
- when /\AArray<(?<inner_type>.+)>\z/
223
- inner_type = Regexp.last_match[:inner_type]
224
- value.map { |v| _deserialize(inner_type, v) }
225
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
226
- k_type = Regexp.last_match[:k_type]
227
- v_type = Regexp.last_match[:v_type]
228
- {}.tap do |hash|
229
- value.each do |k, v|
230
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
231
- end
232
- end
233
- else # model
234
- # models (e.g. Pet) or oneOf
235
- klass = PCPServerSDK::Models.const_get(type)
236
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
237
- end
238
- end
239
-
240
- # Returns the string representation of the object
241
- # @return [String] String presentation of the object
242
- def to_s
243
- to_hash.to_s
244
- end
245
-
246
- # to_body is an alias to to_hash (backward compatibility)
247
- # @return [Hash] Returns the object in the form of hash
248
- def to_body
249
- to_hash
250
- end
251
-
252
- # Returns the object in the form of hash
253
- # @return [Hash] Returns the object in the form of hash
254
- def to_hash
255
- hash = {}
256
- self.class.attribute_map.each_pair do |attr, param|
257
- value = self.send(attr)
258
- if value.nil?
259
- is_nullable = self.class.openapi_nullable.include?(attr)
260
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
- end
262
-
263
- hash[param] = _to_hash(value)
264
- end
265
- hash
266
- end
267
-
268
- # Outputs non-array value in the form of hash
269
- # For object, use to_hash. Otherwise, just return the value
270
- # @param [Object] value Any valid value
271
- # @return [Hash] Returns the value in the form of hash
272
- def _to_hash(value)
273
- if value.is_a?(Array)
274
- value.compact.map { |v| _to_hash(v) }
275
- elsif value.is_a?(Hash)
276
- {}.tap do |hash|
277
- value.each { |k, v| hash[k] = _to_hash(v) }
278
- end
279
- elsif value.respond_to? :to_hash
280
- value.to_hash
281
- else
282
- value
283
- end
284
- end
24
+ attribute :credit_information, :creditInformation, :LinkInformation
285
25
  end
286
26
  end
287
27
  end
@@ -1,204 +1,12 @@
1
+ require_relative 'model_base'
1
2
 
2
- require 'date'
3
- require 'time'
4
-
5
- # URL and content type information for an web resource.
6
3
  module PCPServerSDK
7
4
  module Models
8
- class LinkInformation
5
+ class LinkInformation < ModelBase
9
6
  # URL of link.
10
- attr_accessor :href
11
-
7
+ attribute :href, :href, :String
12
8
  # Content type of linked data.
13
- attr_accessor :type
14
-
15
- # Attribute mapping from ruby-style variable name to JSON key.
16
- def self.attribute_map
17
- {
18
- :'href' => :'href',
19
- :'type' => :'type'
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
- :'href' => :'String',
32
- :'type' => :'String'
33
- }
34
- end
35
-
36
- # List of attributes with nullable: true
37
- def self.openapi_nullable
38
- Set.new([
39
- ])
40
- end
41
-
42
- # Initializes the object
43
- # @param [Hash] attributes Model attributes in the form of hash
44
- def initialize(attributes = {})
45
- if (!attributes.is_a?(Hash))
46
- fail ArgumentError, "The input argument (attributes) must be a hash in `LinkInformation` initialize method"
47
- end
48
-
49
- # check to see if the attribute exists and convert string to symbol for hash key
50
- attributes = attributes.each_with_object({}) { |(k, v), h|
51
- if (!self.class.attribute_map.key?(k.to_sym))
52
- fail ArgumentError, "`#{k}` is not a valid attribute in `LinkInformation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
- end
54
- h[k.to_sym] = v
55
- }
56
-
57
- if attributes.key?(:'href')
58
- self.href = attributes[:'href']
59
- else
60
- self.href = nil
61
- end
62
-
63
- if attributes.key?(:'type')
64
- self.type = attributes[:'type']
65
- else
66
- self.type = nil
67
- end
68
- end
69
-
70
- # Checks equality by comparing each attribute.
71
- # @param [Object] Object to be compared
72
- def ==(o)
73
- return true if self.equal?(o)
74
- self.class == o.class &&
75
- href == o.href &&
76
- type == o.type
77
- end
78
-
79
- # @see the `==` method
80
- # @param [Object] Object to be compared
81
- def eql?(o)
82
- self == o
83
- end
84
-
85
- # Calculates hash code according to all attributes.
86
- # @return [Integer] Hash code
87
- def hash
88
- [href, type].hash
89
- end
90
-
91
- # Builds the object from hash
92
- # @param [Hash] attributes Model attributes in the form of hash
93
- # @return [Object] Returns the model itself
94
- def self.build_from_hash(attributes)
95
- return nil unless attributes.is_a?(Hash)
96
- attributes = attributes.transform_keys(&:to_sym)
97
- transformed_hash = {}
98
- openapi_types.each_pair do |key, type|
99
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
100
- transformed_hash["#{key}"] = nil
101
- elsif type =~ /\AArray<(.*)>/i
102
- # check to ensure the input is an array given that the attribute
103
- # is documented as an array but the input is not
104
- if attributes[attribute_map[key]].is_a?(Array)
105
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
106
- end
107
- elsif !attributes[attribute_map[key]].nil?
108
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
109
- end
110
- end
111
- new(transformed_hash)
112
- end
113
-
114
- # Deserializes the data based on type
115
- # @param string type Data type
116
- # @param string value Value to be deserialized
117
- # @return [Object] Deserialized data
118
- def self._deserialize(type, value)
119
- case type.to_sym
120
- when :Time
121
- Time.parse(value)
122
- when :Date
123
- Date.parse(value)
124
- when :String
125
- value.to_s
126
- when :Integer
127
- value.to_i
128
- when :Float
129
- value.to_f
130
- when :Boolean
131
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
132
- true
133
- else
134
- false
135
- end
136
- when :Object
137
- # generic object (usually a Hash), return directly
138
- value
139
- when /\AArray<(?<inner_type>.+)>\z/
140
- inner_type = Regexp.last_match[:inner_type]
141
- value.map { |v| _deserialize(inner_type, v) }
142
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
143
- k_type = Regexp.last_match[:k_type]
144
- v_type = Regexp.last_match[:v_type]
145
- {}.tap do |hash|
146
- value.each do |k, v|
147
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
148
- end
149
- end
150
- else # model
151
- # models (e.g. Pet) or oneOf
152
- klass = PCPServerSDK::Models.const_get(type)
153
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
154
- end
155
- end
156
-
157
- # Returns the string representation of the object
158
- # @return [String] String presentation of the object
159
- def to_s
160
- to_hash.to_s
161
- end
162
-
163
- # to_body is an alias to to_hash (backward compatibility)
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_body
166
- to_hash
167
- end
168
-
169
- # Returns the object in the form of hash
170
- # @return [Hash] Returns the object in the form of hash
171
- def to_hash
172
- hash = {}
173
- self.class.attribute_map.each_pair do |attr, param|
174
- value = self.send(attr)
175
- if value.nil?
176
- is_nullable = self.class.openapi_nullable.include?(attr)
177
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
178
- end
179
-
180
- hash[param] = _to_hash(value)
181
- end
182
- hash
183
- end
184
-
185
- # Outputs non-array value in the form of hash
186
- # For object, use to_hash. Otherwise, just return the value
187
- # @param [Object] value Any valid value
188
- # @return [Hash] Returns the value in the form of hash
189
- def _to_hash(value)
190
- if value.is_a?(Array)
191
- value.compact.map { |v| _to_hash(v) }
192
- elsif value.is_a?(Hash)
193
- {}.tap do |hash|
194
- value.each { |k, v| hash[k] = _to_hash(v) }
195
- end
196
- elsif value.respond_to? :to_hash
197
- value.to_hash
198
- else
199
- value
200
- end
201
- end
9
+ attribute :type, :type, :String
202
10
  end
203
11
  end
204
12
  end