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,135 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # GetSubscriptionItemResponse Model.
7
+ class GetSubscriptionItemResponse < BaseModel
8
+ # TODO: Write general description for this method
9
+ # @return [String]
10
+ attr_accessor :id
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :description
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :status
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [DateTime]
22
+ attr_accessor :created_at
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [DateTime]
26
+ attr_accessor :updated_at
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [GetPricingSchemeResponse]
30
+ attr_accessor :pricing_scheme
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [List of GetDiscountResponse]
34
+ attr_accessor :discounts
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [GetSubscriptionResponse]
38
+ attr_accessor :subscription
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [Integer]
42
+ attr_accessor :quantity
43
+
44
+ # TODO: Write general description for this method
45
+ # @return [Integer]
46
+ attr_accessor :cycles
47
+
48
+ # TODO: Write general description for this method
49
+ # @return [DateTime]
50
+ attr_accessor :deleted_at
51
+
52
+ # A mapping from model property names to API property names.
53
+ def self.names
54
+ if @_hash.nil?
55
+ @_hash = {}
56
+ @_hash['id'] = 'id'
57
+ @_hash['description'] = 'description'
58
+ @_hash['status'] = 'status'
59
+ @_hash['created_at'] = 'created_at'
60
+ @_hash['updated_at'] = 'updated_at'
61
+ @_hash['pricing_scheme'] = 'pricing_scheme'
62
+ @_hash['discounts'] = 'discounts'
63
+ @_hash['subscription'] = 'subscription'
64
+ @_hash['quantity'] = 'quantity'
65
+ @_hash['cycles'] = 'cycles'
66
+ @_hash['deleted_at'] = 'deleted_at'
67
+ end
68
+ @_hash
69
+ end
70
+
71
+ def initialize(id = nil,
72
+ description = nil,
73
+ status = nil,
74
+ created_at = nil,
75
+ updated_at = nil,
76
+ pricing_scheme = nil,
77
+ discounts = nil,
78
+ subscription = nil,
79
+ quantity = nil,
80
+ cycles = nil,
81
+ deleted_at = nil)
82
+ @id = id
83
+ @description = description
84
+ @status = status
85
+ @created_at = created_at
86
+ @updated_at = updated_at
87
+ @pricing_scheme = pricing_scheme
88
+ @discounts = discounts
89
+ @subscription = subscription
90
+ @quantity = quantity
91
+ @cycles = cycles
92
+ @deleted_at = deleted_at
93
+ end
94
+
95
+ # Creates an instance of the object from a hash.
96
+ def self.from_hash(hash)
97
+ return nil unless hash
98
+
99
+ # Extract variables from the hash.
100
+ id = hash['id']
101
+ description = hash['description']
102
+ status = hash['status']
103
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
104
+ updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
105
+ pricing_scheme = GetPricingSchemeResponse.from_hash(hash['pricing_scheme']) if
106
+ hash['pricing_scheme']
107
+ # Parameter is an array, so we need to iterate through it
108
+ discounts = nil
109
+ unless hash['discounts'].nil?
110
+ discounts = []
111
+ hash['discounts'].each do |structure|
112
+ discounts << (GetDiscountResponse.from_hash(structure) if structure)
113
+ end
114
+ end
115
+ subscription = GetSubscriptionResponse.from_hash(hash['subscription']) if
116
+ hash['subscription']
117
+ quantity = hash['quantity']
118
+ cycles = hash['cycles']
119
+ deleted_at = DateTime.rfc3339(hash['deleted_at']) if hash['deleted_at']
120
+
121
+ # Create object from extracted values.
122
+ GetSubscriptionItemResponse.new(id,
123
+ description,
124
+ status,
125
+ created_at,
126
+ updated_at,
127
+ pricing_scheme,
128
+ discounts,
129
+ subscription,
130
+ quantity,
131
+ cycles,
132
+ deleted_at)
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,261 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # GetSubscriptionResponse Model.
7
+ class GetSubscriptionResponse < BaseModel
8
+ # TODO: Write general description for this method
9
+ # @return [String]
10
+ attr_accessor :id
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :code
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [DateTime]
18
+ attr_accessor :start_at
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :interval
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [Integer]
26
+ attr_accessor :interval_count
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :billing_type
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [GetPeriodResponse]
34
+ attr_accessor :current_period
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [String]
38
+ attr_accessor :payment_method
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [String]
42
+ attr_accessor :currency
43
+
44
+ # TODO: Write general description for this method
45
+ # @return [Integer]
46
+ attr_accessor :installments
47
+
48
+ # TODO: Write general description for this method
49
+ # @return [String]
50
+ attr_accessor :status
51
+
52
+ # TODO: Write general description for this method
53
+ # @return [DateTime]
54
+ attr_accessor :created_at
55
+
56
+ # TODO: Write general description for this method
57
+ # @return [DateTime]
58
+ attr_accessor :updated_at
59
+
60
+ # TODO: Write general description for this method
61
+ # @return [GetCustomerResponse]
62
+ attr_accessor :customer
63
+
64
+ # TODO: Write general description for this method
65
+ # @return [GetCardResponse]
66
+ attr_accessor :card
67
+
68
+ # TODO: Write general description for this method
69
+ # @return [List of GetSubscriptionItemResponse]
70
+ attr_accessor :items
71
+
72
+ # TODO: Write general description for this method
73
+ # @return [String]
74
+ attr_accessor :statement_descriptor
75
+
76
+ # TODO: Write general description for this method
77
+ # @return [Array<String, String>]
78
+ attr_accessor :metadata
79
+
80
+ # TODO: Write general description for this method
81
+ # @return [GetSetupResponse]
82
+ attr_accessor :setup
83
+
84
+ # TODO: Write general description for this method
85
+ # @return [DateTime]
86
+ attr_accessor :next_billing_at
87
+
88
+ # TODO: Write general description for this method
89
+ # @return [Integer]
90
+ attr_accessor :billing_day
91
+
92
+ # TODO: Write general description for this method
93
+ # @return [Integer]
94
+ attr_accessor :minimum_price
95
+
96
+ # TODO: Write general description for this method
97
+ # @return [DateTime]
98
+ attr_accessor :canceled_at
99
+
100
+ # Subscription discounts
101
+ # @return [List of GetDiscountResponse]
102
+ attr_accessor :discounts
103
+
104
+ # A mapping from model property names to API property names.
105
+ def self.names
106
+ if @_hash.nil?
107
+ @_hash = {}
108
+ @_hash['id'] = 'id'
109
+ @_hash['code'] = 'code'
110
+ @_hash['start_at'] = 'start_at'
111
+ @_hash['interval'] = 'interval'
112
+ @_hash['interval_count'] = 'interval_count'
113
+ @_hash['billing_type'] = 'billing_type'
114
+ @_hash['current_period'] = 'current_period'
115
+ @_hash['payment_method'] = 'payment_method'
116
+ @_hash['currency'] = 'currency'
117
+ @_hash['installments'] = 'installments'
118
+ @_hash['status'] = 'status'
119
+ @_hash['created_at'] = 'created_at'
120
+ @_hash['updated_at'] = 'updated_at'
121
+ @_hash['customer'] = 'customer'
122
+ @_hash['card'] = 'card'
123
+ @_hash['items'] = 'items'
124
+ @_hash['statement_descriptor'] = 'statement_descriptor'
125
+ @_hash['metadata'] = 'metadata'
126
+ @_hash['setup'] = 'setup'
127
+ @_hash['next_billing_at'] = 'next_billing_at'
128
+ @_hash['billing_day'] = 'billing_day'
129
+ @_hash['minimum_price'] = 'minimum_price'
130
+ @_hash['canceled_at'] = 'canceled_at'
131
+ @_hash['discounts'] = 'discounts'
132
+ end
133
+ @_hash
134
+ end
135
+
136
+ def initialize(id = nil,
137
+ code = nil,
138
+ start_at = nil,
139
+ interval = nil,
140
+ interval_count = nil,
141
+ billing_type = nil,
142
+ current_period = nil,
143
+ payment_method = nil,
144
+ currency = nil,
145
+ installments = nil,
146
+ status = nil,
147
+ created_at = nil,
148
+ updated_at = nil,
149
+ customer = nil,
150
+ card = nil,
151
+ items = nil,
152
+ statement_descriptor = nil,
153
+ metadata = nil,
154
+ setup = nil,
155
+ next_billing_at = nil,
156
+ billing_day = nil,
157
+ minimum_price = nil,
158
+ canceled_at = nil,
159
+ discounts = nil)
160
+ @id = id
161
+ @code = code
162
+ @start_at = start_at
163
+ @interval = interval
164
+ @interval_count = interval_count
165
+ @billing_type = billing_type
166
+ @current_period = current_period
167
+ @payment_method = payment_method
168
+ @currency = currency
169
+ @installments = installments
170
+ @status = status
171
+ @created_at = created_at
172
+ @updated_at = updated_at
173
+ @customer = customer
174
+ @card = card
175
+ @items = items
176
+ @statement_descriptor = statement_descriptor
177
+ @metadata = metadata
178
+ @setup = setup
179
+ @next_billing_at = next_billing_at
180
+ @billing_day = billing_day
181
+ @minimum_price = minimum_price
182
+ @canceled_at = canceled_at
183
+ @discounts = discounts
184
+ end
185
+
186
+ # Creates an instance of the object from a hash.
187
+ def self.from_hash(hash)
188
+ return nil unless hash
189
+
190
+ # Extract variables from the hash.
191
+ id = hash['id']
192
+ code = hash['code']
193
+ start_at = DateTime.rfc3339(hash['start_at']) if hash['start_at']
194
+ interval = hash['interval']
195
+ interval_count = hash['interval_count']
196
+ billing_type = hash['billing_type']
197
+ current_period = GetPeriodResponse.from_hash(hash['current_period']) if
198
+ hash['current_period']
199
+ payment_method = hash['payment_method']
200
+ currency = hash['currency']
201
+ installments = hash['installments']
202
+ status = hash['status']
203
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
204
+ updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
205
+ customer = GetCustomerResponse.from_hash(hash['customer']) if
206
+ hash['customer']
207
+ card = GetCardResponse.from_hash(hash['card']) if hash['card']
208
+ # Parameter is an array, so we need to iterate through it
209
+ items = nil
210
+ unless hash['items'].nil?
211
+ items = []
212
+ hash['items'].each do |structure|
213
+ items << (GetSubscriptionItemResponse.from_hash(structure) if structure)
214
+ end
215
+ end
216
+ statement_descriptor = hash['statement_descriptor']
217
+ metadata = hash['metadata']
218
+ setup = GetSetupResponse.from_hash(hash['setup']) if hash['setup']
219
+ next_billing_at = DateTime.rfc3339(hash['next_billing_at']) if
220
+ hash['next_billing_at']
221
+ billing_day = hash['billing_day']
222
+ minimum_price = hash['minimum_price']
223
+ canceled_at = DateTime.rfc3339(hash['canceled_at']) if
224
+ hash['canceled_at']
225
+ # Parameter is an array, so we need to iterate through it
226
+ discounts = nil
227
+ unless hash['discounts'].nil?
228
+ discounts = []
229
+ hash['discounts'].each do |structure|
230
+ discounts << (GetDiscountResponse.from_hash(structure) if structure)
231
+ end
232
+ end
233
+
234
+ # Create object from extracted values.
235
+ GetSubscriptionResponse.new(id,
236
+ code,
237
+ start_at,
238
+ interval,
239
+ interval_count,
240
+ billing_type,
241
+ current_period,
242
+ payment_method,
243
+ currency,
244
+ installments,
245
+ status,
246
+ created_at,
247
+ updated_at,
248
+ customer,
249
+ card,
250
+ items,
251
+ statement_descriptor,
252
+ metadata,
253
+ setup,
254
+ next_billing_at,
255
+ billing_day,
256
+ minimum_price,
257
+ canceled_at,
258
+ discounts)
259
+ end
260
+ end
261
+ end
@@ -0,0 +1,72 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # Token data
7
+ class GetTokenResponse < BaseModel
8
+ # TODO: Write general description for this method
9
+ # @return [String]
10
+ attr_accessor :id
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :type
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [DateTime]
18
+ attr_accessor :created_at
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :expires_at
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [GetCardTokenResponse]
26
+ attr_accessor :card
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ if @_hash.nil?
31
+ @_hash = {}
32
+ @_hash['id'] = 'id'
33
+ @_hash['type'] = 'type'
34
+ @_hash['created_at'] = 'created_at'
35
+ @_hash['expires_at'] = 'expires_at'
36
+ @_hash['card'] = 'card'
37
+ end
38
+ @_hash
39
+ end
40
+
41
+ def initialize(id = nil,
42
+ type = nil,
43
+ created_at = nil,
44
+ expires_at = nil,
45
+ card = nil)
46
+ @id = id
47
+ @type = type
48
+ @created_at = created_at
49
+ @expires_at = expires_at
50
+ @card = card
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ id = hash['id']
59
+ type = hash['type']
60
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
61
+ expires_at = hash['expires_at']
62
+ card = GetCardTokenResponse.from_hash(hash['card']) if hash['card']
63
+
64
+ # Create object from extracted values.
65
+ GetTokenResponse.new(id,
66
+ type,
67
+ created_at,
68
+ expires_at,
69
+ card)
70
+ end
71
+ end
72
+ end