mundi_api 0.9.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 (123) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +2186 -0
  4. data/lib/mundi_api.rb +137 -0
  5. data/lib/mundi_api/api_helper.rb +209 -0
  6. data/lib/mundi_api/configuration.rb +25 -0
  7. data/lib/mundi_api/controllers/base_controller.rb +61 -0
  8. data/lib/mundi_api/controllers/charges_controller.rb +359 -0
  9. data/lib/mundi_api/controllers/customers_controller.rb +758 -0
  10. data/lib/mundi_api/controllers/invoices_controller.rb +184 -0
  11. data/lib/mundi_api/controllers/orders_controller.rb +171 -0
  12. data/lib/mundi_api/controllers/plans_controller.rb +387 -0
  13. data/lib/mundi_api/controllers/subscriptions_controller.rb +648 -0
  14. data/lib/mundi_api/controllers/tokens_controller.rb +87 -0
  15. data/lib/mundi_api/exceptions/api_exception.rb +18 -0
  16. data/lib/mundi_api/exceptions/error_exception.rb +37 -0
  17. data/lib/mundi_api/http/auth/basic_auth.rb +20 -0
  18. data/lib/mundi_api/http/faraday_client.rb +55 -0
  19. data/lib/mundi_api/http/http_call_back.rb +22 -0
  20. data/lib/mundi_api/http/http_client.rb +92 -0
  21. data/lib/mundi_api/http/http_context.rb +18 -0
  22. data/lib/mundi_api/http/http_method_enum.rb +11 -0
  23. data/lib/mundi_api/http/http_request.rb +48 -0
  24. data/lib/mundi_api/http/http_response.rb +21 -0
  25. data/lib/mundi_api/models/base_model.rb +34 -0
  26. data/lib/mundi_api/models/create_access_token_request.rb +35 -0
  27. data/lib/mundi_api/models/create_address_request.rb +108 -0
  28. data/lib/mundi_api/models/create_bank_transfer_payment_request.rb +44 -0
  29. data/lib/mundi_api/models/create_boleto_payment_request.rb +83 -0
  30. data/lib/mundi_api/models/create_cancel_charge_request.rb +35 -0
  31. data/lib/mundi_api/models/create_cancel_subscription_request.rb +35 -0
  32. data/lib/mundi_api/models/create_capture_charge_request.rb +45 -0
  33. data/lib/mundi_api/models/create_card_options_request.rb +36 -0
  34. data/lib/mundi_api/models/create_card_request.rb +136 -0
  35. data/lib/mundi_api/models/create_card_token_request.rb +80 -0
  36. data/lib/mundi_api/models/create_charge_request.rb +92 -0
  37. data/lib/mundi_api/models/create_checkout_boleto_payment_request.rb +54 -0
  38. data/lib/mundi_api/models/create_checkout_card_installment_option_request.rb +44 -0
  39. data/lib/mundi_api/models/create_checkout_card_payment_request.rb +51 -0
  40. data/lib/mundi_api/models/create_checkout_payment_request.rb +82 -0
  41. data/lib/mundi_api/models/create_credit_card_payment_request.rb +108 -0
  42. data/lib/mundi_api/models/create_customer_request.rb +108 -0
  43. data/lib/mundi_api/models/create_discount_request.rb +62 -0
  44. data/lib/mundi_api/models/create_order_item_request.rb +71 -0
  45. data/lib/mundi_api/models/create_order_request.rb +114 -0
  46. data/lib/mundi_api/models/create_payment_request.rb +121 -0
  47. data/lib/mundi_api/models/create_phone_request.rb +53 -0
  48. data/lib/mundi_api/models/create_phones_request.rb +46 -0
  49. data/lib/mundi_api/models/create_plan_item_request.rb +81 -0
  50. data/lib/mundi_api/models/create_plan_request.rb +199 -0
  51. data/lib/mundi_api/models/create_price_bracket_request.rb +62 -0
  52. data/lib/mundi_api/models/create_pricing_scheme_request.rb +69 -0
  53. data/lib/mundi_api/models/create_seller_request.rb +90 -0
  54. data/lib/mundi_api/models/create_setup_request.rb +55 -0
  55. data/lib/mundi_api/models/create_shipping_request.rb +81 -0
  56. data/lib/mundi_api/models/create_subscription_item_request.rb +106 -0
  57. data/lib/mundi_api/models/create_subscription_request.rb +269 -0
  58. data/lib/mundi_api/models/create_token_request.rb +44 -0
  59. data/lib/mundi_api/models/create_usage_request.rb +54 -0
  60. data/lib/mundi_api/models/create_voucher_payment_request.rb +72 -0
  61. data/lib/mundi_api/models/get_access_token_response.rb +73 -0
  62. data/lib/mundi_api/models/get_address_response.rb +163 -0
  63. data/lib/mundi_api/models/get_bank_transfer_transaction_response.rb +118 -0
  64. data/lib/mundi_api/models/get_billing_address_response.rb +98 -0
  65. data/lib/mundi_api/models/get_boleto_transaction_response.rb +137 -0
  66. data/lib/mundi_api/models/get_card_response.rb +164 -0
  67. data/lib/mundi_api/models/get_card_token_response.rb +89 -0
  68. data/lib/mundi_api/models/get_charge_response.rb +184 -0
  69. data/lib/mundi_api/models/get_checkout_payment_settings_response.rb +99 -0
  70. data/lib/mundi_api/models/get_credit_card_transaction_response.rb +163 -0
  71. data/lib/mundi_api/models/get_customer_response.rb +145 -0
  72. data/lib/mundi_api/models/get_discount_response.rb +100 -0
  73. data/lib/mundi_api/models/get_invoice_item_response.rb +73 -0
  74. data/lib/mundi_api/models/get_invoice_response.rb +210 -0
  75. data/lib/mundi_api/models/get_order_item_response.rb +63 -0
  76. data/lib/mundi_api/models/get_order_response.rb +167 -0
  77. data/lib/mundi_api/models/get_period_response.rb +73 -0
  78. data/lib/mundi_api/models/get_phone_response.rb +53 -0
  79. data/lib/mundi_api/models/get_phones_response.rb +46 -0
  80. data/lib/mundi_api/models/get_plan_item_response.rb +127 -0
  81. data/lib/mundi_api/models/get_plan_response.rb +223 -0
  82. data/lib/mundi_api/models/get_price_bracket_response.rb +62 -0
  83. data/lib/mundi_api/models/get_pricing_scheme_response.rb +69 -0
  84. data/lib/mundi_api/models/get_safety_pay_transaction_response.rb +109 -0
  85. data/lib/mundi_api/models/get_seller_response.rb +126 -0
  86. data/lib/mundi_api/models/get_setup_response.rb +62 -0
  87. data/lib/mundi_api/models/get_shipping_response.rb +72 -0
  88. data/lib/mundi_api/models/get_subscription_item_response.rb +135 -0
  89. data/lib/mundi_api/models/get_subscription_response.rb +261 -0
  90. data/lib/mundi_api/models/get_token_response.rb +72 -0
  91. data/lib/mundi_api/models/get_transaction_response.rb +136 -0
  92. data/lib/mundi_api/models/get_usage_response.rb +82 -0
  93. data/lib/mundi_api/models/get_voucher_transaction_response.rb +163 -0
  94. data/lib/mundi_api/models/list_access_tokens_response.rb +51 -0
  95. data/lib/mundi_api/models/list_addresses_response.rb +51 -0
  96. data/lib/mundi_api/models/list_cards_response.rb +51 -0
  97. data/lib/mundi_api/models/list_charges_response.rb +51 -0
  98. data/lib/mundi_api/models/list_customers_response.rb +51 -0
  99. data/lib/mundi_api/models/list_invoices_response.rb +51 -0
  100. data/lib/mundi_api/models/list_order_response.rb +51 -0
  101. data/lib/mundi_api/models/list_plans_response.rb +51 -0
  102. data/lib/mundi_api/models/list_subscription_items_response.rb +51 -0
  103. data/lib/mundi_api/models/list_subscriptions_response.rb +51 -0
  104. data/lib/mundi_api/models/list_transactions_response.rb +51 -0
  105. data/lib/mundi_api/models/list_usages_response.rb +51 -0
  106. data/lib/mundi_api/models/paging_response.rb +53 -0
  107. data/lib/mundi_api/models/update_address_request.rb +53 -0
  108. data/lib/mundi_api/models/update_card_request.rb +81 -0
  109. data/lib/mundi_api/models/update_charge_card_request.rb +62 -0
  110. data/lib/mundi_api/models/update_charge_due_date_request.rb +36 -0
  111. data/lib/mundi_api/models/update_charge_payment_method_request.rb +74 -0
  112. data/lib/mundi_api/models/update_customer_request.rb +90 -0
  113. data/lib/mundi_api/models/update_metadata_request.rb +35 -0
  114. data/lib/mundi_api/models/update_plan_item_request.rb +81 -0
  115. data/lib/mundi_api/models/update_plan_request.rb +161 -0
  116. data/lib/mundi_api/models/update_price_bracket_request.rb +62 -0
  117. data/lib/mundi_api/models/update_pricing_scheme_request.rb +69 -0
  118. data/lib/mundi_api/models/update_subscription_billing_date_request.rb +37 -0
  119. data/lib/mundi_api/models/update_subscription_card_request.rb +44 -0
  120. data/lib/mundi_api/models/update_subscription_item_request.rb +81 -0
  121. data/lib/mundi_api/models/update_subscription_payment_method_request.rb +53 -0
  122. data/lib/mundi_api/mundi_api_client.rb +63 -0
  123. metadata +246 -0
@@ -0,0 +1,51 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Response model for listing the usages from a subscription item
6
+ class ListUsagesResponse < BaseModel
7
+ # The usage objects
8
+ # @return [List of GetUsageResponse]
9
+ attr_accessor :data
10
+
11
+ # Paging object
12
+ # @return [PagingResponse]
13
+ attr_accessor :paging
14
+
15
+ # A mapping from model property names to API property names.
16
+ def self.names
17
+ if @_hash.nil?
18
+ @_hash = {}
19
+ @_hash['data'] = 'data'
20
+ @_hash['paging'] = 'paging'
21
+ end
22
+ @_hash
23
+ end
24
+
25
+ def initialize(data = nil,
26
+ paging = nil)
27
+ @data = data
28
+ @paging = paging
29
+ end
30
+
31
+ # Creates an instance of the object from a hash.
32
+ def self.from_hash(hash)
33
+ return nil unless hash
34
+
35
+ # Extract variables from the hash.
36
+ # Parameter is an array, so we need to iterate through it
37
+ data = nil
38
+ unless hash['data'].nil?
39
+ data = []
40
+ hash['data'].each do |structure|
41
+ data << (GetUsageResponse.from_hash(structure) if structure)
42
+ end
43
+ end
44
+ paging = PagingResponse.from_hash(hash['paging']) if hash['paging']
45
+
46
+ # Create object from extracted values.
47
+ ListUsagesResponse.new(data,
48
+ paging)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,53 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Object used for returning lists of objects with pagination
6
+ class PagingResponse < BaseModel
7
+ # Total number of pages
8
+ # @return [Integer]
9
+ attr_accessor :total
10
+
11
+ # Previous page
12
+ # @return [String]
13
+ attr_accessor :previous
14
+
15
+ # Next page
16
+ # @return [String]
17
+ attr_accessor :mnext
18
+
19
+ # A mapping from model property names to API property names.
20
+ def self.names
21
+ if @_hash.nil?
22
+ @_hash = {}
23
+ @_hash['total'] = 'total'
24
+ @_hash['previous'] = 'previous'
25
+ @_hash['mnext'] = 'next'
26
+ end
27
+ @_hash
28
+ end
29
+
30
+ def initialize(total = nil,
31
+ previous = nil,
32
+ mnext = nil)
33
+ @total = total
34
+ @previous = previous
35
+ @mnext = mnext
36
+ end
37
+
38
+ # Creates an instance of the object from a hash.
39
+ def self.from_hash(hash)
40
+ return nil unless hash
41
+
42
+ # Extract variables from the hash.
43
+ total = hash['total']
44
+ previous = hash['previous']
45
+ mnext = hash['next']
46
+
47
+ # Create object from extracted values.
48
+ PagingResponse.new(total,
49
+ previous,
50
+ mnext)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,53 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating an address
6
+ class UpdateAddressRequest < BaseModel
7
+ # Number
8
+ # @return [String]
9
+ attr_accessor :number
10
+
11
+ # Complement
12
+ # @return [String]
13
+ attr_accessor :complement
14
+
15
+ # Metadata
16
+ # @return [Array<String, String>]
17
+ attr_accessor :metadata
18
+
19
+ # A mapping from model property names to API property names.
20
+ def self.names
21
+ if @_hash.nil?
22
+ @_hash = {}
23
+ @_hash['number'] = 'number'
24
+ @_hash['complement'] = 'complement'
25
+ @_hash['metadata'] = 'metadata'
26
+ end
27
+ @_hash
28
+ end
29
+
30
+ def initialize(number = nil,
31
+ complement = nil,
32
+ metadata = nil)
33
+ @number = number
34
+ @complement = complement
35
+ @metadata = metadata
36
+ end
37
+
38
+ # Creates an instance of the object from a hash.
39
+ def self.from_hash(hash)
40
+ return nil unless hash
41
+
42
+ # Extract variables from the hash.
43
+ number = hash['number']
44
+ complement = hash['complement']
45
+ metadata = hash['metadata']
46
+
47
+ # Create object from extracted values.
48
+ UpdateAddressRequest.new(number,
49
+ complement,
50
+ metadata)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,81 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating a card
6
+ class UpdateCardRequest < BaseModel
7
+ # Holder name
8
+ # @return [String]
9
+ attr_accessor :holder_name
10
+
11
+ # Expiration month
12
+ # @return [Integer]
13
+ attr_accessor :exp_month
14
+
15
+ # Expiration year
16
+ # @return [Integer]
17
+ attr_accessor :exp_year
18
+
19
+ # Id of the address to be used as billing address
20
+ # @return [String]
21
+ attr_accessor :billing_address_id
22
+
23
+ # Billing address
24
+ # @return [CreateAddressRequest]
25
+ attr_accessor :billing_address
26
+
27
+ # Metadata
28
+ # @return [Array<String, String>]
29
+ attr_accessor :metadata
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ if @_hash.nil?
34
+ @_hash = {}
35
+ @_hash['holder_name'] = 'holder_name'
36
+ @_hash['exp_month'] = 'exp_month'
37
+ @_hash['exp_year'] = 'exp_year'
38
+ @_hash['billing_address_id'] = 'billing_address_id'
39
+ @_hash['billing_address'] = 'billing_address'
40
+ @_hash['metadata'] = 'metadata'
41
+ end
42
+ @_hash
43
+ end
44
+
45
+ def initialize(holder_name = nil,
46
+ exp_month = nil,
47
+ exp_year = nil,
48
+ billing_address_id = nil,
49
+ billing_address = nil,
50
+ metadata = nil)
51
+ @holder_name = holder_name
52
+ @exp_month = exp_month
53
+ @exp_year = exp_year
54
+ @billing_address_id = billing_address_id
55
+ @billing_address = billing_address
56
+ @metadata = metadata
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ holder_name = hash['holder_name']
65
+ exp_month = hash['exp_month']
66
+ exp_year = hash['exp_year']
67
+ billing_address_id = hash['billing_address_id']
68
+ billing_address = CreateAddressRequest.from_hash(hash['billing_address']) if
69
+ hash['billing_address']
70
+ metadata = hash['metadata']
71
+
72
+ # Create object from extracted values.
73
+ UpdateCardRequest.new(holder_name,
74
+ exp_month,
75
+ exp_year,
76
+ billing_address_id,
77
+ billing_address,
78
+ metadata)
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,62 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating card data
6
+ class UpdateChargeCardRequest < BaseModel
7
+ # Indicates if the subscriptions using this card must also be updated
8
+ # @return [Boolean]
9
+ attr_accessor :update_subscription
10
+
11
+ # Card id
12
+ # @return [String]
13
+ attr_accessor :card_id
14
+
15
+ # Card data
16
+ # @return [CreateCardRequest]
17
+ attr_accessor :card
18
+
19
+ # Indicates a recurrence
20
+ # @return [Boolean]
21
+ attr_accessor :recurrence
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ if @_hash.nil?
26
+ @_hash = {}
27
+ @_hash['update_subscription'] = 'update_subscription'
28
+ @_hash['card_id'] = 'card_id'
29
+ @_hash['card'] = 'card'
30
+ @_hash['recurrence'] = 'recurrence'
31
+ end
32
+ @_hash
33
+ end
34
+
35
+ def initialize(update_subscription = nil,
36
+ card_id = nil,
37
+ card = nil,
38
+ recurrence = nil)
39
+ @update_subscription = update_subscription
40
+ @card_id = card_id
41
+ @card = card
42
+ @recurrence = recurrence
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ update_subscription = hash['update_subscription']
51
+ card_id = hash['card_id']
52
+ card = CreateCardRequest.from_hash(hash['card']) if hash['card']
53
+ recurrence = hash['recurrence']
54
+
55
+ # Create object from extracted values.
56
+ UpdateChargeCardRequest.new(update_subscription,
57
+ card_id,
58
+ card,
59
+ recurrence)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,36 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # Request for updating a charge due date
7
+ class UpdateChargeDueDateRequest < BaseModel
8
+ # The charge's new due date
9
+ # @return [DateTime]
10
+ attr_accessor :due_at
11
+
12
+ # A mapping from model property names to API property names.
13
+ def self.names
14
+ if @_hash.nil?
15
+ @_hash = {}
16
+ @_hash['due_at'] = 'due_at'
17
+ end
18
+ @_hash
19
+ end
20
+
21
+ def initialize(due_at = nil)
22
+ @due_at = due_at
23
+ end
24
+
25
+ # Creates an instance of the object from a hash.
26
+ def self.from_hash(hash)
27
+ return nil unless hash
28
+
29
+ # Extract variables from the hash.
30
+ due_at = DateTime.rfc3339(hash['due_at']) if hash['due_at']
31
+
32
+ # Create object from extracted values.
33
+ UpdateChargeDueDateRequest.new(due_at)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,74 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating the payment method of a charge
6
+ class UpdateChargePaymentMethodRequest < BaseModel
7
+ # Indicates if the payment method from the subscription must also be updated
8
+ # @return [Boolean]
9
+ attr_accessor :update_subscription
10
+
11
+ # The new payment method
12
+ # @return [String]
13
+ attr_accessor :payment_method
14
+
15
+ # Credit card data
16
+ # @return [CreateCreditCardPaymentRequest]
17
+ attr_accessor :credit_card
18
+
19
+ # Boleto data
20
+ # @return [CreateBoletoPaymentRequest]
21
+ attr_accessor :boleto
22
+
23
+ # Voucher data
24
+ # @return [CreateVoucherPaymentRequest]
25
+ attr_accessor :voucher
26
+
27
+ # A mapping from model property names to API property names.
28
+ def self.names
29
+ if @_hash.nil?
30
+ @_hash = {}
31
+ @_hash['update_subscription'] = 'update_subscription'
32
+ @_hash['payment_method'] = 'payment_method'
33
+ @_hash['credit_card'] = 'credit_card'
34
+ @_hash['boleto'] = 'boleto'
35
+ @_hash['voucher'] = 'voucher'
36
+ end
37
+ @_hash
38
+ end
39
+
40
+ def initialize(update_subscription = nil,
41
+ payment_method = nil,
42
+ credit_card = nil,
43
+ boleto = nil,
44
+ voucher = nil)
45
+ @update_subscription = update_subscription
46
+ @payment_method = payment_method
47
+ @credit_card = credit_card
48
+ @boleto = boleto
49
+ @voucher = voucher
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ update_subscription = hash['update_subscription']
58
+ payment_method = hash['payment_method']
59
+ credit_card = CreateCreditCardPaymentRequest.from_hash(hash['credit_card']) if
60
+ hash['credit_card']
61
+ boleto = CreateBoletoPaymentRequest.from_hash(hash['boleto']) if
62
+ hash['boleto']
63
+ voucher = CreateVoucherPaymentRequest.from_hash(hash['voucher']) if
64
+ hash['voucher']
65
+
66
+ # Create object from extracted values.
67
+ UpdateChargePaymentMethodRequest.new(update_subscription,
68
+ payment_method,
69
+ credit_card,
70
+ boleto,
71
+ voucher)
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,90 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating a customer
6
+ class UpdateCustomerRequest < BaseModel
7
+ # Name
8
+ # @return [String]
9
+ attr_accessor :name
10
+
11
+ # Email
12
+ # @return [String]
13
+ attr_accessor :email
14
+
15
+ # Document number
16
+ # @return [String]
17
+ attr_accessor :document
18
+
19
+ # Person type
20
+ # @return [String]
21
+ attr_accessor :person_type
22
+
23
+ # Address
24
+ # @return [CreateAddressRequest]
25
+ attr_accessor :address
26
+
27
+ # Metadata
28
+ # @return [Array<String, String>]
29
+ attr_accessor :metadata
30
+
31
+ # Metadata
32
+ # @return [CreatePhonesRequest]
33
+ attr_accessor :phones
34
+
35
+ # A mapping from model property names to API property names.
36
+ def self.names
37
+ if @_hash.nil?
38
+ @_hash = {}
39
+ @_hash['name'] = 'name'
40
+ @_hash['email'] = 'email'
41
+ @_hash['document'] = 'document'
42
+ @_hash['person_type'] = 'person_type'
43
+ @_hash['address'] = 'address'
44
+ @_hash['metadata'] = 'metadata'
45
+ @_hash['phones'] = 'phones'
46
+ end
47
+ @_hash
48
+ end
49
+
50
+ def initialize(name = nil,
51
+ email = nil,
52
+ document = nil,
53
+ person_type = nil,
54
+ address = nil,
55
+ metadata = nil,
56
+ phones = nil)
57
+ @name = name
58
+ @email = email
59
+ @document = document
60
+ @person_type = person_type
61
+ @address = address
62
+ @metadata = metadata
63
+ @phones = phones
64
+ end
65
+
66
+ # Creates an instance of the object from a hash.
67
+ def self.from_hash(hash)
68
+ return nil unless hash
69
+
70
+ # Extract variables from the hash.
71
+ name = hash['name']
72
+ email = hash['email']
73
+ document = hash['document']
74
+ person_type = hash['person_type']
75
+ address = CreateAddressRequest.from_hash(hash['address']) if
76
+ hash['address']
77
+ metadata = hash['metadata']
78
+ phones = CreatePhonesRequest.from_hash(hash['phones']) if hash['phones']
79
+
80
+ # Create object from extracted values.
81
+ UpdateCustomerRequest.new(name,
82
+ email,
83
+ document,
84
+ person_type,
85
+ address,
86
+ metadata,
87
+ phones)
88
+ end
89
+ end
90
+ end