conekta 6.0.2 → 6.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1 -1
  3. data/README.md +17 -5
  4. data/VERSION +1 -1
  5. data/conekta.gemspec +2 -1
  6. data/config-ruby.json +1 -1
  7. data/docs/CheckoutRequest.md +2 -0
  8. data/docs/EventTypes.md +15 -0
  9. data/docs/OrderResponseCheckout.md +2 -0
  10. data/docs/OrdersApi.md +15 -1
  11. data/docs/Payout.md +18 -0
  12. data/docs/PayoutMethod.md +18 -0
  13. data/docs/PayoutOrder.md +30 -0
  14. data/docs/PayoutOrderPayoutsItem.md +32 -0
  15. data/docs/PayoutOrderResponse.md +44 -0
  16. data/docs/PayoutOrderResponseCustomerInfo.md +30 -0
  17. data/docs/PayoutOrdersApi.md +235 -0
  18. data/docs/PayoutOrdersResponse.md +26 -0
  19. data/docs/Product.md +1 -1
  20. data/docs/ProductDataResponse.md +1 -1
  21. data/docs/ProductOrderResponse.md +1 -1
  22. data/docs/WebhooksApi.md +2 -0
  23. data/lib/conekta/api/antifraud_api.rb +1 -1
  24. data/lib/conekta/api/api_keys_api.rb +1 -1
  25. data/lib/conekta/api/balances_api.rb +1 -1
  26. data/lib/conekta/api/charges_api.rb +1 -1
  27. data/lib/conekta/api/companies_api.rb +1 -1
  28. data/lib/conekta/api/customers_api.rb +1 -1
  29. data/lib/conekta/api/discounts_api.rb +1 -1
  30. data/lib/conekta/api/events_api.rb +1 -1
  31. data/lib/conekta/api/logs_api.rb +1 -1
  32. data/lib/conekta/api/orders_api.rb +22 -1
  33. data/lib/conekta/api/payment_link_api.rb +1 -1
  34. data/lib/conekta/api/payment_methods_api.rb +1 -1
  35. data/lib/conekta/api/payout_orders_api.rb +251 -0
  36. data/lib/conekta/api/plans_api.rb +1 -1
  37. data/lib/conekta/api/products_api.rb +1 -1
  38. data/lib/conekta/api/shipping_contacts_api.rb +1 -1
  39. data/lib/conekta/api/shippings_api.rb +1 -1
  40. data/lib/conekta/api/subscriptions_api.rb +1 -1
  41. data/lib/conekta/api/taxes_api.rb +1 -1
  42. data/lib/conekta/api/tokens_api.rb +1 -1
  43. data/lib/conekta/api/transactions_api.rb +1 -1
  44. data/lib/conekta/api/transfers_api.rb +1 -1
  45. data/lib/conekta/api/webhook_keys_api.rb +1 -1
  46. data/lib/conekta/api/webhooks_api.rb +4 -1
  47. data/lib/conekta/api_client.rb +3 -3
  48. data/lib/conekta/api_error.rb +1 -1
  49. data/lib/conekta/configuration.rb +1 -1
  50. data/lib/conekta/models/api_key_create_response.rb +1 -1
  51. data/lib/conekta/models/api_key_request.rb +1 -1
  52. data/lib/conekta/models/api_key_response.rb +1 -1
  53. data/lib/conekta/models/api_key_response_on_delete.rb +1 -1
  54. data/lib/conekta/models/api_key_update_request.rb +1 -1
  55. data/lib/conekta/models/balance_common_field.rb +1 -1
  56. data/lib/conekta/models/balance_response.rb +1 -1
  57. data/lib/conekta/models/blacklist_rule_response.rb +1 -1
  58. data/lib/conekta/models/charge_order_response.rb +1 -1
  59. data/lib/conekta/models/charge_order_response_payment_method.rb +1 -1
  60. data/lib/conekta/models/charge_request.rb +1 -1
  61. data/lib/conekta/models/charge_request_payment_method.rb +1 -1
  62. data/lib/conekta/models/charge_response.rb +1 -1
  63. data/lib/conekta/models/charge_response_channel.rb +1 -1
  64. data/lib/conekta/models/charge_response_payment_method.rb +1 -1
  65. data/lib/conekta/models/charge_response_refunds.rb +1 -1
  66. data/lib/conekta/models/charge_response_refunds_data.rb +1 -1
  67. data/lib/conekta/models/charge_update_request.rb +1 -1
  68. data/lib/conekta/models/charges_data_response.rb +1 -1
  69. data/lib/conekta/models/checkout.rb +1 -1
  70. data/lib/conekta/models/checkout_order_template.rb +1 -1
  71. data/lib/conekta/models/checkout_order_template_customer_info.rb +2 -2
  72. data/lib/conekta/models/checkout_request.rb +12 -2
  73. data/lib/conekta/models/checkout_response.rb +1 -1
  74. data/lib/conekta/models/checkouts_response.rb +1 -1
  75. data/lib/conekta/models/company_fiscal_info_address_response.rb +1 -1
  76. data/lib/conekta/models/company_fiscal_info_response.rb +1 -1
  77. data/lib/conekta/models/company_payout_destination_response.rb +1 -1
  78. data/lib/conekta/models/company_response.rb +1 -1
  79. data/lib/conekta/models/create_customer_fiscal_entities_response.rb +1 -1
  80. data/lib/conekta/models/create_customer_payment_methods_request.rb +2 -2
  81. data/lib/conekta/models/create_customer_payment_methods_response.rb +1 -1
  82. data/lib/conekta/models/create_risk_rules_data.rb +1 -1
  83. data/lib/conekta/models/customer.rb +1 -1
  84. data/lib/conekta/models/customer_address.rb +1 -1
  85. data/lib/conekta/models/customer_antifraud_info.rb +1 -1
  86. data/lib/conekta/models/customer_antifraud_info_response.rb +1 -1
  87. data/lib/conekta/models/customer_fiscal_entities_data_response.rb +1 -1
  88. data/lib/conekta/models/customer_fiscal_entities_request.rb +1 -1
  89. data/lib/conekta/models/customer_fiscal_entities_response.rb +1 -1
  90. data/lib/conekta/models/customer_info.rb +1 -1
  91. data/lib/conekta/models/customer_info_just_customer_id.rb +1 -1
  92. data/lib/conekta/models/customer_info_just_customer_id_response.rb +1 -1
  93. data/lib/conekta/models/customer_payment_method_request.rb +1 -1
  94. data/lib/conekta/models/customer_payment_methods_data.rb +1 -1
  95. data/lib/conekta/models/customer_payment_methods_request.rb +2 -2
  96. data/lib/conekta/models/customer_payment_methods_response.rb +1 -1
  97. data/lib/conekta/models/customer_response.rb +1 -1
  98. data/lib/conekta/models/customer_response_shipping_contacts.rb +1 -1
  99. data/lib/conekta/models/customer_shipping_contacts.rb +1 -1
  100. data/lib/conekta/models/customer_shipping_contacts_address.rb +1 -1
  101. data/lib/conekta/models/customer_shipping_contacts_data_response.rb +1 -1
  102. data/lib/conekta/models/customer_shipping_contacts_response.rb +1 -1
  103. data/lib/conekta/models/customer_shipping_contacts_response_address.rb +1 -1
  104. data/lib/conekta/models/customer_update_fiscal_entities_request.rb +1 -1
  105. data/lib/conekta/models/customer_update_shipping_contacts.rb +1 -1
  106. data/lib/conekta/models/customers_response.rb +1 -1
  107. data/lib/conekta/models/delete_api_keys_response.rb +1 -1
  108. data/lib/conekta/models/deleted_blacklist_rule_response.rb +1 -1
  109. data/lib/conekta/models/deleted_whitelist_rule_response.rb +1 -1
  110. data/lib/conekta/models/details.rb +1 -1
  111. data/lib/conekta/models/details_error.rb +1 -1
  112. data/lib/conekta/models/discount_lines_data_response.rb +1 -1
  113. data/lib/conekta/models/discount_lines_response.rb +1 -1
  114. data/lib/conekta/models/email_checkout_request.rb +1 -1
  115. data/lib/conekta/models/error.rb +1 -1
  116. data/lib/conekta/models/event_response.rb +1 -1
  117. data/lib/conekta/models/event_types.rb +43 -0
  118. data/lib/conekta/models/events_resend_response.rb +1 -1
  119. data/lib/conekta/models/fiscal_entity_address.rb +1 -1
  120. data/lib/conekta/models/get_api_keys_response.rb +1 -1
  121. data/lib/conekta/models/get_charges_response.rb +1 -1
  122. data/lib/conekta/models/get_companies_response.rb +1 -1
  123. data/lib/conekta/models/get_customer_payment_method_data_response.rb +1 -1
  124. data/lib/conekta/models/get_events_response.rb +1 -1
  125. data/lib/conekta/models/get_order_discount_lines_response.rb +1 -1
  126. data/lib/conekta/models/get_orders_response.rb +1 -1
  127. data/lib/conekta/models/get_payment_method_response.rb +1 -1
  128. data/lib/conekta/models/get_plans_response.rb +1 -1
  129. data/lib/conekta/models/get_transactions_response.rb +1 -1
  130. data/lib/conekta/models/get_transfers_response.rb +1 -1
  131. data/lib/conekta/models/get_webhook_keys_response.rb +1 -1
  132. data/lib/conekta/models/get_webhooks_response.rb +1 -1
  133. data/lib/conekta/models/log_response.rb +1 -1
  134. data/lib/conekta/models/logs_response.rb +1 -1
  135. data/lib/conekta/models/logs_response_data.rb +1 -1
  136. data/lib/conekta/models/order_capture_request.rb +1 -1
  137. data/lib/conekta/models/order_customer_info_response.rb +1 -1
  138. data/lib/conekta/models/order_discount_lines_request.rb +1 -1
  139. data/lib/conekta/models/order_fiscal_entity_address_response.rb +1 -1
  140. data/lib/conekta/models/order_fiscal_entity_request.rb +1 -1
  141. data/lib/conekta/models/order_fiscal_entity_response.rb +1 -1
  142. data/lib/conekta/models/order_next_action_response.rb +1 -1
  143. data/lib/conekta/models/order_next_action_response_redirect_to_url.rb +1 -1
  144. data/lib/conekta/models/order_refund_request.rb +1 -1
  145. data/lib/conekta/models/order_request.rb +1 -1
  146. data/lib/conekta/models/order_request_customer_info.rb +2 -2
  147. data/lib/conekta/models/order_response.rb +1 -1
  148. data/lib/conekta/models/order_response_charges.rb +1 -1
  149. data/lib/conekta/models/order_response_checkout.rb +13 -2
  150. data/lib/conekta/models/order_response_customer_info.rb +1 -1
  151. data/lib/conekta/models/order_response_discount_lines.rb +1 -1
  152. data/lib/conekta/models/order_response_products.rb +1 -1
  153. data/lib/conekta/models/order_response_shipping_contact.rb +1 -1
  154. data/lib/conekta/models/order_tax_request.rb +1 -1
  155. data/lib/conekta/models/order_update_fiscal_entity_request.rb +1 -1
  156. data/lib/conekta/models/order_update_request.rb +1 -1
  157. data/lib/conekta/models/order_update_request_customer_info.rb +2 -2
  158. data/lib/conekta/models/orders_response.rb +1 -1
  159. data/lib/conekta/models/page.rb +1 -1
  160. data/lib/conekta/models/pagination.rb +1 -1
  161. data/lib/conekta/models/payment_method.rb +1 -1
  162. data/lib/conekta/models/payment_method_bank_transfer.rb +1 -1
  163. data/lib/conekta/models/payment_method_card.rb +1 -1
  164. data/lib/conekta/models/payment_method_card_request.rb +1 -1
  165. data/lib/conekta/models/payment_method_card_response.rb +1 -1
  166. data/lib/conekta/models/payment_method_cash.rb +1 -1
  167. data/lib/conekta/models/payment_method_cash_request.rb +1 -1
  168. data/lib/conekta/models/payment_method_cash_response.rb +1 -1
  169. data/lib/conekta/models/payment_method_response.rb +1 -1
  170. data/lib/conekta/models/payment_method_spei_recurrent.rb +1 -1
  171. data/lib/conekta/models/payment_method_spei_request.rb +1 -1
  172. data/lib/conekta/models/payout.rb +222 -0
  173. data/lib/conekta/models/payout_method.rb +223 -0
  174. data/lib/conekta/models/payout_order.rb +339 -0
  175. data/lib/conekta/models/payout_order_payouts_item.rb +320 -0
  176. data/lib/conekta/models/payout_order_response.rb +466 -0
  177. data/lib/conekta/models/payout_order_response_customer_info.rb +288 -0
  178. data/lib/conekta/models/payout_orders_response.rb +280 -0
  179. data/lib/conekta/models/plan_request.rb +1 -1
  180. data/lib/conekta/models/plan_response.rb +1 -1
  181. data/lib/conekta/models/plan_update_request.rb +1 -1
  182. data/lib/conekta/models/product.rb +2 -2
  183. data/lib/conekta/models/product_data_response.rb +2 -2
  184. data/lib/conekta/models/product_order_response.rb +2 -2
  185. data/lib/conekta/models/risk_rules_data.rb +1 -1
  186. data/lib/conekta/models/risk_rules_list.rb +1 -1
  187. data/lib/conekta/models/shipping_order_response.rb +1 -1
  188. data/lib/conekta/models/shipping_request.rb +1 -1
  189. data/lib/conekta/models/sms_checkout_request.rb +1 -1
  190. data/lib/conekta/models/subscription_events_response.rb +1 -1
  191. data/lib/conekta/models/subscription_request.rb +1 -1
  192. data/lib/conekta/models/subscription_response.rb +1 -1
  193. data/lib/conekta/models/subscription_update_request.rb +1 -1
  194. data/lib/conekta/models/token.rb +1 -1
  195. data/lib/conekta/models/token_card.rb +1 -1
  196. data/lib/conekta/models/token_checkout.rb +1 -1
  197. data/lib/conekta/models/token_response.rb +1 -1
  198. data/lib/conekta/models/token_response_checkout.rb +1 -1
  199. data/lib/conekta/models/transaction_response.rb +1 -1
  200. data/lib/conekta/models/transfer_destination_response.rb +1 -1
  201. data/lib/conekta/models/transfer_method_response.rb +1 -1
  202. data/lib/conekta/models/transfer_response.rb +1 -1
  203. data/lib/conekta/models/transfers_response.rb +1 -1
  204. data/lib/conekta/models/update_customer.rb +1 -1
  205. data/lib/conekta/models/update_customer_antifraud_info.rb +1 -1
  206. data/lib/conekta/models/update_customer_fiscal_entities_response.rb +1 -1
  207. data/lib/conekta/models/update_customer_payment_methods_response.rb +1 -1
  208. data/lib/conekta/models/update_order_discount_lines_request.rb +1 -1
  209. data/lib/conekta/models/update_order_tax_request.rb +1 -1
  210. data/lib/conekta/models/update_order_tax_response.rb +1 -1
  211. data/lib/conekta/models/update_payment_methods.rb +1 -1
  212. data/lib/conekta/models/update_product.rb +1 -1
  213. data/lib/conekta/models/webhook_key_create_response.rb +1 -1
  214. data/lib/conekta/models/webhook_key_delete_response.rb +1 -1
  215. data/lib/conekta/models/webhook_key_request.rb +1 -1
  216. data/lib/conekta/models/webhook_key_response.rb +1 -1
  217. data/lib/conekta/models/webhook_key_update_request.rb +1 -1
  218. data/lib/conekta/models/webhook_log.rb +1 -1
  219. data/lib/conekta/models/webhook_request.rb +1 -1
  220. data/lib/conekta/models/webhook_response.rb +1 -1
  221. data/lib/conekta/models/webhook_update_request.rb +1 -1
  222. data/lib/conekta/models/whitelistlist_rule_response.rb +1 -1
  223. data/lib/conekta/version.rb +2 -2
  224. data/lib/conekta.rb +10 -1
  225. data/spec/api/payout_orders_api_spec.rb +77 -0
  226. data/spec/spec_helper.rb +1 -1
  227. data/templates/ruby/api_client.mustache +1 -0
  228. metadata +54 -20
@@ -0,0 +1,339 @@
1
+ =begin
2
+ #Conekta API
3
+
4
+ #Conekta sdk
5
+
6
+ The version of the OpenAPI document: 2.1.0
7
+ Contact: engineering@conekta.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Conekta
17
+ # a payout order
18
+ class PayoutOrder
19
+ # The payout methods that are allowed for the payout order.
20
+ attr_accessor :allowed_payout_methods
21
+
22
+ # The amount of the payout order.
23
+ attr_accessor :amount
24
+
25
+ # The currency in which the payout order is made.
26
+ attr_accessor :currency
27
+
28
+ attr_accessor :customer_info
29
+
30
+ # The metadata of the payout order.
31
+ attr_accessor :metadata
32
+
33
+ attr_accessor :payout
34
+
35
+ # The reason for the payout order.
36
+ attr_accessor :reason
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'allowed_payout_methods' => :'allowed_payout_methods',
42
+ :'amount' => :'amount',
43
+ :'currency' => :'currency',
44
+ :'customer_info' => :'customer_info',
45
+ :'metadata' => :'metadata',
46
+ :'payout' => :'payout',
47
+ :'reason' => :'reason'
48
+ }
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'allowed_payout_methods' => :'Array<String>',
60
+ :'amount' => :'Integer',
61
+ :'currency' => :'String',
62
+ :'customer_info' => :'CustomerInfoJustCustomerId',
63
+ :'metadata' => :'Hash<String, Object>',
64
+ :'payout' => :'Payout',
65
+ :'reason' => :'String'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PayoutOrder` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PayoutOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'allowed_payout_methods')
91
+ if (value = attributes[:'allowed_payout_methods']).is_a?(Array)
92
+ self.allowed_payout_methods = value
93
+ end
94
+ else
95
+ self.allowed_payout_methods = nil
96
+ end
97
+
98
+ if attributes.key?(:'amount')
99
+ self.amount = attributes[:'amount']
100
+ else
101
+ self.amount = nil
102
+ end
103
+
104
+ if attributes.key?(:'currency')
105
+ self.currency = attributes[:'currency']
106
+ else
107
+ self.currency = 'MXN'
108
+ end
109
+
110
+ if attributes.key?(:'customer_info')
111
+ self.customer_info = attributes[:'customer_info']
112
+ else
113
+ self.customer_info = nil
114
+ end
115
+
116
+ if attributes.key?(:'metadata')
117
+ if (value = attributes[:'metadata']).is_a?(Hash)
118
+ self.metadata = value
119
+ end
120
+ end
121
+
122
+ if attributes.key?(:'payout')
123
+ self.payout = attributes[:'payout']
124
+ else
125
+ self.payout = nil
126
+ end
127
+
128
+ if attributes.key?(:'reason')
129
+ self.reason = attributes[:'reason']
130
+ else
131
+ self.reason = nil
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
139
+ invalid_properties = Array.new
140
+ if @allowed_payout_methods.nil?
141
+ invalid_properties.push('invalid value for "allowed_payout_methods", allowed_payout_methods cannot be nil.')
142
+ end
143
+
144
+ if @amount.nil?
145
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
146
+ end
147
+
148
+ if @currency.nil?
149
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
150
+ end
151
+
152
+ if @customer_info.nil?
153
+ invalid_properties.push('invalid value for "customer_info", customer_info cannot be nil.')
154
+ end
155
+
156
+ if !@metadata.nil? && @metadata.length > 100
157
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.')
158
+ end
159
+
160
+ if @payout.nil?
161
+ invalid_properties.push('invalid value for "payout", payout cannot be nil.')
162
+ end
163
+
164
+ if @reason.nil?
165
+ invalid_properties.push('invalid value for "reason", reason cannot be nil.')
166
+ end
167
+
168
+ invalid_properties
169
+ end
170
+
171
+ # Check to see if the all the properties in the model are valid
172
+ # @return true if the model is valid
173
+ def valid?
174
+ warn '[DEPRECATED] the `valid?` method is obsolete'
175
+ return false if @allowed_payout_methods.nil?
176
+ return false if @amount.nil?
177
+ return false if @currency.nil?
178
+ return false if @customer_info.nil?
179
+ return false if !@metadata.nil? && @metadata.length > 100
180
+ return false if @payout.nil?
181
+ return false if @reason.nil?
182
+ true
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] metadata Value to be assigned
187
+ def metadata=(metadata)
188
+ if metadata.nil?
189
+ fail ArgumentError, 'metadata cannot be nil'
190
+ end
191
+
192
+ if metadata.length > 100
193
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.'
194
+ end
195
+
196
+ @metadata = metadata
197
+ end
198
+
199
+ # Checks equality by comparing each attribute.
200
+ # @param [Object] Object to be compared
201
+ def ==(o)
202
+ return true if self.equal?(o)
203
+ self.class == o.class &&
204
+ allowed_payout_methods == o.allowed_payout_methods &&
205
+ amount == o.amount &&
206
+ currency == o.currency &&
207
+ customer_info == o.customer_info &&
208
+ metadata == o.metadata &&
209
+ payout == o.payout &&
210
+ reason == o.reason
211
+ end
212
+
213
+ # @see the `==` method
214
+ # @param [Object] Object to be compared
215
+ def eql?(o)
216
+ self == o
217
+ end
218
+
219
+ # Calculates hash code according to all attributes.
220
+ # @return [Integer] Hash code
221
+ def hash
222
+ [allowed_payout_methods, amount, currency, customer_info, metadata, payout, reason].hash
223
+ end
224
+
225
+ # Builds the object from hash
226
+ # @param [Hash] attributes Model attributes in the form of hash
227
+ # @return [Object] Returns the model itself
228
+ def self.build_from_hash(attributes)
229
+ return nil unless attributes.is_a?(Hash)
230
+ attributes = attributes.transform_keys(&:to_sym)
231
+ transformed_hash = {}
232
+ openapi_types.each_pair do |key, type|
233
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
234
+ transformed_hash["#{key}"] = nil
235
+ elsif type =~ /\AArray<(.*)>/i
236
+ # check to ensure the input is an array given that the attribute
237
+ # is documented as an array but the input is not
238
+ if attributes[attribute_map[key]].is_a?(Array)
239
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
240
+ end
241
+ elsif !attributes[attribute_map[key]].nil?
242
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
243
+ end
244
+ end
245
+ new(transformed_hash)
246
+ end
247
+
248
+ # Deserializes the data based on type
249
+ # @param string type Data type
250
+ # @param string value Value to be deserialized
251
+ # @return [Object] Deserialized data
252
+ def self._deserialize(type, value)
253
+ case type.to_sym
254
+ when :Time
255
+ Time.parse(value)
256
+ when :Date
257
+ Date.parse(value)
258
+ when :String
259
+ value.to_s
260
+ when :Integer
261
+ value.to_i
262
+ when :Float
263
+ value.to_f
264
+ when :Boolean
265
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
266
+ true
267
+ else
268
+ false
269
+ end
270
+ when :Object
271
+ # generic object (usually a Hash), return directly
272
+ value
273
+ when /\AArray<(?<inner_type>.+)>\z/
274
+ inner_type = Regexp.last_match[:inner_type]
275
+ value.map { |v| _deserialize(inner_type, v) }
276
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
277
+ k_type = Regexp.last_match[:k_type]
278
+ v_type = Regexp.last_match[:v_type]
279
+ {}.tap do |hash|
280
+ value.each do |k, v|
281
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
282
+ end
283
+ end
284
+ else # model
285
+ # models (e.g. Pet) or oneOf
286
+ klass = Conekta.const_get(type)
287
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
+ end
289
+ end
290
+
291
+ # Returns the string representation of the object
292
+ # @return [String] String presentation of the object
293
+ def to_s
294
+ to_hash.to_s
295
+ end
296
+
297
+ # to_body is an alias to to_hash (backward compatibility)
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_body
300
+ to_hash
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ # Outputs non-array value in the form of hash
320
+ # For object, use to_hash. Otherwise, just return the value
321
+ # @param [Object] value Any valid value
322
+ # @return [Hash] Returns the value in the form of hash
323
+ def _to_hash(value)
324
+ if value.is_a?(Array)
325
+ value.compact.map { |v| _to_hash(v) }
326
+ elsif value.is_a?(Hash)
327
+ {}.tap do |hash|
328
+ value.each { |k, v| hash[k] = _to_hash(v) }
329
+ end
330
+ elsif value.respond_to? :to_hash
331
+ value.to_hash
332
+ else
333
+ value
334
+ end
335
+ end
336
+
337
+ end
338
+
339
+ end
@@ -0,0 +1,320 @@
1
+ =begin
2
+ #Conekta API
3
+
4
+ #Conekta sdk
5
+
6
+ The version of the OpenAPI document: 2.1.0
7
+ Contact: engineering@conekta.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Conekta
17
+ class PayoutOrderPayoutsItem
18
+ # The amount of the payout.
19
+ attr_accessor :amount
20
+
21
+ # The currency in which the payout is made.
22
+ attr_accessor :currency
23
+
24
+ # The expiration date of the payout.
25
+ attr_accessor :expires_at
26
+
27
+ # The id of the payout.
28
+ attr_accessor :id
29
+
30
+ # The live mode of the payout.
31
+ attr_accessor :livemode
32
+
33
+ # The object of the payout.
34
+ attr_accessor :object
35
+
36
+ # The id of the payout order.
37
+ attr_accessor :payout_order_id
38
+
39
+ # The status of the payout.
40
+ attr_accessor :status
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'amount' => :'amount',
46
+ :'currency' => :'currency',
47
+ :'expires_at' => :'expires_at',
48
+ :'id' => :'id',
49
+ :'livemode' => :'livemode',
50
+ :'object' => :'object',
51
+ :'payout_order_id' => :'payout_order_id',
52
+ :'status' => :'status'
53
+ }
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'amount' => :'Integer',
65
+ :'currency' => :'String',
66
+ :'expires_at' => :'Integer',
67
+ :'id' => :'String',
68
+ :'livemode' => :'Boolean',
69
+ :'object' => :'String',
70
+ :'payout_order_id' => :'String',
71
+ :'status' => :'String'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::PayoutOrderPayoutsItem` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::PayoutOrderPayoutsItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'amount')
97
+ self.amount = attributes[:'amount']
98
+ else
99
+ self.amount = nil
100
+ end
101
+
102
+ if attributes.key?(:'currency')
103
+ self.currency = attributes[:'currency']
104
+ else
105
+ self.currency = nil
106
+ end
107
+
108
+ if attributes.key?(:'expires_at')
109
+ self.expires_at = attributes[:'expires_at']
110
+ end
111
+
112
+ if attributes.key?(:'id')
113
+ self.id = attributes[:'id']
114
+ else
115
+ self.id = nil
116
+ end
117
+
118
+ if attributes.key?(:'livemode')
119
+ self.livemode = attributes[:'livemode']
120
+ else
121
+ self.livemode = nil
122
+ end
123
+
124
+ if attributes.key?(:'object')
125
+ self.object = attributes[:'object']
126
+ else
127
+ self.object = nil
128
+ end
129
+
130
+ if attributes.key?(:'payout_order_id')
131
+ self.payout_order_id = attributes[:'payout_order_id']
132
+ end
133
+
134
+ if attributes.key?(:'status')
135
+ self.status = attributes[:'status']
136
+ end
137
+ end
138
+
139
+ # Show invalid properties with the reasons. Usually used together with valid?
140
+ # @return Array for valid properties with the reasons
141
+ def list_invalid_properties
142
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
143
+ invalid_properties = Array.new
144
+ if @amount.nil?
145
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
146
+ end
147
+
148
+ if @currency.nil?
149
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
150
+ end
151
+
152
+ if @id.nil?
153
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
154
+ end
155
+
156
+ if @livemode.nil?
157
+ invalid_properties.push('invalid value for "livemode", livemode cannot be nil.')
158
+ end
159
+
160
+ if @object.nil?
161
+ invalid_properties.push('invalid value for "object", object cannot be nil.')
162
+ end
163
+
164
+ invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ warn '[DEPRECATED] the `valid?` method is obsolete'
171
+ return false if @amount.nil?
172
+ return false if @currency.nil?
173
+ return false if @id.nil?
174
+ return false if @livemode.nil?
175
+ return false if @object.nil?
176
+ true
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ amount == o.amount &&
185
+ currency == o.currency &&
186
+ expires_at == o.expires_at &&
187
+ id == o.id &&
188
+ livemode == o.livemode &&
189
+ object == o.object &&
190
+ payout_order_id == o.payout_order_id &&
191
+ status == o.status
192
+ end
193
+
194
+ # @see the `==` method
195
+ # @param [Object] Object to be compared
196
+ def eql?(o)
197
+ self == o
198
+ end
199
+
200
+ # Calculates hash code according to all attributes.
201
+ # @return [Integer] Hash code
202
+ def hash
203
+ [amount, currency, expires_at, id, livemode, object, payout_order_id, status].hash
204
+ end
205
+
206
+ # Builds the object from hash
207
+ # @param [Hash] attributes Model attributes in the form of hash
208
+ # @return [Object] Returns the model itself
209
+ def self.build_from_hash(attributes)
210
+ return nil unless attributes.is_a?(Hash)
211
+ attributes = attributes.transform_keys(&:to_sym)
212
+ transformed_hash = {}
213
+ openapi_types.each_pair do |key, type|
214
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
215
+ transformed_hash["#{key}"] = nil
216
+ elsif type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[attribute_map[key]].is_a?(Array)
220
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
221
+ end
222
+ elsif !attributes[attribute_map[key]].nil?
223
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
224
+ end
225
+ end
226
+ new(transformed_hash)
227
+ end
228
+
229
+ # Deserializes the data based on type
230
+ # @param string type Data type
231
+ # @param string value Value to be deserialized
232
+ # @return [Object] Deserialized data
233
+ def self._deserialize(type, value)
234
+ case type.to_sym
235
+ when :Time
236
+ Time.parse(value)
237
+ when :Date
238
+ Date.parse(value)
239
+ when :String
240
+ value.to_s
241
+ when :Integer
242
+ value.to_i
243
+ when :Float
244
+ value.to_f
245
+ when :Boolean
246
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
247
+ true
248
+ else
249
+ false
250
+ end
251
+ when :Object
252
+ # generic object (usually a Hash), return directly
253
+ value
254
+ when /\AArray<(?<inner_type>.+)>\z/
255
+ inner_type = Regexp.last_match[:inner_type]
256
+ value.map { |v| _deserialize(inner_type, v) }
257
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
258
+ k_type = Regexp.last_match[:k_type]
259
+ v_type = Regexp.last_match[:v_type]
260
+ {}.tap do |hash|
261
+ value.each do |k, v|
262
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
263
+ end
264
+ end
265
+ else # model
266
+ # models (e.g. Pet) or oneOf
267
+ klass = Conekta.const_get(type)
268
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
269
+ end
270
+ end
271
+
272
+ # Returns the string representation of the object
273
+ # @return [String] String presentation of the object
274
+ def to_s
275
+ to_hash.to_s
276
+ end
277
+
278
+ # to_body is an alias to to_hash (backward compatibility)
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_body
281
+ to_hash
282
+ end
283
+
284
+ # Returns the object in the form of hash
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_hash
287
+ hash = {}
288
+ self.class.attribute_map.each_pair do |attr, param|
289
+ value = self.send(attr)
290
+ if value.nil?
291
+ is_nullable = self.class.openapi_nullable.include?(attr)
292
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
293
+ end
294
+
295
+ hash[param] = _to_hash(value)
296
+ end
297
+ hash
298
+ end
299
+
300
+ # Outputs non-array value in the form of hash
301
+ # For object, use to_hash. Otherwise, just return the value
302
+ # @param [Object] value Any valid value
303
+ # @return [Hash] Returns the value in the form of hash
304
+ def _to_hash(value)
305
+ if value.is_a?(Array)
306
+ value.compact.map { |v| _to_hash(v) }
307
+ elsif value.is_a?(Hash)
308
+ {}.tap do |hash|
309
+ value.each { |k, v| hash[k] = _to_hash(v) }
310
+ end
311
+ elsif value.respond_to? :to_hash
312
+ value.to_hash
313
+ else
314
+ value
315
+ end
316
+ end
317
+
318
+ end
319
+
320
+ end