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,136 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # Generic response object for getting a transaction.
7
+ class GetTransactionResponse < BaseModel
8
+ # Gateway transaction id
9
+ # @return [String]
10
+ attr_accessor :gateway_id
11
+
12
+ # Amount in cents
13
+ # @return [Integer]
14
+ attr_accessor :amount
15
+
16
+ # Transaction status
17
+ # @return [String]
18
+ attr_accessor :status
19
+
20
+ # Indicates if the transaction ocurred successfuly
21
+ # @return [Boolean]
22
+ attr_accessor :success
23
+
24
+ # Creation date
25
+ # @return [DateTime]
26
+ attr_accessor :created_at
27
+
28
+ # Last update date
29
+ # @return [DateTime]
30
+ attr_accessor :updated_at
31
+
32
+ # Number of attempts tried
33
+ # @return [Integer]
34
+ attr_accessor :attempt_count
35
+
36
+ # Max attempts
37
+ # @return [Integer]
38
+ attr_accessor :max_attempts
39
+
40
+ # Date and time of the next attempt
41
+ # @return [DateTime]
42
+ attr_accessor :next_attempt
43
+
44
+ # Date and time of the next attempt
45
+ # @return [String]
46
+ attr_accessor :transaction_type
47
+
48
+ # Discriminators mapping.
49
+ def self.discriminators
50
+ if @_discriminators.nil?
51
+ @_discriminators = {}
52
+ @_discriminators['boleto'] = GetBoletoTransactionResponse.method(:from_hash)
53
+ @_discriminators['credit_card'] = GetCreditCardTransactionResponse.method(:from_hash)
54
+ @_discriminators['voucher'] = GetVoucherTransactionResponse.method(:from_hash)
55
+ @_discriminators['bank_transfer'] = GetBankTransferTransactionResponse.method(:from_hash)
56
+ @_discriminators['safetypay'] = GetSafetyPayTransactionResponse.method(:from_hash)
57
+ end
58
+ @_discriminators
59
+ end
60
+
61
+ # A mapping from model property names to API property names.
62
+ def self.names
63
+ if @_hash.nil?
64
+ @_hash = {}
65
+ @_hash['gateway_id'] = 'gateway_id'
66
+ @_hash['amount'] = 'amount'
67
+ @_hash['status'] = 'status'
68
+ @_hash['success'] = 'success'
69
+ @_hash['created_at'] = 'created_at'
70
+ @_hash['updated_at'] = 'updated_at'
71
+ @_hash['attempt_count'] = 'attempt_count'
72
+ @_hash['max_attempts'] = 'max_attempts'
73
+ @_hash['next_attempt'] = 'next_attempt'
74
+ @_hash['transaction_type'] = 'transaction_type'
75
+ end
76
+ @_hash
77
+ end
78
+
79
+ def initialize(gateway_id = nil,
80
+ amount = nil,
81
+ status = nil,
82
+ success = nil,
83
+ created_at = nil,
84
+ updated_at = nil,
85
+ attempt_count = nil,
86
+ max_attempts = nil,
87
+ next_attempt = nil,
88
+ transaction_type = nil)
89
+ @gateway_id = gateway_id
90
+ @amount = amount
91
+ @status = status
92
+ @success = success
93
+ @created_at = created_at
94
+ @updated_at = updated_at
95
+ @attempt_count = attempt_count
96
+ @max_attempts = max_attempts
97
+ @next_attempt = next_attempt
98
+ @transaction_type = transaction_type
99
+ end
100
+
101
+ # Creates an instance of the object from a hash.
102
+ def self.from_hash(hash)
103
+ return nil unless hash
104
+
105
+ # Delegate unboxing to another function if a discriminator
106
+ # value for a child class is present.
107
+ unboxer = discriminators[hash['transaction_type']]
108
+ return unboxer.call(hash) if unboxer
109
+
110
+ # Extract variables from the hash.
111
+ gateway_id = hash['gateway_id']
112
+ amount = hash['amount']
113
+ status = hash['status']
114
+ success = hash['success']
115
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
116
+ updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
117
+ attempt_count = hash['attempt_count']
118
+ max_attempts = hash['max_attempts']
119
+ next_attempt = DateTime.rfc3339(hash['next_attempt']) if
120
+ hash['next_attempt']
121
+ transaction_type = hash['transaction_type']
122
+
123
+ # Create object from extracted values.
124
+ GetTransactionResponse.new(gateway_id,
125
+ amount,
126
+ status,
127
+ success,
128
+ created_at,
129
+ updated_at,
130
+ attempt_count,
131
+ max_attempts,
132
+ next_attempt,
133
+ transaction_type)
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,82 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # Response object for getting a usage
7
+ class GetUsageResponse < BaseModel
8
+ # Id
9
+ # @return [String]
10
+ attr_accessor :id
11
+
12
+ # Quantity
13
+ # @return [Integer]
14
+ attr_accessor :quantity
15
+
16
+ # Description
17
+ # @return [String]
18
+ attr_accessor :description
19
+
20
+ # Used at
21
+ # @return [DateTime]
22
+ attr_accessor :used_at
23
+
24
+ # Creation date
25
+ # @return [DateTime]
26
+ attr_accessor :created_at
27
+
28
+ # Subscription item
29
+ # @return [GetSubscriptionItemResponse]
30
+ attr_accessor :subscription_item
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ if @_hash.nil?
35
+ @_hash = {}
36
+ @_hash['id'] = 'id'
37
+ @_hash['quantity'] = 'quantity'
38
+ @_hash['description'] = 'description'
39
+ @_hash['used_at'] = 'used_at'
40
+ @_hash['created_at'] = 'created_at'
41
+ @_hash['subscription_item'] = 'subscription_item'
42
+ end
43
+ @_hash
44
+ end
45
+
46
+ def initialize(id = nil,
47
+ quantity = nil,
48
+ description = nil,
49
+ used_at = nil,
50
+ created_at = nil,
51
+ subscription_item = nil)
52
+ @id = id
53
+ @quantity = quantity
54
+ @description = description
55
+ @used_at = used_at
56
+ @created_at = created_at
57
+ @subscription_item = subscription_item
58
+ end
59
+
60
+ # Creates an instance of the object from a hash.
61
+ def self.from_hash(hash)
62
+ return nil unless hash
63
+
64
+ # Extract variables from the hash.
65
+ id = hash['id']
66
+ quantity = hash['quantity']
67
+ description = hash['description']
68
+ used_at = DateTime.rfc3339(hash['used_at']) if hash['used_at']
69
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
70
+ subscription_item = GetSubscriptionItemResponse.from_hash(hash['subscription_item']) if
71
+ hash['subscription_item']
72
+
73
+ # Create object from extracted values.
74
+ GetUsageResponse.new(id,
75
+ quantity,
76
+ description,
77
+ used_at,
78
+ created_at,
79
+ subscription_item)
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,163 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ require_relative 'get_transaction_response'
6
+
7
+ module MundiApi
8
+ # Response for voucher transactions
9
+ class GetVoucherTransactionResponse < GetTransactionResponse
10
+ # Text that will appear on the voucher's statement
11
+ # @return [String]
12
+ attr_accessor :statement_descriptor
13
+
14
+ # Acquirer name
15
+ # @return [String]
16
+ attr_accessor :acquirer_name
17
+
18
+ # Acquirer affiliation code
19
+ # @return [String]
20
+ attr_accessor :acquirer_affiliation_code
21
+
22
+ # Acquirer TID
23
+ # @return [String]
24
+ attr_accessor :acquirer_tid
25
+
26
+ # Acquirer NSU
27
+ # @return [String]
28
+ attr_accessor :acquirer_nsu
29
+
30
+ # Acquirer authorization code
31
+ # @return [String]
32
+ attr_accessor :acquirer_auth_code
33
+
34
+ # acquirer_message
35
+ # @return [String]
36
+ attr_accessor :acquirer_message
37
+
38
+ # Acquirer return code
39
+ # @return [String]
40
+ attr_accessor :acquirer_return_code
41
+
42
+ # Operation type
43
+ # @return [String]
44
+ attr_accessor :operation_type
45
+
46
+ # Card data
47
+ # @return [GetCardResponse]
48
+ attr_accessor :card
49
+
50
+ # A mapping from model property names to API property names.
51
+ def self.names
52
+ if @_hash.nil?
53
+ @_hash = {}
54
+ @_hash['statement_descriptor'] = 'statement_descriptor'
55
+ @_hash['acquirer_name'] = 'acquirer_name'
56
+ @_hash['acquirer_affiliation_code'] = 'acquirer_affiliation_code'
57
+ @_hash['acquirer_tid'] = 'acquirer_tid'
58
+ @_hash['acquirer_nsu'] = 'acquirer_nsu'
59
+ @_hash['acquirer_auth_code'] = 'acquirer_auth_code'
60
+ @_hash['acquirer_message'] = 'acquirer_message'
61
+ @_hash['acquirer_return_code'] = 'acquirer_return_code'
62
+ @_hash['operation_type'] = 'operation_type'
63
+ @_hash['card'] = 'card'
64
+ @_hash = super().merge(@_hash)
65
+ end
66
+ @_hash
67
+ end
68
+
69
+ def initialize(statement_descriptor = nil,
70
+ acquirer_name = nil,
71
+ acquirer_affiliation_code = nil,
72
+ acquirer_tid = nil,
73
+ acquirer_nsu = nil,
74
+ acquirer_auth_code = nil,
75
+ acquirer_message = nil,
76
+ acquirer_return_code = nil,
77
+ operation_type = nil,
78
+ card = nil,
79
+ gateway_id = nil,
80
+ amount = nil,
81
+ status = nil,
82
+ success = nil,
83
+ created_at = nil,
84
+ updated_at = nil,
85
+ attempt_count = nil,
86
+ max_attempts = nil,
87
+ next_attempt = nil,
88
+ transaction_type = nil)
89
+ @statement_descriptor = statement_descriptor
90
+ @acquirer_name = acquirer_name
91
+ @acquirer_affiliation_code = acquirer_affiliation_code
92
+ @acquirer_tid = acquirer_tid
93
+ @acquirer_nsu = acquirer_nsu
94
+ @acquirer_auth_code = acquirer_auth_code
95
+ @acquirer_message = acquirer_message
96
+ @acquirer_return_code = acquirer_return_code
97
+ @operation_type = operation_type
98
+ @card = card
99
+
100
+ # Call the constructor of the base class
101
+ super(gateway_id,
102
+ amount,
103
+ status,
104
+ success,
105
+ created_at,
106
+ updated_at,
107
+ attempt_count,
108
+ max_attempts,
109
+ next_attempt,
110
+ transaction_type)
111
+ end
112
+
113
+ # Creates an instance of the object from a hash.
114
+ def self.from_hash(hash)
115
+ return nil unless hash
116
+
117
+ # Extract variables from the hash.
118
+ statement_descriptor = hash['statement_descriptor']
119
+ acquirer_name = hash['acquirer_name']
120
+ acquirer_affiliation_code = hash['acquirer_affiliation_code']
121
+ acquirer_tid = hash['acquirer_tid']
122
+ acquirer_nsu = hash['acquirer_nsu']
123
+ acquirer_auth_code = hash['acquirer_auth_code']
124
+ acquirer_message = hash['acquirer_message']
125
+ acquirer_return_code = hash['acquirer_return_code']
126
+ operation_type = hash['operation_type']
127
+ card = GetCardResponse.from_hash(hash['card']) if hash['card']
128
+ gateway_id = hash['gateway_id']
129
+ amount = hash['amount']
130
+ status = hash['status']
131
+ success = hash['success']
132
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
133
+ updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
134
+ attempt_count = hash['attempt_count']
135
+ max_attempts = hash['max_attempts']
136
+ next_attempt = DateTime.rfc3339(hash['next_attempt']) if
137
+ hash['next_attempt']
138
+ transaction_type = hash['transaction_type']
139
+
140
+ # Create object from extracted values.
141
+ GetVoucherTransactionResponse.new(statement_descriptor,
142
+ acquirer_name,
143
+ acquirer_affiliation_code,
144
+ acquirer_tid,
145
+ acquirer_nsu,
146
+ acquirer_auth_code,
147
+ acquirer_message,
148
+ acquirer_return_code,
149
+ operation_type,
150
+ card,
151
+ gateway_id,
152
+ amount,
153
+ status,
154
+ success,
155
+ created_at,
156
+ updated_at,
157
+ attempt_count,
158
+ max_attempts,
159
+ next_attempt,
160
+ transaction_type)
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,51 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Response object for listing access tokens
6
+ class ListAccessTokensResponse < BaseModel
7
+ # The access token objects
8
+ # @return [List of GetAccessTokenResponse]
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 << (GetAccessTokenResponse.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
+ ListAccessTokensResponse.new(data,
48
+ paging)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Response object for listing addresses
6
+ class ListAddressesResponse < BaseModel
7
+ # The address objects
8
+ # @return [List of GetAddressResponse]
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 << (GetAddressResponse.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
+ ListAddressesResponse.new(data,
48
+ paging)
49
+ end
50
+ end
51
+ end