devdraft 1.0.2 → 1.0.3

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 (234) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +155 -253
  3. data/Rakefile +2 -0
  4. data/devdraft-1.0.0.gem +0 -0
  5. data/{devdraft_ai_sdk.gemspec → devdraft.gemspec} +15 -11
  6. data/docs/APIHealthApi.md +82 -30
  7. data/docs/AggregatedBalanceResponse.md +19 -6
  8. data/docs/AllBalancesResponse.md +19 -6
  9. data/docs/AppBalancesApi.md +125 -65
  10. data/docs/BridgeFiatPaymentRail.md +15 -0
  11. data/docs/BridgePaymentRail.md +12 -3
  12. data/docs/CreateBankPaymentIntentDto.md +49 -21
  13. data/docs/CreateCustomerDto.md +25 -9
  14. data/docs/CreateDirectBankTransferDto.md +29 -11
  15. data/docs/CreateDirectWalletTransferDto.md +21 -7
  16. data/docs/CreateExternalBankTransferDto.md +40 -0
  17. data/docs/CreateExternalStablecoinTransferDto.md +28 -0
  18. data/docs/CreateInvoiceDto.md +45 -19
  19. data/docs/CreateLiquidationAddressDto.md +43 -18
  20. data/docs/CreatePaymentLinkDto.md +53 -28
  21. data/docs/CreateStablePaymentIntentDto.md +43 -18
  22. data/docs/CreateStablecoinConversionDto.md +23 -8
  23. data/docs/CreateTaxDto.md +26 -0
  24. data/docs/CreateWebhookDto.md +23 -8
  25. data/docs/CustomerStatus.md +12 -3
  26. data/docs/CustomerType.md +15 -0
  27. data/docs/CustomersApi.md +187 -114
  28. data/docs/DestinationCurrency.md +12 -3
  29. data/docs/ExchangeRateResponseDto.md +25 -9
  30. data/docs/ExchangeRatesApi.md +130 -72
  31. data/docs/FiatCurrency.md +12 -3
  32. data/docs/HealthResponseDto.md +25 -9
  33. data/docs/InvoiceProductDto.md +17 -5
  34. data/docs/InvoicesApi.md +177 -104
  35. data/docs/LiquidationAddressResponseDto.md +41 -17
  36. data/docs/LiquidationAddressesApi.md +115 -61
  37. data/docs/PaymentIntentsApi.md +93 -57
  38. data/docs/PaymentLinkProductDto.md +17 -5
  39. data/docs/PaymentLinksApi.md +175 -102
  40. data/docs/PaymentRequestDto.md +21 -7
  41. data/docs/PaymentResponseDto.md +23 -8
  42. data/docs/ProductsApi.md +307 -194
  43. data/docs/PublicHealthResponseDto.md +19 -6
  44. data/docs/RefundResponseDto.md +23 -8
  45. data/docs/StableCoinCurrency.md +12 -3
  46. data/docs/TaxControllerCreate201Response.md +30 -0
  47. data/docs/TaxControllerDeleteWithoutId400Response.md +22 -0
  48. data/docs/TaxControllerUpdateWithoutId400Response.md +22 -0
  49. data/docs/TaxesApi.md +374 -122
  50. data/docs/TestPaymentsApi.md +150 -60
  51. data/docs/TransfersApi.md +274 -72
  52. data/docs/UpdateCustomerDto.md +25 -9
  53. data/docs/UpdateTaxDto.md +26 -0
  54. data/docs/UpdateWebhookDto.md +23 -8
  55. data/docs/WalletsApi.md +44 -24
  56. data/docs/WebhookResponseDto.md +29 -11
  57. data/docs/WebhooksApi.md +225 -134
  58. data/git_push.sh +41 -28
  59. data/lib/devdraft/api/api_health_api.rb +32 -16
  60. data/lib/devdraft/api/app_balances_api.rb +45 -22
  61. data/lib/devdraft/api/customers_api.rb +124 -71
  62. data/lib/devdraft/api/exchange_rates_api.rb +49 -26
  63. data/lib/devdraft/api/invoices_api.rb +89 -53
  64. data/lib/devdraft/api/liquidation_addresses_api.rb +70 -44
  65. data/lib/devdraft/api/payment_intents_api.rb +62 -40
  66. data/lib/devdraft/api/payment_links_api.rb +85 -49
  67. data/lib/devdraft/api/products_api.rb +214 -216
  68. data/lib/devdraft/api/taxes_api.rb +257 -66
  69. data/lib/devdraft/api/test_payments_api.rb +70 -44
  70. data/lib/devdraft/api/transfers_api.rb +206 -46
  71. data/lib/devdraft/api/wallets_api.rb +18 -9
  72. data/lib/devdraft/api/webhooks_api.rb +109 -66
  73. data/lib/devdraft/api_client.rb +76 -71
  74. data/lib/devdraft/api_error.rb +5 -4
  75. data/lib/devdraft/api_model_base.rb +88 -0
  76. data/lib/devdraft/configuration.rb +121 -18
  77. data/lib/devdraft/models/aggregated_balance_response.rb +68 -101
  78. data/lib/devdraft/models/all_balances_response.rb +76 -99
  79. data/lib/devdraft/models/bridge_fiat_payment_rail.rb +45 -0
  80. data/lib/devdraft/models/bridge_payment_rail.rb +36 -24
  81. data/lib/devdraft/models/create_bank_payment_intent_dto.rb +191 -114
  82. data/lib/devdraft/models/create_customer_dto.rb +123 -113
  83. data/lib/devdraft/models/create_direct_bank_transfer_dto.rb +105 -104
  84. data/lib/devdraft/models/create_direct_wallet_transfer_dto.rb +89 -100
  85. data/lib/devdraft/models/create_external_bank_transfer_dto.rb +505 -0
  86. data/lib/devdraft/models/create_external_stablecoin_transfer_dto.rb +266 -0
  87. data/lib/devdraft/models/create_invoice_dto.rb +151 -121
  88. data/lib/devdraft/models/create_liquidation_address_dto.rb +195 -115
  89. data/lib/devdraft/models/create_payment_link_dto.rb +192 -214
  90. data/lib/devdraft/models/create_stable_payment_intent_dto.rb +324 -111
  91. data/lib/devdraft/models/create_stablecoin_conversion_dto.rb +102 -101
  92. data/lib/devdraft/models/create_tax_dto.rb +281 -0
  93. data/lib/devdraft/models/create_webhook_dto.rb +104 -101
  94. data/lib/devdraft/models/customer_status.rb +23 -10
  95. data/lib/devdraft/models/customer_type.rb +45 -0
  96. data/lib/devdraft/models/destination_currency.rb +27 -15
  97. data/lib/devdraft/models/exchange_rate_response_dto.rb +103 -102
  98. data/lib/devdraft/models/fiat_currency.rb +22 -10
  99. data/lib/devdraft/models/health_response_dto.rb +99 -106
  100. data/lib/devdraft/models/invoice_product_dto.rb +63 -98
  101. data/lib/devdraft/models/liquidation_address_response_dto.rb +147 -110
  102. data/lib/devdraft/models/payment_link_product_dto.rb +70 -98
  103. data/lib/devdraft/models/payment_request_dto.rb +77 -100
  104. data/lib/devdraft/models/payment_response_dto.rb +102 -101
  105. data/lib/devdraft/models/public_health_response_dto.rb +68 -101
  106. data/lib/devdraft/models/refund_response_dto.rb +102 -101
  107. data/lib/devdraft/models/stable_coin_currency.rb +21 -9
  108. data/lib/devdraft/models/tax_controller_create201_response.rb +201 -0
  109. data/lib/devdraft/models/tax_controller_delete_without_id400_response.rb +165 -0
  110. data/lib/devdraft/models/tax_controller_update_without_id400_response.rb +165 -0
  111. data/lib/devdraft/models/update_customer_dto.rb +117 -113
  112. data/lib/devdraft/models/update_tax_dto.rb +256 -0
  113. data/lib/devdraft/models/update_webhook_dto.rb +70 -101
  114. data/lib/devdraft/models/webhook_response_dto.rb +140 -103
  115. data/lib/devdraft/version.rb +6 -5
  116. data/lib/devdraft.rb +18 -27
  117. data/spec/api/api_health_api_spec.rb +10 -9
  118. data/spec/api/app_balances_api_spec.rb +11 -10
  119. data/spec/api/customers_api_spec.rb +25 -24
  120. data/spec/api/exchange_rates_api_spec.rb +11 -10
  121. data/spec/api/invoices_api_spec.rb +16 -15
  122. data/spec/api/liquidation_addresses_api_spec.rb +13 -12
  123. data/spec/api/payment_intents_api_spec.rb +12 -11
  124. data/spec/api/payment_links_api_spec.rb +14 -13
  125. data/spec/api/products_api_spec.rb +41 -40
  126. data/spec/api/taxes_api_spec.rb +51 -21
  127. data/spec/api/test_payments_api_spec.rb +14 -13
  128. data/spec/api/transfers_api_spec.rb +36 -13
  129. data/spec/api/wallets_api_spec.rb +9 -8
  130. data/spec/api/webhooks_api_spec.rb +20 -19
  131. data/spec/models/aggregated_balance_response_spec.rb +15 -19
  132. data/spec/models/all_balances_response_spec.rb +14 -18
  133. data/spec/models/bridge_fiat_payment_rail_spec.rb +30 -0
  134. data/spec/models/bridge_payment_rail_spec.rb +11 -15
  135. data/spec/models/create_bank_payment_intent_dto_spec.rb +29 -33
  136. data/spec/models/create_customer_dto_spec.rb +17 -25
  137. data/spec/models/create_direct_bank_transfer_dto_spec.rb +19 -23
  138. data/spec/models/create_direct_wallet_transfer_dto_spec.rb +15 -19
  139. data/spec/models/create_external_bank_transfer_dto_spec.rb +102 -0
  140. data/spec/models/create_external_stablecoin_transfer_dto_spec.rb +66 -0
  141. data/spec/models/create_invoice_dto_spec.rb +31 -35
  142. data/spec/models/create_liquidation_address_dto_spec.rb +28 -32
  143. data/spec/models/create_payment_link_dto_spec.rb +34 -76
  144. data/spec/models/create_stable_payment_intent_dto_spec.rb +26 -30
  145. data/spec/models/create_stablecoin_conversion_dto_spec.rb +16 -20
  146. data/spec/models/create_tax_dto_spec.rb +60 -0
  147. data/spec/models/create_webhook_dto_spec.rb +16 -20
  148. data/spec/models/customer_status_spec.rb +11 -15
  149. data/spec/models/customer_type_spec.rb +30 -0
  150. data/spec/models/destination_currency_spec.rb +11 -15
  151. data/spec/models/exchange_rate_response_dto_spec.rb +17 -21
  152. data/spec/models/fiat_currency_spec.rb +11 -15
  153. data/spec/models/health_response_dto_spec.rb +19 -23
  154. data/spec/models/invoice_product_dto_spec.rb +13 -17
  155. data/spec/models/liquidation_address_response_dto_spec.rb +25 -29
  156. data/spec/models/payment_link_product_dto_spec.rb +13 -17
  157. data/spec/models/payment_request_dto_spec.rb +15 -19
  158. data/spec/models/payment_response_dto_spec.rb +16 -20
  159. data/spec/models/public_health_response_dto_spec.rb +15 -19
  160. data/spec/models/refund_response_dto_spec.rb +16 -20
  161. data/spec/models/stable_coin_currency_spec.rb +11 -15
  162. data/spec/models/tax_controller_create201_response_spec.rb +72 -0
  163. data/spec/models/tax_controller_delete_without_id400_response_spec.rb +48 -0
  164. data/spec/models/tax_controller_update_without_id400_response_spec.rb +48 -0
  165. data/spec/models/update_customer_dto_spec.rb +17 -25
  166. data/spec/models/update_tax_dto_spec.rb +60 -0
  167. data/spec/models/update_webhook_dto_spec.rb +16 -20
  168. data/spec/models/webhook_response_dto_spec.rb +19 -23
  169. data/spec/spec_helper.rb +5 -4
  170. metadata +49 -116
  171. data/docs/AllOfAllBalancesResponseEurc.md +0 -9
  172. data/docs/AllOfAllBalancesResponseUsdc.md +0 -9
  173. data/docs/AllOfCreateBankPaymentIntentDtoDestinationCurrency.md +0 -6
  174. data/docs/AllOfCreateBankPaymentIntentDtoDestinationNetwork.md +0 -6
  175. data/docs/AllOfCreateBankPaymentIntentDtoSourceCurrency.md +0 -6
  176. data/docs/AllOfCreateBankPaymentIntentDtoSourcePaymentRail.md +0 -6
  177. data/docs/AllOfCreateCustomerDtoStatus.md +0 -6
  178. data/docs/AllOfCreateLiquidationAddressDtoDestinationCurrency.md +0 -6
  179. data/docs/AllOfCreateLiquidationAddressDtoDestinationPaymentRail.md +0 -6
  180. data/docs/AllOfCreateStablePaymentIntentDtoDestinationCurrency.md +0 -6
  181. data/docs/AllOfCreateStablePaymentIntentDtoDestinationNetwork.md +0 -6
  182. data/docs/AllOfCreateStablePaymentIntentDtoSourceCurrency.md +0 -6
  183. data/docs/AllOfCreateStablePaymentIntentDtoSourceNetwork.md +0 -6
  184. data/docs/AllOfUpdateCustomerDtoStatus.md +0 -6
  185. data/docs/CreateProductDto.md +0 -18
  186. data/docs/CreateTaxInput.md +0 -6
  187. data/docs/UpdatePaymentLinkDto.md +0 -6
  188. data/docs/UpdatePreferenceInput.md +0 -6
  189. data/docs/UpdateProductDto.md +0 -18
  190. data/docs/UpdateTaxInput.md +0 -6
  191. data/example.rb +0 -129
  192. data/lib/devdraft/models/all_of_all_balances_response_eurc.rb +0 -283
  193. data/lib/devdraft/models/all_of_all_balances_response_usdc.rb +0 -283
  194. data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_destination_currency.rb +0 -202
  195. data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_destination_network.rb +0 -202
  196. data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_source_currency.rb +0 -202
  197. data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_source_payment_rail.rb +0 -202
  198. data/lib/devdraft/models/all_of_create_customer_dto_status.rb +0 -202
  199. data/lib/devdraft/models/all_of_create_liquidation_address_dto_destination_currency.rb +0 -202
  200. data/lib/devdraft/models/all_of_create_liquidation_address_dto_destination_payment_rail.rb +0 -202
  201. data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_destination_currency.rb +0 -202
  202. data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_destination_network.rb +0 -202
  203. data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_source_currency.rb +0 -202
  204. data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_source_network.rb +0 -202
  205. data/lib/devdraft/models/all_of_update_customer_dto_status.rb +0 -202
  206. data/lib/devdraft/models/create_product_dto.rb +0 -370
  207. data/lib/devdraft/models/create_tax_input.rb +0 -197
  208. data/lib/devdraft/models/update_payment_link_dto.rb +0 -197
  209. data/lib/devdraft/models/update_preference_input.rb +0 -197
  210. data/lib/devdraft/models/update_product_dto.rb +0 -355
  211. data/lib/devdraft/models/update_tax_input.rb +0 -197
  212. data/spec/api_client_spec.rb +0 -225
  213. data/spec/base_object_spec.rb +0 -109
  214. data/spec/configuration_spec.rb +0 -41
  215. data/spec/models/all_of_all_balances_response_eurc_spec.rb +0 -56
  216. data/spec/models/all_of_all_balances_response_usdc_spec.rb +0 -56
  217. data/spec/models/all_of_create_bank_payment_intent_dto_destination_currency_spec.rb +0 -34
  218. data/spec/models/all_of_create_bank_payment_intent_dto_destination_network_spec.rb +0 -34
  219. data/spec/models/all_of_create_bank_payment_intent_dto_source_currency_spec.rb +0 -34
  220. data/spec/models/all_of_create_bank_payment_intent_dto_source_payment_rail_spec.rb +0 -34
  221. data/spec/models/all_of_create_customer_dto_status_spec.rb +0 -34
  222. data/spec/models/all_of_create_liquidation_address_dto_destination_currency_spec.rb +0 -34
  223. data/spec/models/all_of_create_liquidation_address_dto_destination_payment_rail_spec.rb +0 -34
  224. data/spec/models/all_of_create_stable_payment_intent_dto_destination_currency_spec.rb +0 -34
  225. data/spec/models/all_of_create_stable_payment_intent_dto_destination_network_spec.rb +0 -34
  226. data/spec/models/all_of_create_stable_payment_intent_dto_source_currency_spec.rb +0 -34
  227. data/spec/models/all_of_create_stable_payment_intent_dto_source_network_spec.rb +0 -34
  228. data/spec/models/all_of_update_customer_dto_status_spec.rb +0 -34
  229. data/spec/models/create_product_dto_spec.rb +0 -110
  230. data/spec/models/create_tax_input_spec.rb +0 -34
  231. data/spec/models/update_payment_link_dto_spec.rb +0 -34
  232. data/spec/models/update_preference_input_spec.rb +0 -34
  233. data/spec/models/update_product_dto_spec.rb +0 -110
  234. data/spec/models/update_tax_input_spec.rb +0 -34
@@ -3,16 +3,18 @@
3
3
 
4
4
  # A comprehensive payment processing and business management API that enables seamless integration of cryptocurrency and traditional payment methods.
5
5
 
6
- OpenAPI spec version: 1.0.0
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.17.0
7
10
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.65
10
11
  =end
11
12
 
12
13
  require 'date'
14
+ require 'time'
13
15
 
14
- module DevDraftAI
15
- class CreateStablePaymentIntentDto
16
+ module Devdraft
17
+ class CreateStablePaymentIntentDto < ApiModelBase
16
18
  # The stablecoin currency to convert FROM. This is the currency the customer will pay with.
17
19
  attr_accessor :source_currency
18
20
 
@@ -58,6 +60,28 @@ module DevDraftAI
58
60
  # Customer's phone number with country code. Used for SMS notifications and verification.
59
61
  attr_accessor :phone_number
60
62
 
63
+ class EnumAttributeValidator
64
+ attr_reader :datatype
65
+ attr_reader :allowable_values
66
+
67
+ def initialize(datatype, allowable_values)
68
+ @allowable_values = allowable_values.map do |value|
69
+ case datatype.to_s
70
+ when /Integer/i
71
+ value.to_i
72
+ when /Float/i
73
+ value.to_f
74
+ else
75
+ value
76
+ end
77
+ end
78
+ end
79
+
80
+ def valid?(value)
81
+ !value || allowable_values.include?(value)
82
+ end
83
+ end
84
+
61
85
  # Attribute mapping from ruby-style variable name to JSON key.
62
86
  def self.attribute_map
63
87
  {
@@ -79,24 +103,34 @@ module DevDraftAI
79
103
  }
80
104
  end
81
105
 
106
+ # Returns attribute mapping this model knows about
107
+ def self.acceptable_attribute_map
108
+ attribute_map
109
+ end
110
+
111
+ # Returns all the JSON keys this model knows about
112
+ def self.acceptable_attributes
113
+ acceptable_attribute_map.values
114
+ end
115
+
82
116
  # Attribute type mapping.
83
117
  def self.openapi_types
84
118
  {
85
- :'source_currency' => :'Object',
86
- :'source_network' => :'Object',
87
- :'destination_currency' => :'Object',
88
- :'destination_network' => :'Object',
89
- :'destination_address' => :'Object',
90
- :'amount' => :'Object',
91
- :'customer_first_name' => :'Object',
92
- :'customer_last_name' => :'Object',
93
- :'customer_email' => :'Object',
94
- :'customer_address' => :'Object',
95
- :'customer_country' => :'Object',
96
- :'customer_country_iso' => :'Object',
97
- :'customer_province' => :'Object',
98
- :'customer_province_iso' => :'Object',
99
- :'phone_number' => :'Object'
119
+ :'source_currency' => :'StableCoinCurrency',
120
+ :'source_network' => :'BridgePaymentRail',
121
+ :'destination_currency' => :'StableCoinCurrency',
122
+ :'destination_network' => :'BridgePaymentRail',
123
+ :'destination_address' => :'String',
124
+ :'amount' => :'String',
125
+ :'customer_first_name' => :'String',
126
+ :'customer_last_name' => :'String',
127
+ :'customer_email' => :'String',
128
+ :'customer_address' => :'String',
129
+ :'customer_country' => :'String',
130
+ :'customer_country_iso' => :'String',
131
+ :'customer_province' => :'String',
132
+ :'customer_province_iso' => :'String',
133
+ :'phone_number' => :'String'
100
134
  }
101
135
  end
102
136
 
@@ -105,28 +139,33 @@ module DevDraftAI
105
139
  Set.new([
106
140
  ])
107
141
  end
108
-
142
+
109
143
  # Initializes the object
110
144
  # @param [Hash] attributes Model attributes in the form of hash
111
145
  def initialize(attributes = {})
112
146
  if (!attributes.is_a?(Hash))
113
- fail ArgumentError, "The input argument (attributes) must be a hash in `DevDraftAI::CreateStablePaymentIntentDto` initialize method"
147
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Devdraft::CreateStablePaymentIntentDto` initialize method"
114
148
  end
115
149
 
116
150
  # check to see if the attribute exists and convert string to symbol for hash key
151
+ acceptable_attribute_map = self.class.acceptable_attribute_map
117
152
  attributes = attributes.each_with_object({}) { |(k, v), h|
118
- if (!self.class.attribute_map.key?(k.to_sym))
119
- fail ArgumentError, "`#{k}` is not a valid attribute in `DevDraftAI::CreateStablePaymentIntentDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
153
+ if (!acceptable_attribute_map.key?(k.to_sym))
154
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Devdraft::CreateStablePaymentIntentDto`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
120
155
  end
121
156
  h[k.to_sym] = v
122
157
  }
123
158
 
124
159
  if attributes.key?(:'source_currency')
125
160
  self.source_currency = attributes[:'source_currency']
161
+ else
162
+ self.source_currency = nil
126
163
  end
127
164
 
128
165
  if attributes.key?(:'source_network')
129
166
  self.source_network = attributes[:'source_network']
167
+ else
168
+ self.source_network = nil
130
169
  end
131
170
 
132
171
  if attributes.key?(:'destination_currency')
@@ -135,6 +174,8 @@ module DevDraftAI
135
174
 
136
175
  if attributes.key?(:'destination_network')
137
176
  self.destination_network = attributes[:'destination_network']
177
+ else
178
+ self.destination_network = nil
138
179
  end
139
180
 
140
181
  if attributes.key?(:'destination_address')
@@ -185,6 +226,7 @@ module DevDraftAI
185
226
  # Show invalid properties with the reasons. Usually used together with valid?
186
227
  # @return Array for valid properties with the reasons
187
228
  def list_invalid_properties
229
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
188
230
  invalid_properties = Array.new
189
231
  if @source_currency.nil?
190
232
  invalid_properties.push('invalid value for "source_currency", source_currency cannot be nil.')
@@ -198,18 +240,263 @@ module DevDraftAI
198
240
  invalid_properties.push('invalid value for "destination_network", destination_network cannot be nil.')
199
241
  end
200
242
 
243
+ pattern = Regexp.new(/^\d+(\.\d{1,6})?$/)
244
+ if !@amount.nil? && @amount !~ pattern
245
+ invalid_properties.push("invalid value for \"amount\", must conform to the pattern #{pattern}.")
246
+ end
247
+
248
+ if !@customer_first_name.nil? && @customer_first_name.to_s.length > 100
249
+ invalid_properties.push('invalid value for "customer_first_name", the character length must be smaller than or equal to 100.')
250
+ end
251
+
252
+ if !@customer_last_name.nil? && @customer_last_name.to_s.length > 100
253
+ invalid_properties.push('invalid value for "customer_last_name", the character length must be smaller than or equal to 100.')
254
+ end
255
+
256
+ if !@customer_email.nil? && @customer_email.to_s.length > 255
257
+ invalid_properties.push('invalid value for "customer_email", the character length must be smaller than or equal to 255.')
258
+ end
259
+
260
+ if !@customer_address.nil? && @customer_address.to_s.length > 500
261
+ invalid_properties.push('invalid value for "customer_address", the character length must be smaller than or equal to 500.')
262
+ end
263
+
264
+ if !@customer_country.nil? && @customer_country.to_s.length > 100
265
+ invalid_properties.push('invalid value for "customer_country", the character length must be smaller than or equal to 100.')
266
+ end
267
+
268
+ if !@customer_country_iso.nil? && @customer_country_iso.to_s.length > 2
269
+ invalid_properties.push('invalid value for "customer_country_iso", the character length must be smaller than or equal to 2.')
270
+ end
271
+
272
+ pattern = Regexp.new(/^[A-Z]{2}$/)
273
+ if !@customer_country_iso.nil? && @customer_country_iso !~ pattern
274
+ invalid_properties.push("invalid value for \"customer_country_iso\", must conform to the pattern #{pattern}.")
275
+ end
276
+
277
+ if !@customer_province.nil? && @customer_province.to_s.length > 100
278
+ invalid_properties.push('invalid value for "customer_province", the character length must be smaller than or equal to 100.')
279
+ end
280
+
281
+ if !@customer_province_iso.nil? && @customer_province_iso.to_s.length > 10
282
+ invalid_properties.push('invalid value for "customer_province_iso", the character length must be smaller than or equal to 10.')
283
+ end
284
+
285
+ if !@phone_number.nil? && @phone_number.to_s.length > 20
286
+ invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 20.')
287
+ end
288
+
289
+ pattern = Regexp.new(/^[+]?[\d\s\-\(\)]+$/)
290
+ if !@phone_number.nil? && @phone_number !~ pattern
291
+ invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
292
+ end
293
+
201
294
  invalid_properties
202
295
  end
203
296
 
204
297
  # Check to see if the all the properties in the model are valid
205
298
  # @return true if the model is valid
206
299
  def valid?
300
+ warn '[DEPRECATED] the `valid?` method is obsolete'
207
301
  return false if @source_currency.nil?
208
302
  return false if @source_network.nil?
209
303
  return false if @destination_network.nil?
304
+ return false if !@amount.nil? && @amount !~ Regexp.new(/^\d+(\.\d{1,6})?$/)
305
+ return false if !@customer_first_name.nil? && @customer_first_name.to_s.length > 100
306
+ return false if !@customer_last_name.nil? && @customer_last_name.to_s.length > 100
307
+ return false if !@customer_email.nil? && @customer_email.to_s.length > 255
308
+ return false if !@customer_address.nil? && @customer_address.to_s.length > 500
309
+ return false if !@customer_country.nil? && @customer_country.to_s.length > 100
310
+ return false if !@customer_country_iso.nil? && @customer_country_iso.to_s.length > 2
311
+ return false if !@customer_country_iso.nil? && @customer_country_iso !~ Regexp.new(/^[A-Z]{2}$/)
312
+ return false if !@customer_province.nil? && @customer_province.to_s.length > 100
313
+ return false if !@customer_province_iso.nil? && @customer_province_iso.to_s.length > 10
314
+ return false if !@phone_number.nil? && @phone_number.to_s.length > 20
315
+ return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^[+]?[\d\s\-\(\)]+$/)
210
316
  true
211
317
  end
212
318
 
319
+ # Custom attribute writer method with validation
320
+ # @param [Object] source_currency Value to be assigned
321
+ def source_currency=(source_currency)
322
+ if source_currency.nil?
323
+ fail ArgumentError, 'source_currency cannot be nil'
324
+ end
325
+
326
+ @source_currency = source_currency
327
+ end
328
+
329
+ # Custom attribute writer method with validation
330
+ # @param [Object] source_network Value to be assigned
331
+ def source_network=(source_network)
332
+ if source_network.nil?
333
+ fail ArgumentError, 'source_network cannot be nil'
334
+ end
335
+
336
+ @source_network = source_network
337
+ end
338
+
339
+ # Custom attribute writer method with validation
340
+ # @param [Object] destination_network Value to be assigned
341
+ def destination_network=(destination_network)
342
+ if destination_network.nil?
343
+ fail ArgumentError, 'destination_network cannot be nil'
344
+ end
345
+
346
+ @destination_network = destination_network
347
+ end
348
+
349
+ # Custom attribute writer method with validation
350
+ # @param [Object] amount Value to be assigned
351
+ def amount=(amount)
352
+ if amount.nil?
353
+ fail ArgumentError, 'amount cannot be nil'
354
+ end
355
+
356
+ pattern = Regexp.new(/^\d+(\.\d{1,6})?$/)
357
+ if amount !~ pattern
358
+ fail ArgumentError, "invalid value for \"amount\", must conform to the pattern #{pattern}."
359
+ end
360
+
361
+ @amount = amount
362
+ end
363
+
364
+ # Custom attribute writer method with validation
365
+ # @param [Object] customer_first_name Value to be assigned
366
+ def customer_first_name=(customer_first_name)
367
+ if customer_first_name.nil?
368
+ fail ArgumentError, 'customer_first_name cannot be nil'
369
+ end
370
+
371
+ if customer_first_name.to_s.length > 100
372
+ fail ArgumentError, 'invalid value for "customer_first_name", the character length must be smaller than or equal to 100.'
373
+ end
374
+
375
+ @customer_first_name = customer_first_name
376
+ end
377
+
378
+ # Custom attribute writer method with validation
379
+ # @param [Object] customer_last_name Value to be assigned
380
+ def customer_last_name=(customer_last_name)
381
+ if customer_last_name.nil?
382
+ fail ArgumentError, 'customer_last_name cannot be nil'
383
+ end
384
+
385
+ if customer_last_name.to_s.length > 100
386
+ fail ArgumentError, 'invalid value for "customer_last_name", the character length must be smaller than or equal to 100.'
387
+ end
388
+
389
+ @customer_last_name = customer_last_name
390
+ end
391
+
392
+ # Custom attribute writer method with validation
393
+ # @param [Object] customer_email Value to be assigned
394
+ def customer_email=(customer_email)
395
+ if customer_email.nil?
396
+ fail ArgumentError, 'customer_email cannot be nil'
397
+ end
398
+
399
+ if customer_email.to_s.length > 255
400
+ fail ArgumentError, 'invalid value for "customer_email", the character length must be smaller than or equal to 255.'
401
+ end
402
+
403
+ @customer_email = customer_email
404
+ end
405
+
406
+ # Custom attribute writer method with validation
407
+ # @param [Object] customer_address Value to be assigned
408
+ def customer_address=(customer_address)
409
+ if customer_address.nil?
410
+ fail ArgumentError, 'customer_address cannot be nil'
411
+ end
412
+
413
+ if customer_address.to_s.length > 500
414
+ fail ArgumentError, 'invalid value for "customer_address", the character length must be smaller than or equal to 500.'
415
+ end
416
+
417
+ @customer_address = customer_address
418
+ end
419
+
420
+ # Custom attribute writer method with validation
421
+ # @param [Object] customer_country Value to be assigned
422
+ def customer_country=(customer_country)
423
+ if customer_country.nil?
424
+ fail ArgumentError, 'customer_country cannot be nil'
425
+ end
426
+
427
+ if customer_country.to_s.length > 100
428
+ fail ArgumentError, 'invalid value for "customer_country", the character length must be smaller than or equal to 100.'
429
+ end
430
+
431
+ @customer_country = customer_country
432
+ end
433
+
434
+ # Custom attribute writer method with validation
435
+ # @param [Object] customer_country_iso Value to be assigned
436
+ def customer_country_iso=(customer_country_iso)
437
+ if customer_country_iso.nil?
438
+ fail ArgumentError, 'customer_country_iso cannot be nil'
439
+ end
440
+
441
+ if customer_country_iso.to_s.length > 2
442
+ fail ArgumentError, 'invalid value for "customer_country_iso", the character length must be smaller than or equal to 2.'
443
+ end
444
+
445
+ pattern = Regexp.new(/^[A-Z]{2}$/)
446
+ if customer_country_iso !~ pattern
447
+ fail ArgumentError, "invalid value for \"customer_country_iso\", must conform to the pattern #{pattern}."
448
+ end
449
+
450
+ @customer_country_iso = customer_country_iso
451
+ end
452
+
453
+ # Custom attribute writer method with validation
454
+ # @param [Object] customer_province Value to be assigned
455
+ def customer_province=(customer_province)
456
+ if customer_province.nil?
457
+ fail ArgumentError, 'customer_province cannot be nil'
458
+ end
459
+
460
+ if customer_province.to_s.length > 100
461
+ fail ArgumentError, 'invalid value for "customer_province", the character length must be smaller than or equal to 100.'
462
+ end
463
+
464
+ @customer_province = customer_province
465
+ end
466
+
467
+ # Custom attribute writer method with validation
468
+ # @param [Object] customer_province_iso Value to be assigned
469
+ def customer_province_iso=(customer_province_iso)
470
+ if customer_province_iso.nil?
471
+ fail ArgumentError, 'customer_province_iso cannot be nil'
472
+ end
473
+
474
+ if customer_province_iso.to_s.length > 10
475
+ fail ArgumentError, 'invalid value for "customer_province_iso", the character length must be smaller than or equal to 10.'
476
+ end
477
+
478
+ @customer_province_iso = customer_province_iso
479
+ end
480
+
481
+ # Custom attribute writer method with validation
482
+ # @param [Object] phone_number Value to be assigned
483
+ def phone_number=(phone_number)
484
+ if phone_number.nil?
485
+ fail ArgumentError, 'phone_number cannot be nil'
486
+ end
487
+
488
+ if phone_number.to_s.length > 20
489
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 20.'
490
+ end
491
+
492
+ pattern = Regexp.new(/^[+]?[\d\s\-\(\)]+$/)
493
+ if phone_number !~ pattern
494
+ fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
495
+ end
496
+
497
+ @phone_number = phone_number
498
+ end
499
+
213
500
  # Checks equality by comparing each attribute.
214
501
  # @param [Object] Object to be compared
215
502
  def ==(o)
@@ -248,82 +535,23 @@ module DevDraftAI
248
535
  # @param [Hash] attributes Model attributes in the form of hash
249
536
  # @return [Object] Returns the model itself
250
537
  def self.build_from_hash(attributes)
251
- new.build_from_hash(attributes)
252
- end
253
-
254
- # Builds the object from hash
255
- # @param [Hash] attributes Model attributes in the form of hash
256
- # @return [Object] Returns the model itself
257
- def build_from_hash(attributes)
258
538
  return nil unless attributes.is_a?(Hash)
259
- self.class.openapi_types.each_pair do |key, type|
260
- if type =~ /\AArray<(.*)>/i
539
+ attributes = attributes.transform_keys(&:to_sym)
540
+ transformed_hash = {}
541
+ openapi_types.each_pair do |key, type|
542
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
543
+ transformed_hash["#{key}"] = nil
544
+ elsif type =~ /\AArray<(.*)>/i
261
545
  # check to ensure the input is an array given that the attribute
262
546
  # is documented as an array but the input is not
263
- if attributes[self.class.attribute_map[key]].is_a?(Array)
264
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
547
+ if attributes[attribute_map[key]].is_a?(Array)
548
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
265
549
  end
266
- elsif !attributes[self.class.attribute_map[key]].nil?
267
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
268
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
269
- self.send("#{key}=", nil)
550
+ elsif !attributes[attribute_map[key]].nil?
551
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
270
552
  end
271
553
  end
272
-
273
- self
274
- end
275
-
276
- # Deserializes the data based on type
277
- # @param string type Data type
278
- # @param string value Value to be deserialized
279
- # @return [Object] Deserialized data
280
- def _deserialize(type, value)
281
- case type.to_sym
282
- when :DateTime
283
- DateTime.parse(value)
284
- when :Date
285
- Date.parse(value)
286
- when :String
287
- value.to_s
288
- when :Integer
289
- value.to_i
290
- when :Float
291
- value.to_f
292
- when :Boolean
293
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
294
- true
295
- else
296
- false
297
- end
298
- when :Object
299
- # generic object (usually a Hash), return directly
300
- value
301
- when /\AArray<(?<inner_type>.+)>\z/
302
- inner_type = Regexp.last_match[:inner_type]
303
- value.map { |v| _deserialize(inner_type, v) }
304
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
305
- k_type = Regexp.last_match[:k_type]
306
- v_type = Regexp.last_match[:v_type]
307
- {}.tap do |hash|
308
- value.each do |k, v|
309
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
310
- end
311
- end
312
- else # model
313
- DevDraftAI.const_get(type).build_from_hash(value)
314
- end
315
- end
316
-
317
- # Returns the string representation of the object
318
- # @return [String] String presentation of the object
319
- def to_s
320
- to_hash.to_s
321
- end
322
-
323
- # to_body is an alias to to_hash (backward compatibility)
324
- # @return [Hash] Returns the object in the form of hash
325
- def to_body
326
- to_hash
554
+ new(transformed_hash)
327
555
  end
328
556
 
329
557
  # Returns the object in the form of hash
@@ -342,21 +570,6 @@ module DevDraftAI
342
570
  hash
343
571
  end
344
572
 
345
- # Outputs non-array value in the form of hash
346
- # For object, use to_hash. Otherwise, just return the value
347
- # @param [Object] value Any valid value
348
- # @return [Hash] Returns the value in the form of hash
349
- def _to_hash(value)
350
- if value.is_a?(Array)
351
- value.compact.map { |v| _to_hash(v) }
352
- elsif value.is_a?(Hash)
353
- {}.tap do |hash|
354
- value.each { |k, v| hash[k] = _to_hash(v) }
355
- end
356
- elsif value.respond_to? :to_hash
357
- value.to_hash
358
- else
359
- value
360
- end
361
- end end
573
+ end
574
+
362
575
  end