digital_femsa 1.0.0 → 1.1.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 (166) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +14 -0
  3. data/README.md +28 -33
  4. data/VERSION +1 -1
  5. data/config-ruby.json +1 -1
  6. data/docs/ApiKeyCreateResponse.md +1 -1
  7. data/docs/ApiKeyRequest.md +2 -2
  8. data/docs/ApiKeyResponseOnDelete.md +2 -2
  9. data/docs/ApiKeysApi.md +10 -10
  10. data/docs/BalanceResponse.md +8 -8
  11. data/docs/BalancesApi.md +1 -1
  12. data/docs/ChargeOrderResponse.md +1 -1
  13. data/docs/ChargeOrderResponseChannel.md +24 -0
  14. data/docs/ChargeRequest.md +1 -1
  15. data/docs/ChargeRequestPaymentMethod.md +3 -3
  16. data/docs/ChargeResponse.md +9 -7
  17. data/docs/ChargeResponseChannel.md +3 -3
  18. data/docs/ChargeResponseRefundsData.md +5 -1
  19. data/docs/ChargesApi.md +16 -12
  20. data/docs/ChargesDataResponse.md +9 -7
  21. data/docs/Checkout.md +17 -15
  22. data/docs/CheckoutOrderTemplate.md +3 -3
  23. data/docs/CheckoutResponse.md +1 -1
  24. data/docs/CreateCustomerFiscalEntitiesResponse.md +2 -2
  25. data/docs/Customer.md +13 -19
  26. data/docs/CustomerAddress.md +2 -2
  27. data/docs/CustomerFiscalEntitiesDataResponse.md +2 -2
  28. data/docs/CustomerFiscalEntitiesRequest.md +3 -3
  29. data/docs/CustomerInfo.md +4 -4
  30. data/docs/CustomerPaymentMethodRequest.md +1 -1
  31. data/docs/CustomerResponse.md +17 -21
  32. data/docs/CustomerShippingContactsResponse.md +5 -5
  33. data/docs/CustomersApi.md +15 -15
  34. data/docs/CustomersResponse.md +1 -1
  35. data/docs/DeleteApiKeysResponse.md +1 -1
  36. data/docs/DiscountsApi.md +9 -9
  37. data/docs/EventsApi.md +2 -2
  38. data/docs/EventsResendResponse.md +1 -1
  39. data/docs/GetChargesResponse.md +4 -4
  40. data/docs/GetTransactionsResponse.md +1 -1
  41. data/docs/LogsApi.md +1 -1
  42. data/docs/OrderFiscalEntityRequest.md +4 -4
  43. data/docs/OrderRefundRequest.md +7 -5
  44. data/docs/OrderRequest.md +17 -19
  45. data/docs/OrderResponse.md +37 -35
  46. data/docs/OrderResponseChannel.md +24 -0
  47. data/docs/OrderResponseShippingContact.md +4 -4
  48. data/docs/OrderUpdateFiscalEntityRequest.md +1 -1
  49. data/docs/OrderUpdateRequest.md +19 -15
  50. data/docs/OrdersApi.md +16 -16
  51. data/docs/PaymentLinkApi.md +12 -82
  52. data/docs/PaymentMethodCash.md +4 -4
  53. data/docs/PaymentMethodCashRequest.md +2 -2
  54. data/docs/PaymentMethodsApi.md +5 -5
  55. data/docs/Product.md +10 -12
  56. data/docs/ProductDataResponse.md +9 -11
  57. data/docs/ProductOrderResponse.md +9 -11
  58. data/docs/ProductsApi.md +7 -7
  59. data/docs/ShippingContactsApi.md +9 -9
  60. data/docs/ShippingOrderResponse.md +5 -3
  61. data/docs/ShippingRequest.md +2 -0
  62. data/docs/ShippingsApi.md +7 -7
  63. data/docs/TaxesApi.md +7 -7
  64. data/docs/TransactionResponse.md +20 -14
  65. data/docs/TransactionsApi.md +6 -6
  66. data/docs/TransfersApi.md +10 -10
  67. data/docs/UpdateCustomer.md +17 -21
  68. data/docs/UpdateCustomerFiscalEntitiesResponse.md +2 -2
  69. data/docs/UpdateOrderTaxRequest.md +2 -2
  70. data/docs/UpdateProduct.md +7 -9
  71. data/docs/WebhookKeysApi.md +18 -14
  72. data/docs/WebhooksApi.md +28 -22
  73. data/lib/digital_femsa/api/api_keys_api.rb +8 -8
  74. data/lib/digital_femsa/api/balances_api.rb +2 -2
  75. data/lib/digital_femsa/api/charges_api.rb +13 -9
  76. data/lib/digital_femsa/api/customers_api.rb +12 -12
  77. data/lib/digital_femsa/api/discounts_api.rb +12 -12
  78. data/lib/digital_femsa/api/events_api.rb +4 -4
  79. data/lib/digital_femsa/api/logs_api.rb +2 -2
  80. data/lib/digital_femsa/api/orders_api.rb +20 -20
  81. data/lib/digital_femsa/api/payment_link_api.rb +10 -86
  82. data/lib/digital_femsa/api/payment_methods_api.rb +8 -8
  83. data/lib/digital_femsa/api/products_api.rb +10 -10
  84. data/lib/digital_femsa/api/shipping_contacts_api.rb +8 -8
  85. data/lib/digital_femsa/api/shippings_api.rb +10 -10
  86. data/lib/digital_femsa/api/taxes_api.rb +10 -10
  87. data/lib/digital_femsa/api/transactions_api.rb +6 -6
  88. data/lib/digital_femsa/api/transfers_api.rb +8 -8
  89. data/lib/digital_femsa/api/webhook_keys_api.rb +14 -10
  90. data/lib/digital_femsa/api/webhooks_api.rb +23 -16
  91. data/lib/digital_femsa/api_client.rb +9 -5
  92. data/lib/digital_femsa/models/api_key_create_response.rb +1 -1
  93. data/lib/digital_femsa/models/api_key_request.rb +36 -1
  94. data/lib/digital_femsa/models/balance_response.rb +9 -9
  95. data/lib/digital_femsa/models/charge_order_response.rb +1 -1
  96. data/lib/digital_femsa/models/{order_next_action_response.rb → charge_order_response_channel.rb} +34 -18
  97. data/lib/digital_femsa/models/charge_request_payment_method.rb +3 -2
  98. data/lib/digital_femsa/models/charge_response.rb +15 -4
  99. data/lib/digital_femsa/models/charge_response_refunds_data.rb +23 -4
  100. data/lib/digital_femsa/models/charge_update_request.rb +1 -1
  101. data/lib/digital_femsa/models/charges_data_response.rb +15 -4
  102. data/lib/digital_femsa/models/checkout.rb +97 -81
  103. data/lib/digital_femsa/models/checkout_order_template.rb +4 -4
  104. data/lib/digital_femsa/models/checkout_order_template_customer_info.rb +1 -1
  105. data/lib/digital_femsa/models/checkout_request.rb +1 -1
  106. data/lib/digital_femsa/models/checkout_response.rb +1 -1
  107. data/lib/digital_femsa/models/create_customer_fiscal_entities_response.rb +10 -10
  108. data/lib/digital_femsa/models/customer.rb +57 -95
  109. data/lib/digital_femsa/models/customer_address.rb +7 -0
  110. data/lib/digital_femsa/models/customer_fiscal_entities_data_response.rb +10 -10
  111. data/lib/digital_femsa/models/customer_fiscal_entities_request.rb +13 -13
  112. data/lib/digital_femsa/models/customer_info.rb +13 -20
  113. data/lib/digital_femsa/models/customer_payment_method_request.rb +2 -2
  114. data/lib/digital_femsa/models/customer_payment_sources_inner.rb +104 -0
  115. data/lib/digital_femsa/models/customer_response.rb +122 -113
  116. data/lib/digital_femsa/models/customer_shipping_contacts_response.rb +2 -0
  117. data/lib/digital_femsa/models/customers_response.rb +1 -0
  118. data/lib/digital_femsa/models/events_resend_response.rb +1 -1
  119. data/lib/digital_femsa/models/get_charges_response.rb +21 -21
  120. data/lib/digital_femsa/models/get_transactions_response.rb +1 -1
  121. data/lib/digital_femsa/models/log_response.rb +1 -1
  122. data/lib/digital_femsa/models/logs_response.rb +1 -1
  123. data/lib/digital_femsa/models/order_fiscal_entity_response.rb +1 -1
  124. data/lib/digital_femsa/models/order_refund_request.rb +59 -11
  125. data/lib/digital_femsa/models/order_request.rb +69 -79
  126. data/lib/digital_femsa/models/order_response.rb +187 -119
  127. data/lib/digital_femsa/models/{order_next_action_response_redirect_to_url.rb → order_response_channel.rb} +35 -19
  128. data/lib/digital_femsa/models/order_response_charges.rb +1 -1
  129. data/lib/digital_femsa/models/order_response_checkout.rb +1 -0
  130. data/lib/digital_femsa/models/order_response_customer_info.rb +1 -0
  131. data/lib/digital_femsa/models/order_response_shipping_contact.rb +3 -0
  132. data/lib/digital_femsa/models/order_update_fiscal_entity_request.rb +1 -1
  133. data/lib/digital_femsa/models/order_update_request.rb +106 -65
  134. data/lib/digital_femsa/models/payment_method_cash.rb +1 -1
  135. data/lib/digital_femsa/models/payment_method_cash_request.rb +2 -1
  136. data/lib/digital_femsa/models/product.rb +103 -95
  137. data/lib/digital_femsa/models/product_data_response.rb +103 -95
  138. data/lib/digital_femsa/models/product_order_response.rb +103 -95
  139. data/lib/digital_femsa/models/shipping_order_response.rb +11 -1
  140. data/lib/digital_femsa/models/shipping_request.rb +12 -1
  141. data/lib/digital_femsa/models/transaction_response.rb +172 -99
  142. data/lib/digital_femsa/models/transfers_response.rb +1 -1
  143. data/lib/digital_femsa/models/transfers_response_destination.rb +312 -0
  144. data/lib/digital_femsa/models/update_customer.rb +42 -85
  145. data/lib/digital_femsa/models/update_customer_fiscal_entities_response.rb +10 -10
  146. data/lib/digital_femsa/models/update_order_discount_lines_request.rb +34 -0
  147. data/lib/digital_femsa/models/update_order_tax_request.rb +2 -2
  148. data/lib/digital_femsa/models/update_payment_methods_amount.rb +105 -0
  149. data/lib/digital_femsa/models/update_payment_methods_expires_at.rb +105 -0
  150. data/lib/digital_femsa/models/update_product.rb +85 -58
  151. data/lib/digital_femsa/models/webhook_key_delete_response.rb +1 -1
  152. data/lib/digital_femsa/models/webhook_key_request.rb +1 -0
  153. data/lib/digital_femsa/models/webhook_key_response.rb +1 -1
  154. data/lib/digital_femsa/models/webhook_request.rb +1 -1
  155. data/lib/digital_femsa/models/webhook_response.rb +1 -1
  156. data/lib/digital_femsa/models/webhook_update_request.rb +1 -1
  157. data/lib/digital_femsa/version.rb +1 -1
  158. data/lib/digital_femsa.rb +2 -6
  159. data/templates/ruby/api_client.mustache +8 -4
  160. metadata +26 -26
  161. data/docs/CustomerAntifraudInfo.md +0 -20
  162. data/docs/CustomerAntifraudInfoResponse.md +0 -20
  163. data/docs/OrderNextActionResponse.md +0 -20
  164. data/docs/OrderNextActionResponseRedirectToUrl.md +0 -20
  165. data/docs/SmsCheckoutRequest.md +0 -18
  166. data/docs/UpdateCustomerAntifraudInfo.md +0 -20
@@ -14,52 +14,62 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module DigitalFemsa
17
- # a order
17
+ # Order update payload. Only supported fields can be modified.
18
18
  class OrderUpdateRequest
19
- attr_accessor :charges
20
-
21
- attr_accessor :checkout
22
-
23
- # Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)
19
+ # Currency code in ISO 4217 (3-letter uppercase).
24
20
  attr_accessor :currency
25
21
 
26
22
  attr_accessor :customer_info
27
23
 
28
- # List of [discounts](https://developers.femsa.com/v2.1.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount.
29
- attr_accessor :discount_lines
30
-
31
- attr_accessor :fiscal_entity
32
-
33
24
  # List of [products](https://developers.femsa.com/v2.1.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product.
34
25
  attr_accessor :line_items
35
26
 
36
- attr_accessor :metadata
27
+ attr_accessor :charges
28
+
29
+ # List of [discounts](https://developers.femsa.com/v2.1.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount.
30
+ attr_accessor :discount_lines
37
31
 
38
- # Indicates whether the order charges must be preauthorized
39
- attr_accessor :pre_authorize
32
+ attr_accessor :tax_lines
33
+
34
+ # Existing shipping contact id from the customer to link to this order.
35
+ attr_accessor :shipping_contact_id
40
36
 
41
37
  attr_accessor :shipping_contact
42
38
 
43
39
  # List of [shipping costs](https://developers.femsa.com/v2.1.0/reference/orderscreateshipping). If the online store offers digital products.
44
40
  attr_accessor :shipping_lines
45
41
 
46
- attr_accessor :tax_lines
42
+ # Existing fiscal entity id from the customer to link to this order.
43
+ attr_accessor :fiscal_entity_id
44
+
45
+ attr_accessor :fiscal_entity
46
+
47
+ # URL where the customer should be redirected after completing a payment flow (if applicable).
48
+ attr_accessor :return_url
49
+
50
+ # Arbitrary key-value data that you can attach to the order for your internal use. It is not used for payment processing. Keys should be strings; values can be any JSON value.
51
+ attr_accessor :metadata
52
+
53
+ # Order status update (only allowed transitions will be accepted).
54
+ attr_accessor :status
47
55
 
48
56
  # Attribute mapping from ruby-style variable name to JSON key.
49
57
  def self.attribute_map
50
58
  {
51
- :'charges' => :'charges',
52
- :'checkout' => :'checkout',
53
59
  :'currency' => :'currency',
54
60
  :'customer_info' => :'customer_info',
55
- :'discount_lines' => :'discount_lines',
56
- :'fiscal_entity' => :'fiscal_entity',
57
61
  :'line_items' => :'line_items',
58
- :'metadata' => :'metadata',
59
- :'pre_authorize' => :'pre_authorize',
62
+ :'charges' => :'charges',
63
+ :'discount_lines' => :'discount_lines',
64
+ :'tax_lines' => :'tax_lines',
65
+ :'shipping_contact_id' => :'shipping_contact_id',
60
66
  :'shipping_contact' => :'shipping_contact',
61
67
  :'shipping_lines' => :'shipping_lines',
62
- :'tax_lines' => :'tax_lines'
68
+ :'fiscal_entity_id' => :'fiscal_entity_id',
69
+ :'fiscal_entity' => :'fiscal_entity',
70
+ :'return_url' => :'return_url',
71
+ :'metadata' => :'metadata',
72
+ :'status' => :'status'
63
73
  }
64
74
  end
65
75
 
@@ -71,24 +81,28 @@ module DigitalFemsa
71
81
  # Attribute type mapping.
72
82
  def self.openapi_types
73
83
  {
74
- :'charges' => :'Array<ChargeRequest>',
75
- :'checkout' => :'CheckoutRequest',
76
84
  :'currency' => :'String',
77
85
  :'customer_info' => :'OrderUpdateRequestCustomerInfo',
78
- :'discount_lines' => :'Array<OrderDiscountLinesRequest>',
79
- :'fiscal_entity' => :'OrderUpdateFiscalEntityRequest',
80
86
  :'line_items' => :'Array<Product>',
81
- :'metadata' => :'Hash<String, String>',
82
- :'pre_authorize' => :'Boolean',
87
+ :'charges' => :'Array<ChargeRequest>',
88
+ :'discount_lines' => :'Array<OrderDiscountLinesRequest>',
89
+ :'tax_lines' => :'Array<OrderTaxRequest>',
90
+ :'shipping_contact_id' => :'String',
83
91
  :'shipping_contact' => :'CustomerShippingContacts',
84
92
  :'shipping_lines' => :'Array<ShippingRequest>',
85
- :'tax_lines' => :'Array<OrderTaxRequest>'
93
+ :'fiscal_entity_id' => :'String',
94
+ :'fiscal_entity' => :'OrderUpdateFiscalEntityRequest',
95
+ :'return_url' => :'String',
96
+ :'metadata' => :'Hash<String, Object>',
97
+ :'status' => :'String'
86
98
  }
87
99
  end
88
100
 
89
101
  # List of attributes with nullable: true
90
102
  def self.openapi_nullable
91
103
  Set.new([
104
+ :'shipping_contact_id',
105
+ :'fiscal_entity_id',
92
106
  ])
93
107
  end
94
108
 
@@ -107,16 +121,6 @@ module DigitalFemsa
107
121
  h[k.to_sym] = v
108
122
  }
109
123
 
110
- if attributes.key?(:'charges')
111
- if (value = attributes[:'charges']).is_a?(Array)
112
- self.charges = value
113
- end
114
- end
115
-
116
- if attributes.key?(:'checkout')
117
- self.checkout = attributes[:'checkout']
118
- end
119
-
120
124
  if attributes.key?(:'currency')
121
125
  self.currency = attributes[:'currency']
122
126
  end
@@ -125,32 +129,32 @@ module DigitalFemsa
125
129
  self.customer_info = attributes[:'customer_info']
126
130
  end
127
131
 
128
- if attributes.key?(:'discount_lines')
129
- if (value = attributes[:'discount_lines']).is_a?(Array)
130
- self.discount_lines = value
132
+ if attributes.key?(:'line_items')
133
+ if (value = attributes[:'line_items']).is_a?(Array)
134
+ self.line_items = value
131
135
  end
132
136
  end
133
137
 
134
- if attributes.key?(:'fiscal_entity')
135
- self.fiscal_entity = attributes[:'fiscal_entity']
138
+ if attributes.key?(:'charges')
139
+ if (value = attributes[:'charges']).is_a?(Array)
140
+ self.charges = value
141
+ end
136
142
  end
137
143
 
138
- if attributes.key?(:'line_items')
139
- if (value = attributes[:'line_items']).is_a?(Array)
140
- self.line_items = value
144
+ if attributes.key?(:'discount_lines')
145
+ if (value = attributes[:'discount_lines']).is_a?(Array)
146
+ self.discount_lines = value
141
147
  end
142
148
  end
143
149
 
144
- if attributes.key?(:'metadata')
145
- if (value = attributes[:'metadata']).is_a?(Hash)
146
- self.metadata = value
150
+ if attributes.key?(:'tax_lines')
151
+ if (value = attributes[:'tax_lines']).is_a?(Array)
152
+ self.tax_lines = value
147
153
  end
148
154
  end
149
155
 
150
- if attributes.key?(:'pre_authorize')
151
- self.pre_authorize = attributes[:'pre_authorize']
152
- else
153
- self.pre_authorize = false
156
+ if attributes.key?(:'shipping_contact_id')
157
+ self.shipping_contact_id = attributes[:'shipping_contact_id']
154
158
  end
155
159
 
156
160
  if attributes.key?(:'shipping_contact')
@@ -163,11 +167,27 @@ module DigitalFemsa
163
167
  end
164
168
  end
165
169
 
166
- if attributes.key?(:'tax_lines')
167
- if (value = attributes[:'tax_lines']).is_a?(Array)
168
- self.tax_lines = value
170
+ if attributes.key?(:'fiscal_entity_id')
171
+ self.fiscal_entity_id = attributes[:'fiscal_entity_id']
172
+ end
173
+
174
+ if attributes.key?(:'fiscal_entity')
175
+ self.fiscal_entity = attributes[:'fiscal_entity']
176
+ end
177
+
178
+ if attributes.key?(:'return_url')
179
+ self.return_url = attributes[:'return_url']
180
+ end
181
+
182
+ if attributes.key?(:'metadata')
183
+ if (value = attributes[:'metadata']).is_a?(Hash)
184
+ self.metadata = value
169
185
  end
170
186
  end
187
+
188
+ if attributes.key?(:'status')
189
+ self.status = attributes[:'status']
190
+ end
171
191
  end
172
192
 
173
193
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -179,6 +199,10 @@ module DigitalFemsa
179
199
  invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
180
200
  end
181
201
 
202
+ if !@metadata.nil? && @metadata.length > 100
203
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.')
204
+ end
205
+
182
206
  invalid_properties
183
207
  end
184
208
 
@@ -187,6 +211,7 @@ module DigitalFemsa
187
211
  def valid?
188
212
  warn '[DEPRECATED] the `valid?` method is obsolete'
189
213
  return false if !@currency.nil? && @currency.to_s.length > 3
214
+ return false if !@metadata.nil? && @metadata.length > 100
190
215
  true
191
216
  end
192
217
 
@@ -204,23 +229,39 @@ module DigitalFemsa
204
229
  @currency = currency
205
230
  end
206
231
 
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] metadata Value to be assigned
234
+ def metadata=(metadata)
235
+ if metadata.nil?
236
+ fail ArgumentError, 'metadata cannot be nil'
237
+ end
238
+
239
+ if metadata.length > 100
240
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.'
241
+ end
242
+
243
+ @metadata = metadata
244
+ end
245
+
207
246
  # Checks equality by comparing each attribute.
208
247
  # @param [Object] Object to be compared
209
248
  def ==(o)
210
249
  return true if self.equal?(o)
211
250
  self.class == o.class &&
212
- charges == o.charges &&
213
- checkout == o.checkout &&
214
251
  currency == o.currency &&
215
252
  customer_info == o.customer_info &&
216
- discount_lines == o.discount_lines &&
217
- fiscal_entity == o.fiscal_entity &&
218
253
  line_items == o.line_items &&
219
- metadata == o.metadata &&
220
- pre_authorize == o.pre_authorize &&
254
+ charges == o.charges &&
255
+ discount_lines == o.discount_lines &&
256
+ tax_lines == o.tax_lines &&
257
+ shipping_contact_id == o.shipping_contact_id &&
221
258
  shipping_contact == o.shipping_contact &&
222
259
  shipping_lines == o.shipping_lines &&
223
- tax_lines == o.tax_lines
260
+ fiscal_entity_id == o.fiscal_entity_id &&
261
+ fiscal_entity == o.fiscal_entity &&
262
+ return_url == o.return_url &&
263
+ metadata == o.metadata &&
264
+ status == o.status
224
265
  end
225
266
 
226
267
  # @see the `==` method
@@ -232,7 +273,7 @@ module DigitalFemsa
232
273
  # Calculates hash code according to all attributes.
233
274
  # @return [Integer] Hash code
234
275
  def hash
235
- [charges, checkout, currency, customer_info, discount_lines, fiscal_entity, line_items, metadata, pre_authorize, shipping_contact, shipping_lines, tax_lines].hash
276
+ [currency, customer_info, line_items, charges, discount_lines, tax_lines, shipping_contact_id, shipping_contact, shipping_lines, fiscal_entity_id, fiscal_entity, return_url, metadata, status].hash
236
277
  end
237
278
 
238
279
  # Builds the object from hash
@@ -61,7 +61,7 @@ module DigitalFemsa
61
61
  {
62
62
  :'type' => :'String',
63
63
  :'object' => :'String',
64
- :'auth_code' => :'Integer',
64
+ :'auth_code' => :'String',
65
65
  :'cashier_id' => :'String',
66
66
  :'reference' => :'String',
67
67
  :'barcode_url' => :'String',
@@ -15,9 +15,10 @@ require 'time'
15
15
 
16
16
  module DigitalFemsa
17
17
  class PaymentMethodCashRequest
18
- # Type of payment method
18
+ # Type of payment method.
19
19
  attr_accessor :type
20
20
 
21
+ # Expiration date as unix timestamp (seconds).
21
22
  attr_accessor :expires_at
22
23
 
23
24
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -15,44 +15,41 @@ require 'time'
15
15
 
16
16
  module DigitalFemsa
17
17
  class Product
18
- attr_accessor :antifraud_info
19
-
20
- # The brand of the item.
21
- attr_accessor :brand
22
-
23
- # Short description of the item
24
- attr_accessor :description
25
-
26
- # It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters.
27
- attr_accessor :metadata
28
-
29
18
  # The name of the item. It will be displayed in the order.
30
19
  attr_accessor :name
31
20
 
21
+ # The price of the item in cents.
22
+ attr_accessor :unit_price
23
+
32
24
  # The quantity of the item in the order.
33
25
  attr_accessor :quantity
34
26
 
35
27
  # The stock keeping unit for the item. It is used to identify the item in the order.
36
28
  attr_accessor :sku
37
29
 
30
+ # The brand of the item.
31
+ attr_accessor :brand
32
+
33
+ # Short description of the item
34
+ attr_accessor :description
35
+
38
36
  # List of tags for the item. It is used to identify the item in the order.
39
37
  attr_accessor :tags
40
38
 
41
- # The price of the item in cents.
42
- attr_accessor :unit_price
39
+ # Arbitrary key-value data for your internal use. Keys should be strings; values can be any JSON value.
40
+ attr_accessor :metadata
43
41
 
44
42
  # Attribute mapping from ruby-style variable name to JSON key.
45
43
  def self.attribute_map
46
44
  {
47
- :'antifraud_info' => :'antifraud_info',
48
- :'brand' => :'brand',
49
- :'description' => :'description',
50
- :'metadata' => :'metadata',
51
45
  :'name' => :'name',
46
+ :'unit_price' => :'unit_price',
52
47
  :'quantity' => :'quantity',
53
48
  :'sku' => :'sku',
49
+ :'brand' => :'brand',
50
+ :'description' => :'description',
54
51
  :'tags' => :'tags',
55
- :'unit_price' => :'unit_price'
52
+ :'metadata' => :'metadata'
56
53
  }
57
54
  end
58
55
 
@@ -64,15 +61,14 @@ module DigitalFemsa
64
61
  # Attribute type mapping.
65
62
  def self.openapi_types
66
63
  {
67
- :'antifraud_info' => :'Hash<String, Object>',
68
- :'brand' => :'String',
69
- :'description' => :'String',
70
- :'metadata' => :'Hash<String, String>',
71
64
  :'name' => :'String',
65
+ :'unit_price' => :'Integer',
72
66
  :'quantity' => :'Integer',
73
67
  :'sku' => :'String',
68
+ :'brand' => :'String',
69
+ :'description' => :'String',
74
70
  :'tags' => :'Array<String>',
75
- :'unit_price' => :'Integer'
71
+ :'metadata' => :'Hash<String, Object>'
76
72
  }
77
73
  end
78
74
 
@@ -97,32 +93,18 @@ module DigitalFemsa
97
93
  h[k.to_sym] = v
98
94
  }
99
95
 
100
- if attributes.key?(:'antifraud_info')
101
- if (value = attributes[:'antifraud_info']).is_a?(Hash)
102
- self.antifraud_info = value
103
- end
104
- end
105
-
106
- if attributes.key?(:'brand')
107
- self.brand = attributes[:'brand']
108
- end
109
-
110
- if attributes.key?(:'description')
111
- self.description = attributes[:'description']
112
- end
113
-
114
- if attributes.key?(:'metadata')
115
- if (value = attributes[:'metadata']).is_a?(Hash)
116
- self.metadata = value
117
- end
118
- end
119
-
120
96
  if attributes.key?(:'name')
121
97
  self.name = attributes[:'name']
122
98
  else
123
99
  self.name = nil
124
100
  end
125
101
 
102
+ if attributes.key?(:'unit_price')
103
+ self.unit_price = attributes[:'unit_price']
104
+ else
105
+ self.unit_price = nil
106
+ end
107
+
126
108
  if attributes.key?(:'quantity')
127
109
  self.quantity = attributes[:'quantity']
128
110
  else
@@ -133,16 +115,24 @@ module DigitalFemsa
133
115
  self.sku = attributes[:'sku']
134
116
  end
135
117
 
118
+ if attributes.key?(:'brand')
119
+ self.brand = attributes[:'brand']
120
+ end
121
+
122
+ if attributes.key?(:'description')
123
+ self.description = attributes[:'description']
124
+ end
125
+
136
126
  if attributes.key?(:'tags')
137
127
  if (value = attributes[:'tags']).is_a?(Array)
138
128
  self.tags = value
139
129
  end
140
130
  end
141
131
 
142
- if attributes.key?(:'unit_price')
143
- self.unit_price = attributes[:'unit_price']
144
- else
145
- self.unit_price = nil
132
+ if attributes.key?(:'metadata')
133
+ if (value = attributes[:'metadata']).is_a?(Hash)
134
+ self.metadata = value
135
+ end
146
136
  end
147
137
  end
148
138
 
@@ -151,16 +141,16 @@ module DigitalFemsa
151
141
  def list_invalid_properties
152
142
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
153
143
  invalid_properties = Array.new
154
- if !@description.nil? && @description.to_s.length > 250
155
- invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
144
+ if @name.nil?
145
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
156
146
  end
157
147
 
158
- if !@metadata.nil? && @metadata.length > 100
159
- invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.')
148
+ if @unit_price.nil?
149
+ invalid_properties.push('invalid value for "unit_price", unit_price cannot be nil.')
160
150
  end
161
151
 
162
- if @name.nil?
163
- invalid_properties.push('invalid value for "name", name cannot be nil.')
152
+ if @unit_price < 0
153
+ invalid_properties.push('invalid value for "unit_price", must be greater than or equal to 0.')
164
154
  end
165
155
 
166
156
  if @quantity.nil?
@@ -171,12 +161,16 @@ module DigitalFemsa
171
161
  invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.')
172
162
  end
173
163
 
174
- if @unit_price.nil?
175
- invalid_properties.push('invalid value for "unit_price", unit_price cannot be nil.')
164
+ if !@description.nil? && @description.to_s.length > 250
165
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
176
166
  end
177
167
 
178
- if @unit_price < 0
179
- invalid_properties.push('invalid value for "unit_price", must be greater than or equal to 0.')
168
+ if !@tags.nil? && @tags.length < 1
169
+ invalid_properties.push('invalid value for "tags", number of items must be greater than or equal to 1.')
170
+ end
171
+
172
+ if !@metadata.nil? && @metadata.length > 100
173
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 100.')
180
174
  end
181
175
 
182
176
  invalid_properties
@@ -186,42 +180,29 @@ module DigitalFemsa
186
180
  # @return true if the model is valid
187
181
  def valid?
188
182
  warn '[DEPRECATED] the `valid?` method is obsolete'
189
- return false if !@description.nil? && @description.to_s.length > 250
190
- return false if !@metadata.nil? && @metadata.length > 100
191
183
  return false if @name.nil?
192
- return false if @quantity.nil?
193
- return false if @quantity < 1
194
184
  return false if @unit_price.nil?
195
185
  return false if @unit_price < 0
186
+ return false if @quantity.nil?
187
+ return false if @quantity < 1
188
+ return false if !@description.nil? && @description.to_s.length > 250
189
+ return false if !@tags.nil? && @tags.length < 1
190
+ return false if !@metadata.nil? && @metadata.length > 100
196
191
  true
197
192
  end
198
193
 
199
194
  # Custom attribute writer method with validation
200
- # @param [Object] description Value to be assigned
201
- def description=(description)
202
- if description.nil?
203
- fail ArgumentError, 'description cannot be nil'
204
- end
205
-
206
- if description.to_s.length > 250
207
- fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
208
- end
209
-
210
- @description = description
211
- end
212
-
213
- # Custom attribute writer method with validation
214
- # @param [Object] metadata Value to be assigned
215
- def metadata=(metadata)
216
- if metadata.nil?
217
- fail ArgumentError, 'metadata cannot be nil'
195
+ # @param [Object] unit_price Value to be assigned
196
+ def unit_price=(unit_price)
197
+ if unit_price.nil?
198
+ fail ArgumentError, 'unit_price cannot be nil'
218
199
  end
219
200
 
220
- if metadata.length > 100
221
- fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.'
201
+ if unit_price < 0
202
+ fail ArgumentError, 'invalid value for "unit_price", must be greater than or equal to 0.'
222
203
  end
223
204
 
224
- @metadata = metadata
205
+ @unit_price = unit_price
225
206
  end
226
207
 
227
208
  # Custom attribute writer method with validation
@@ -239,17 +220,45 @@ module DigitalFemsa
239
220
  end
240
221
 
241
222
  # Custom attribute writer method with validation
242
- # @param [Object] unit_price Value to be assigned
243
- def unit_price=(unit_price)
244
- if unit_price.nil?
245
- fail ArgumentError, 'unit_price cannot be nil'
223
+ # @param [Object] description Value to be assigned
224
+ def description=(description)
225
+ if description.nil?
226
+ fail ArgumentError, 'description cannot be nil'
246
227
  end
247
228
 
248
- if unit_price < 0
249
- fail ArgumentError, 'invalid value for "unit_price", must be greater than or equal to 0.'
229
+ if description.to_s.length > 250
230
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 250.'
250
231
  end
251
232
 
252
- @unit_price = unit_price
233
+ @description = description
234
+ end
235
+
236
+ # Custom attribute writer method with validation
237
+ # @param [Object] tags Value to be assigned
238
+ def tags=(tags)
239
+ if tags.nil?
240
+ fail ArgumentError, 'tags cannot be nil'
241
+ end
242
+
243
+ if tags.length < 1
244
+ fail ArgumentError, 'invalid value for "tags", number of items must be greater than or equal to 1.'
245
+ end
246
+
247
+ @tags = tags
248
+ end
249
+
250
+ # Custom attribute writer method with validation
251
+ # @param [Object] metadata Value to be assigned
252
+ def metadata=(metadata)
253
+ if metadata.nil?
254
+ fail ArgumentError, 'metadata cannot be nil'
255
+ end
256
+
257
+ if metadata.length > 100
258
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 100.'
259
+ end
260
+
261
+ @metadata = metadata
253
262
  end
254
263
 
255
264
  # Checks equality by comparing each attribute.
@@ -257,15 +266,14 @@ module DigitalFemsa
257
266
  def ==(o)
258
267
  return true if self.equal?(o)
259
268
  self.class == o.class &&
260
- antifraud_info == o.antifraud_info &&
261
- brand == o.brand &&
262
- description == o.description &&
263
- metadata == o.metadata &&
264
269
  name == o.name &&
270
+ unit_price == o.unit_price &&
265
271
  quantity == o.quantity &&
266
272
  sku == o.sku &&
273
+ brand == o.brand &&
274
+ description == o.description &&
267
275
  tags == o.tags &&
268
- unit_price == o.unit_price
276
+ metadata == o.metadata
269
277
  end
270
278
 
271
279
  # @see the `==` method
@@ -277,7 +285,7 @@ module DigitalFemsa
277
285
  # Calculates hash code according to all attributes.
278
286
  # @return [Integer] Hash code
279
287
  def hash
280
- [antifraud_info, brand, description, metadata, name, quantity, sku, tags, unit_price].hash
288
+ [name, unit_price, quantity, sku, brand, description, tags, metadata].hash
281
289
  end
282
290
 
283
291
  # Builds the object from hash