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,210 @@
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 an invoice
7
+ class GetInvoiceResponse < 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 [String]
18
+ attr_accessor :url
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Integer]
22
+ attr_accessor :amount
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :status
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :payment_method
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [DateTime]
34
+ attr_accessor :created_at
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [List of GetInvoiceItemResponse]
38
+ attr_accessor :items
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [GetCustomerResponse]
42
+ attr_accessor :customer
43
+
44
+ # TODO: Write general description for this method
45
+ # @return [GetChargeResponse]
46
+ attr_accessor :charge
47
+
48
+ # TODO: Write general description for this method
49
+ # @return [Integer]
50
+ attr_accessor :installments
51
+
52
+ # TODO: Write general description for this method
53
+ # @return [GetBillingAddressResponse]
54
+ attr_accessor :billing_address
55
+
56
+ # TODO: Write general description for this method
57
+ # @return [GetSubscriptionResponse]
58
+ attr_accessor :subscription
59
+
60
+ # TODO: Write general description for this method
61
+ # @return [GetPeriodResponse]
62
+ attr_accessor :cycle
63
+
64
+ # TODO: Write general description for this method
65
+ # @return [GetShippingResponse]
66
+ attr_accessor :shipping
67
+
68
+ # TODO: Write general description for this method
69
+ # @return [DateTime]
70
+ attr_accessor :due_at
71
+
72
+ # TODO: Write general description for this method
73
+ # @return [DateTime]
74
+ attr_accessor :canceled_at
75
+
76
+ # TODO: Write general description for this method
77
+ # @return [DateTime]
78
+ attr_accessor :billing_at
79
+
80
+ # TODO: Write general description for this method
81
+ # @return [DateTime]
82
+ attr_accessor :seen_at
83
+
84
+ # A mapping from model property names to API property names.
85
+ def self.names
86
+ if @_hash.nil?
87
+ @_hash = {}
88
+ @_hash['id'] = 'id'
89
+ @_hash['code'] = 'code'
90
+ @_hash['url'] = 'url'
91
+ @_hash['amount'] = 'amount'
92
+ @_hash['status'] = 'status'
93
+ @_hash['payment_method'] = 'payment_method'
94
+ @_hash['created_at'] = 'created_at'
95
+ @_hash['items'] = 'items'
96
+ @_hash['customer'] = 'customer'
97
+ @_hash['charge'] = 'charge'
98
+ @_hash['installments'] = 'installments'
99
+ @_hash['billing_address'] = 'billing_address'
100
+ @_hash['subscription'] = 'subscription'
101
+ @_hash['cycle'] = 'cycle'
102
+ @_hash['shipping'] = 'shipping'
103
+ @_hash['due_at'] = 'due_at'
104
+ @_hash['canceled_at'] = 'canceled_at'
105
+ @_hash['billing_at'] = 'billing_at'
106
+ @_hash['seen_at'] = 'seen_at'
107
+ end
108
+ @_hash
109
+ end
110
+
111
+ def initialize(id = nil,
112
+ code = nil,
113
+ url = nil,
114
+ amount = nil,
115
+ status = nil,
116
+ payment_method = nil,
117
+ created_at = nil,
118
+ items = nil,
119
+ customer = nil,
120
+ charge = nil,
121
+ installments = nil,
122
+ billing_address = nil,
123
+ subscription = nil,
124
+ cycle = nil,
125
+ shipping = nil,
126
+ due_at = nil,
127
+ canceled_at = nil,
128
+ billing_at = nil,
129
+ seen_at = nil)
130
+ @id = id
131
+ @code = code
132
+ @url = url
133
+ @amount = amount
134
+ @status = status
135
+ @payment_method = payment_method
136
+ @created_at = created_at
137
+ @items = items
138
+ @customer = customer
139
+ @charge = charge
140
+ @installments = installments
141
+ @billing_address = billing_address
142
+ @subscription = subscription
143
+ @cycle = cycle
144
+ @shipping = shipping
145
+ @due_at = due_at
146
+ @canceled_at = canceled_at
147
+ @billing_at = billing_at
148
+ @seen_at = seen_at
149
+ end
150
+
151
+ # Creates an instance of the object from a hash.
152
+ def self.from_hash(hash)
153
+ return nil unless hash
154
+
155
+ # Extract variables from the hash.
156
+ id = hash['id']
157
+ code = hash['code']
158
+ url = hash['url']
159
+ amount = hash['amount']
160
+ status = hash['status']
161
+ payment_method = hash['payment_method']
162
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
163
+ # Parameter is an array, so we need to iterate through it
164
+ items = nil
165
+ unless hash['items'].nil?
166
+ items = []
167
+ hash['items'].each do |structure|
168
+ items << (GetInvoiceItemResponse.from_hash(structure) if structure)
169
+ end
170
+ end
171
+ customer = GetCustomerResponse.from_hash(hash['customer']) if
172
+ hash['customer']
173
+ charge = GetChargeResponse.from_hash(hash['charge']) if hash['charge']
174
+ installments = hash['installments']
175
+ billing_address = GetBillingAddressResponse.from_hash(hash['billing_address']) if
176
+ hash['billing_address']
177
+ subscription = GetSubscriptionResponse.from_hash(hash['subscription']) if
178
+ hash['subscription']
179
+ cycle = GetPeriodResponse.from_hash(hash['cycle']) if hash['cycle']
180
+ shipping = GetShippingResponse.from_hash(hash['shipping']) if
181
+ hash['shipping']
182
+ due_at = DateTime.rfc3339(hash['due_at']) if hash['due_at']
183
+ canceled_at = DateTime.rfc3339(hash['canceled_at']) if
184
+ hash['canceled_at']
185
+ billing_at = DateTime.rfc3339(hash['billing_at']) if hash['billing_at']
186
+ seen_at = DateTime.rfc3339(hash['seen_at']) if hash['seen_at']
187
+
188
+ # Create object from extracted values.
189
+ GetInvoiceResponse.new(id,
190
+ code,
191
+ url,
192
+ amount,
193
+ status,
194
+ payment_method,
195
+ created_at,
196
+ items,
197
+ customer,
198
+ charge,
199
+ installments,
200
+ billing_address,
201
+ subscription,
202
+ cycle,
203
+ shipping,
204
+ due_at,
205
+ canceled_at,
206
+ billing_at,
207
+ seen_at)
208
+ end
209
+ end
210
+ end
@@ -0,0 +1,63 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Response object for getting an order item
6
+ class GetOrderItemResponse < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [Integer]
9
+ attr_accessor :amount
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [String]
13
+ attr_accessor :description
14
+
15
+ # TODO: Write general description for this method
16
+ # @return [Integer]
17
+ attr_accessor :quantity
18
+
19
+ # Seller data
20
+ # @return [GetSellerResponse]
21
+ attr_accessor :get_seller_response
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ if @_hash.nil?
26
+ @_hash = {}
27
+ @_hash['amount'] = 'amount'
28
+ @_hash['description'] = 'description'
29
+ @_hash['quantity'] = 'quantity'
30
+ @_hash['get_seller_response'] = 'GetSellerResponse'
31
+ end
32
+ @_hash
33
+ end
34
+
35
+ def initialize(amount = nil,
36
+ description = nil,
37
+ quantity = nil,
38
+ get_seller_response = nil)
39
+ @amount = amount
40
+ @description = description
41
+ @quantity = quantity
42
+ @get_seller_response = get_seller_response
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
+ amount = hash['amount']
51
+ description = hash['description']
52
+ quantity = hash['quantity']
53
+ get_seller_response = GetSellerResponse.from_hash(hash['GetSellerResponse']) if
54
+ hash['GetSellerResponse']
55
+
56
+ # Create object from extracted values.
57
+ GetOrderItemResponse.new(amount,
58
+ description,
59
+ quantity,
60
+ get_seller_response)
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,167 @@
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 an Order
7
+ class GetOrderResponse < 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 [String]
18
+ attr_accessor :currency
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [List of GetOrderItemResponse]
22
+ attr_accessor :items
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [GetCustomerResponse]
26
+ attr_accessor :customer
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :status
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [DateTime]
34
+ attr_accessor :created_at
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [DateTime]
38
+ attr_accessor :updated_at
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [List of GetChargeResponse]
42
+ attr_accessor :charges
43
+
44
+ # TODO: Write general description for this method
45
+ # @return [String]
46
+ attr_accessor :invoice_url
47
+
48
+ # TODO: Write general description for this method
49
+ # @return [GetShippingResponse]
50
+ attr_accessor :shipping
51
+
52
+ # TODO: Write general description for this method
53
+ # @return [Array<String, String>]
54
+ attr_accessor :metadata
55
+
56
+ # Checkout Payment Settings Response
57
+ # @return [List of GetCheckoutPaymentSettingsResponse]
58
+ attr_accessor :checkouts
59
+
60
+ # A mapping from model property names to API property names.
61
+ def self.names
62
+ if @_hash.nil?
63
+ @_hash = {}
64
+ @_hash['id'] = 'id'
65
+ @_hash['code'] = 'code'
66
+ @_hash['currency'] = 'currency'
67
+ @_hash['items'] = 'items'
68
+ @_hash['customer'] = 'customer'
69
+ @_hash['status'] = 'status'
70
+ @_hash['created_at'] = 'created_at'
71
+ @_hash['updated_at'] = 'updated_at'
72
+ @_hash['charges'] = 'charges'
73
+ @_hash['invoice_url'] = 'invoice_url'
74
+ @_hash['shipping'] = 'shipping'
75
+ @_hash['metadata'] = 'metadata'
76
+ @_hash['checkouts'] = 'checkouts'
77
+ end
78
+ @_hash
79
+ end
80
+
81
+ def initialize(id = nil,
82
+ code = nil,
83
+ currency = nil,
84
+ items = nil,
85
+ customer = nil,
86
+ status = nil,
87
+ created_at = nil,
88
+ updated_at = nil,
89
+ charges = nil,
90
+ invoice_url = nil,
91
+ shipping = nil,
92
+ metadata = nil,
93
+ checkouts = nil)
94
+ @id = id
95
+ @code = code
96
+ @currency = currency
97
+ @items = items
98
+ @customer = customer
99
+ @status = status
100
+ @created_at = created_at
101
+ @updated_at = updated_at
102
+ @charges = charges
103
+ @invoice_url = invoice_url
104
+ @shipping = shipping
105
+ @metadata = metadata
106
+ @checkouts = checkouts
107
+ end
108
+
109
+ # Creates an instance of the object from a hash.
110
+ def self.from_hash(hash)
111
+ return nil unless hash
112
+
113
+ # Extract variables from the hash.
114
+ id = hash['id']
115
+ code = hash['code']
116
+ currency = hash['currency']
117
+ # Parameter is an array, so we need to iterate through it
118
+ items = nil
119
+ unless hash['items'].nil?
120
+ items = []
121
+ hash['items'].each do |structure|
122
+ items << (GetOrderItemResponse.from_hash(structure) if structure)
123
+ end
124
+ end
125
+ customer = GetCustomerResponse.from_hash(hash['customer']) if
126
+ hash['customer']
127
+ status = hash['status']
128
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
129
+ updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
130
+ # Parameter is an array, so we need to iterate through it
131
+ charges = nil
132
+ unless hash['charges'].nil?
133
+ charges = []
134
+ hash['charges'].each do |structure|
135
+ charges << (GetChargeResponse.from_hash(structure) if structure)
136
+ end
137
+ end
138
+ invoice_url = hash['invoice_url']
139
+ shipping = GetShippingResponse.from_hash(hash['shipping']) if
140
+ hash['shipping']
141
+ metadata = hash['metadata']
142
+ # Parameter is an array, so we need to iterate through it
143
+ checkouts = nil
144
+ unless hash['checkouts'].nil?
145
+ checkouts = []
146
+ hash['checkouts'].each do |structure|
147
+ checkouts << (GetCheckoutPaymentSettingsResponse.from_hash(structure) if structure)
148
+ end
149
+ end
150
+
151
+ # Create object from extracted values.
152
+ GetOrderResponse.new(id,
153
+ code,
154
+ currency,
155
+ items,
156
+ customer,
157
+ status,
158
+ created_at,
159
+ updated_at,
160
+ charges,
161
+ invoice_url,
162
+ shipping,
163
+ metadata,
164
+ checkouts)
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,73 @@
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 period
7
+ class GetPeriodResponse < BaseModel
8
+ # TODO: Write general description for this method
9
+ # @return [DateTime]
10
+ attr_accessor :start_at
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [DateTime]
14
+ attr_accessor :end_at
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :id
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [DateTime]
22
+ attr_accessor :billing_at
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [GetSubscriptionResponse]
26
+ attr_accessor :subscription
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ if @_hash.nil?
31
+ @_hash = {}
32
+ @_hash['start_at'] = 'start_at'
33
+ @_hash['end_at'] = 'end_at'
34
+ @_hash['id'] = 'id'
35
+ @_hash['billing_at'] = 'billing_at'
36
+ @_hash['subscription'] = 'subscription'
37
+ end
38
+ @_hash
39
+ end
40
+
41
+ def initialize(start_at = nil,
42
+ end_at = nil,
43
+ id = nil,
44
+ billing_at = nil,
45
+ subscription = nil)
46
+ @start_at = start_at
47
+ @end_at = end_at
48
+ @id = id
49
+ @billing_at = billing_at
50
+ @subscription = subscription
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
+ start_at = DateTime.rfc3339(hash['start_at']) if hash['start_at']
59
+ end_at = DateTime.rfc3339(hash['end_at']) if hash['end_at']
60
+ id = hash['id']
61
+ billing_at = DateTime.rfc3339(hash['billing_at']) if hash['billing_at']
62
+ subscription = GetSubscriptionResponse.from_hash(hash['subscription']) if
63
+ hash['subscription']
64
+
65
+ # Create object from extracted values.
66
+ GetPeriodResponse.new(start_at,
67
+ end_at,
68
+ id,
69
+ billing_at,
70
+ subscription)
71
+ end
72
+ end
73
+ end