vantage-client 0.0.8 → 0.1.0.beta.2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +120 -62
- data/docs/Cost.md +11 -0
- data/docs/Costs.md +11 -0
- data/docs/CostsApi.md +177 -0
- data/docs/PingApi.md +1 -1
- data/docs/PricesApi.md +30 -7
- data/docs/Report.md +13 -0
- data/docs/Reports.md +9 -0
- data/lib/vantage-client/api/costs_api.rb +185 -0
- data/lib/vantage-client/api/ping_api.rb +3 -3
- data/lib/vantage-client/api/prices_api.rb +25 -1
- data/lib/vantage-client/api_client.rb +1 -1
- data/lib/vantage-client/api_error.rb +1 -1
- data/lib/vantage-client/configuration.rb +1 -1
- data/lib/vantage-client/models/cost.rb +215 -0
- data/lib/vantage-client/models/costs.rb +216 -0
- data/lib/vantage-client/models/price.rb +1 -1
- data/lib/vantage-client/models/prices.rb +1 -1
- data/lib/vantage-client/models/product.rb +1 -1
- data/lib/vantage-client/models/products.rb +1 -1
- data/lib/vantage-client/models/provider.rb +1 -1
- data/lib/vantage-client/models/providers.rb +1 -1
- data/lib/vantage-client/models/report.rb +235 -0
- data/lib/vantage-client/models/reports.rb +196 -0
- data/lib/vantage-client/models/service.rb +1 -1
- data/lib/vantage-client/models/services.rb +1 -1
- data/lib/vantage-client/version.rb +2 -2
- data/lib/vantage-client.rb +6 -1
- data/spec/.DS_Store +0 -0
- data/spec/api/costs_api_spec.rb +73 -0
- data/spec/api/ping_api_spec.rb +2 -2
- data/spec/api/prices_api_spec.rb +9 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/cost_spec.rb +59 -0
- data/spec/models/costs_spec.rb +59 -0
- data/spec/models/price_spec.rb +1 -1
- data/spec/models/prices_spec.rb +1 -1
- data/spec/models/product_spec.rb +1 -1
- data/spec/models/products_spec.rb +1 -1
- data/spec/models/provider_spec.rb +1 -1
- data/spec/models/providers_spec.rb +1 -1
- data/spec/models/report_spec.rb +71 -0
- data/spec/models/reports_spec.rb +47 -0
- data/spec/models/service_spec.rb +1 -1
- data/spec/models/services_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/vantage-client-0.1.0.beta.1.gem +0 -0
- data/vantage-client.gemspec +1 -1
- metadata +26 -4
@@ -0,0 +1,185 @@
|
|
1
|
+
=begin
|
2
|
+
#Vantage
|
3
|
+
|
4
|
+
#Vantage API
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
Contact: support@vantage.sh
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.21
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module Vantage
|
16
|
+
class CostsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Return available Costs for the specified Cost Report and optional time period. If no time period is specified it will return all available costs for the report.
|
23
|
+
# @param report_id
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [String] :start_date Query costs by the first date you would like to filter from. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00.
|
26
|
+
# @option opts [String] :end_date Query costs by the last date you would like to filter to. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00.
|
27
|
+
# @option opts [Integer] :page The page of results to return.
|
28
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
29
|
+
# @return [Costs]
|
30
|
+
def get_costs(report_id, opts = {})
|
31
|
+
data, _status_code, _headers = get_costs_with_http_info(report_id, opts)
|
32
|
+
data
|
33
|
+
end
|
34
|
+
|
35
|
+
# Return available Costs for the specified Cost Report and optional time period. If no time period is specified it will return all available costs for the report.
|
36
|
+
# @param report_id
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [String] :start_date Query costs by the first date you would like to filter from. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00.
|
39
|
+
# @option opts [String] :end_date Query costs by the last date you would like to filter to. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00.
|
40
|
+
# @option opts [Integer] :page The page of results to return.
|
41
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
42
|
+
# @return [Array<(Costs, Fixnum, Hash)>] Costs data, response status code and response headers
|
43
|
+
def get_costs_with_http_info(report_id, opts = {})
|
44
|
+
if @api_client.config.debugging
|
45
|
+
@api_client.config.logger.debug 'Calling API: CostsApi.get_costs ...'
|
46
|
+
end
|
47
|
+
# verify the required parameter 'report_id' is set
|
48
|
+
if @api_client.config.client_side_validation && report_id.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'report_id' when calling CostsApi.get_costs"
|
50
|
+
end
|
51
|
+
# resource path
|
52
|
+
local_var_path = '/v1/reports/{report_id}/costs'.sub('{' + 'report_id' + '}', report_id.to_s)
|
53
|
+
|
54
|
+
# query parameters
|
55
|
+
query_params = {}
|
56
|
+
query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
|
57
|
+
query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
|
58
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
59
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
60
|
+
|
61
|
+
# header parameters
|
62
|
+
header_params = {}
|
63
|
+
# HTTP header 'Accept' (if needed)
|
64
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
65
|
+
|
66
|
+
# form parameters
|
67
|
+
form_params = {}
|
68
|
+
|
69
|
+
# http body (model)
|
70
|
+
post_body = nil
|
71
|
+
auth_names = ['oauth2']
|
72
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
73
|
+
:header_params => header_params,
|
74
|
+
:query_params => query_params,
|
75
|
+
:form_params => form_params,
|
76
|
+
:body => post_body,
|
77
|
+
:auth_names => auth_names,
|
78
|
+
:return_type => 'Costs')
|
79
|
+
if @api_client.config.debugging
|
80
|
+
@api_client.config.logger.debug "API called: CostsApi#get_costs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
81
|
+
end
|
82
|
+
return data, status_code, headers
|
83
|
+
end
|
84
|
+
# Return a Cost Report.
|
85
|
+
# @param report_id
|
86
|
+
# @param [Hash] opts the optional parameters
|
87
|
+
# @return [Report]
|
88
|
+
def get_report(report_id, opts = {})
|
89
|
+
data, _status_code, _headers = get_report_with_http_info(report_id, opts)
|
90
|
+
data
|
91
|
+
end
|
92
|
+
|
93
|
+
# Return a Cost Report.
|
94
|
+
# @param report_id
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @return [Array<(Report, Fixnum, Hash)>] Report data, response status code and response headers
|
97
|
+
def get_report_with_http_info(report_id, opts = {})
|
98
|
+
if @api_client.config.debugging
|
99
|
+
@api_client.config.logger.debug 'Calling API: CostsApi.get_report ...'
|
100
|
+
end
|
101
|
+
# verify the required parameter 'report_id' is set
|
102
|
+
if @api_client.config.client_side_validation && report_id.nil?
|
103
|
+
fail ArgumentError, "Missing the required parameter 'report_id' when calling CostsApi.get_report"
|
104
|
+
end
|
105
|
+
# resource path
|
106
|
+
local_var_path = '/v1/reports/{report_id}'.sub('{' + 'report_id' + '}', report_id.to_s)
|
107
|
+
|
108
|
+
# query parameters
|
109
|
+
query_params = {}
|
110
|
+
|
111
|
+
# header parameters
|
112
|
+
header_params = {}
|
113
|
+
# HTTP header 'Accept' (if needed)
|
114
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
115
|
+
|
116
|
+
# form parameters
|
117
|
+
form_params = {}
|
118
|
+
|
119
|
+
# http body (model)
|
120
|
+
post_body = nil
|
121
|
+
auth_names = ['oauth2']
|
122
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
123
|
+
:header_params => header_params,
|
124
|
+
:query_params => query_params,
|
125
|
+
:form_params => form_params,
|
126
|
+
:body => post_body,
|
127
|
+
:auth_names => auth_names,
|
128
|
+
:return_type => 'Report')
|
129
|
+
if @api_client.config.debugging
|
130
|
+
@api_client.config.logger.debug "API called: CostsApi#get_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
131
|
+
end
|
132
|
+
return data, status_code, headers
|
133
|
+
end
|
134
|
+
# Return all Cost Reports.
|
135
|
+
# @param [Hash] opts the optional parameters
|
136
|
+
# @option opts [Integer] :page The page of results to return.
|
137
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
138
|
+
# @return [Reports]
|
139
|
+
def get_reports(opts = {})
|
140
|
+
data, _status_code, _headers = get_reports_with_http_info(opts)
|
141
|
+
data
|
142
|
+
end
|
143
|
+
|
144
|
+
# Return all Cost Reports.
|
145
|
+
# @param [Hash] opts the optional parameters
|
146
|
+
# @option opts [Integer] :page The page of results to return.
|
147
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
148
|
+
# @return [Array<(Reports, Fixnum, Hash)>] Reports data, response status code and response headers
|
149
|
+
def get_reports_with_http_info(opts = {})
|
150
|
+
if @api_client.config.debugging
|
151
|
+
@api_client.config.logger.debug 'Calling API: CostsApi.get_reports ...'
|
152
|
+
end
|
153
|
+
# resource path
|
154
|
+
local_var_path = '/v1/reports'
|
155
|
+
|
156
|
+
# query parameters
|
157
|
+
query_params = {}
|
158
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
159
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
160
|
+
|
161
|
+
# header parameters
|
162
|
+
header_params = {}
|
163
|
+
# HTTP header 'Accept' (if needed)
|
164
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
165
|
+
|
166
|
+
# form parameters
|
167
|
+
form_params = {}
|
168
|
+
|
169
|
+
# http body (model)
|
170
|
+
post_body = nil
|
171
|
+
auth_names = ['oauth2']
|
172
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
173
|
+
:header_params => header_params,
|
174
|
+
:query_params => query_params,
|
175
|
+
:form_params => form_params,
|
176
|
+
:body => post_body,
|
177
|
+
:auth_names => auth_names,
|
178
|
+
:return_type => 'Reports')
|
179
|
+
if @api_client.config.debugging
|
180
|
+
@api_client.config.logger.debug "API called: CostsApi#get_reports\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
181
|
+
end
|
182
|
+
return data, status_code, headers
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
Contact: support@vantage.sh
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.21
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -19,7 +19,7 @@ module Vantage
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# This is a health check endpoint that can be used to determine Vantage API healthiness. It will return
|
22
|
+
# This is a health check endpoint that can be used to determine Vantage API healthiness. It will return 200 if everything is running smoothly.
|
23
23
|
# @param [Hash] opts the optional parameters
|
24
24
|
# @return [Object]
|
25
25
|
def ping(opts = {})
|
@@ -27,7 +27,7 @@ module Vantage
|
|
27
27
|
data
|
28
28
|
end
|
29
29
|
|
30
|
-
# This is a health check endpoint that can be used to determine Vantage API healthiness. It will return
|
30
|
+
# This is a health check endpoint that can be used to determine Vantage API healthiness. It will return 200 if everything is running smoothly.
|
31
31
|
# @param [Hash] opts the optional parameters
|
32
32
|
# @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
|
33
33
|
def ping_with_http_info(opts = {})
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
Contact: support@vantage.sh
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.21
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -78,6 +78,8 @@ module Vantage
|
|
78
78
|
# Return available Prices across all Regions for a Product.
|
79
79
|
# @param product_id
|
80
80
|
# @param [Hash] opts the optional parameters
|
81
|
+
# @option opts [Integer] :page The page of results to return.
|
82
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
81
83
|
# @return [Prices]
|
82
84
|
def get_prices(product_id, opts = {})
|
83
85
|
data, _status_code, _headers = get_prices_with_http_info(product_id, opts)
|
@@ -87,6 +89,8 @@ module Vantage
|
|
87
89
|
# Return available Prices across all Regions for a Product.
|
88
90
|
# @param product_id
|
89
91
|
# @param [Hash] opts the optional parameters
|
92
|
+
# @option opts [Integer] :page The page of results to return.
|
93
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
90
94
|
# @return [Array<(Prices, Fixnum, Hash)>] Prices data, response status code and response headers
|
91
95
|
def get_prices_with_http_info(product_id, opts = {})
|
92
96
|
if @api_client.config.debugging
|
@@ -101,6 +105,8 @@ module Vantage
|
|
101
105
|
|
102
106
|
# query parameters
|
103
107
|
query_params = {}
|
108
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
109
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
104
110
|
|
105
111
|
# header parameters
|
106
112
|
header_params = {}
|
@@ -180,6 +186,8 @@ module Vantage
|
|
180
186
|
# @option opts [String] :provider_id Query by Provider to list all Products across all Services for a Provider. e.g. aws
|
181
187
|
# @option opts [String] :service_id Query by Service to list all Products for a specific provider service. e.g. aws-ec2
|
182
188
|
# @option opts [String] :name Query by name of the Product to see a list of products which match that name. e.g. m5a.16xlarge
|
189
|
+
# @option opts [Integer] :page The page of results to return.
|
190
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
183
191
|
# @return [Products]
|
184
192
|
def get_products(opts = {})
|
185
193
|
data, _status_code, _headers = get_products_with_http_info(opts)
|
@@ -191,6 +199,8 @@ module Vantage
|
|
191
199
|
# @option opts [String] :provider_id Query by Provider to list all Products across all Services for a Provider. e.g. aws
|
192
200
|
# @option opts [String] :service_id Query by Service to list all Products for a specific provider service. e.g. aws-ec2
|
193
201
|
# @option opts [String] :name Query by name of the Product to see a list of products which match that name. e.g. m5a.16xlarge
|
202
|
+
# @option opts [Integer] :page The page of results to return.
|
203
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
194
204
|
# @return [Array<(Products, Fixnum, Hash)>] Products data, response status code and response headers
|
195
205
|
def get_products_with_http_info(opts = {})
|
196
206
|
if @api_client.config.debugging
|
@@ -204,6 +214,8 @@ module Vantage
|
|
204
214
|
query_params[:'provider_id'] = opts[:'provider_id'] if !opts[:'provider_id'].nil?
|
205
215
|
query_params[:'service_id'] = opts[:'service_id'] if !opts[:'service_id'].nil?
|
206
216
|
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
|
217
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
218
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
207
219
|
|
208
220
|
# header parameters
|
209
221
|
header_params = {}
|
@@ -230,6 +242,8 @@ module Vantage
|
|
230
242
|
end
|
231
243
|
# Providers are cloud infrastructure and service providers from which all cloud prices are derived. You can think of example Providers as being AWS, GCP, Cloudflare or Datadog. Currently, Vantage only supports a single provider of AWS but over time more will be added. Use this endpoint to retrieve a provider id for other API calls.
|
232
244
|
# @param [Hash] opts the optional parameters
|
245
|
+
# @option opts [Integer] :page The page of results to return.
|
246
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
233
247
|
# @return [Providers]
|
234
248
|
def get_providers(opts = {})
|
235
249
|
data, _status_code, _headers = get_providers_with_http_info(opts)
|
@@ -238,6 +252,8 @@ module Vantage
|
|
238
252
|
|
239
253
|
# Providers are cloud infrastructure and service providers from which all cloud prices are derived. You can think of example Providers as being AWS, GCP, Cloudflare or Datadog. Currently, Vantage only supports a single provider of AWS but over time more will be added. Use this endpoint to retrieve a provider id for other API calls.
|
240
254
|
# @param [Hash] opts the optional parameters
|
255
|
+
# @option opts [Integer] :page The page of results to return.
|
256
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
241
257
|
# @return [Array<(Providers, Fixnum, Hash)>] Providers data, response status code and response headers
|
242
258
|
def get_providers_with_http_info(opts = {})
|
243
259
|
if @api_client.config.debugging
|
@@ -248,6 +264,8 @@ module Vantage
|
|
248
264
|
|
249
265
|
# query parameters
|
250
266
|
query_params = {}
|
267
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
268
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
251
269
|
|
252
270
|
# header parameters
|
253
271
|
header_params = {}
|
@@ -275,6 +293,8 @@ module Vantage
|
|
275
293
|
# Return all Services. Examples of Services are EC2 for AWS. This endpoint will return all Services by default but you have the ability to filter Services by Provider using the optional query parameter documented below.
|
276
294
|
# @param [Hash] opts the optional parameters
|
277
295
|
# @option opts [String] :provider_id Query services for a specific provider. e.g. aws
|
296
|
+
# @option opts [Integer] :page The page of results to return.
|
297
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
278
298
|
# @return [Services]
|
279
299
|
def get_services(opts = {})
|
280
300
|
data, _status_code, _headers = get_services_with_http_info(opts)
|
@@ -284,6 +304,8 @@ module Vantage
|
|
284
304
|
# Return all Services. Examples of Services are EC2 for AWS. This endpoint will return all Services by default but you have the ability to filter Services by Provider using the optional query parameter documented below.
|
285
305
|
# @param [Hash] opts the optional parameters
|
286
306
|
# @option opts [String] :provider_id Query services for a specific provider. e.g. aws
|
307
|
+
# @option opts [Integer] :page The page of results to return.
|
308
|
+
# @option opts [Integer] :limit The amount of results to return. The maximum is 1000
|
287
309
|
# @return [Array<(Services, Fixnum, Hash)>] Services data, response status code and response headers
|
288
310
|
def get_services_with_http_info(opts = {})
|
289
311
|
if @api_client.config.debugging
|
@@ -295,6 +317,8 @@ module Vantage
|
|
295
317
|
# query parameters
|
296
318
|
query_params = {}
|
297
319
|
query_params[:'provider_id'] = opts[:'provider_id'] if !opts[:'provider_id'].nil?
|
320
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
321
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
298
322
|
|
299
323
|
# header parameters
|
300
324
|
header_params = {}
|
@@ -0,0 +1,215 @@
|
|
1
|
+
=begin
|
2
|
+
#Vantage
|
3
|
+
|
4
|
+
#Vantage API
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
Contact: support@vantage.sh
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.21
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Vantage
|
16
|
+
class Cost
|
17
|
+
# The date the cost was accrued. ISO 8601 Formatted - 2021-07-15 or 2021-07-15T19:20:48+00:00.
|
18
|
+
attr_accessor :accrued_at
|
19
|
+
|
20
|
+
# The amount of the cost.
|
21
|
+
attr_accessor :amount
|
22
|
+
|
23
|
+
# The service provider where the cost was incurred. e.g. AWS
|
24
|
+
attr_accessor :provider
|
25
|
+
|
26
|
+
# The service which incurred the cost. e.g. Amazon ElastiCache
|
27
|
+
attr_accessor :service
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'accrued_at' => :'accrued_at',
|
33
|
+
:'amount' => :'amount',
|
34
|
+
:'provider' => :'provider',
|
35
|
+
:'service' => :'service'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'accrued_at' => :'String',
|
43
|
+
:'amount' => :'String',
|
44
|
+
:'provider' => :'String',
|
45
|
+
:'service' => :'String'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
return unless attributes.is_a?(Hash)
|
53
|
+
|
54
|
+
# convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
56
|
+
|
57
|
+
if attributes.has_key?(:'accrued_at')
|
58
|
+
self.accrued_at = attributes[:'accrued_at']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.has_key?(:'amount')
|
62
|
+
self.amount = attributes[:'amount']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'provider')
|
66
|
+
self.provider = attributes[:'provider']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.has_key?(:'service')
|
70
|
+
self.service = attributes[:'service']
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
75
|
+
# @return Array for valid properties with the reasons
|
76
|
+
def list_invalid_properties
|
77
|
+
invalid_properties = Array.new
|
78
|
+
invalid_properties
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check to see if the all the properties in the model are valid
|
82
|
+
# @return true if the model is valid
|
83
|
+
def valid?
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks equality by comparing each attribute.
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def ==(o)
|
90
|
+
return true if self.equal?(o)
|
91
|
+
self.class == o.class &&
|
92
|
+
accrued_at == o.accrued_at &&
|
93
|
+
amount == o.amount &&
|
94
|
+
provider == o.provider &&
|
95
|
+
service == o.service
|
96
|
+
end
|
97
|
+
|
98
|
+
# @see the `==` method
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def eql?(o)
|
101
|
+
self == o
|
102
|
+
end
|
103
|
+
|
104
|
+
# Calculates hash code according to all attributes.
|
105
|
+
# @return [Fixnum] Hash code
|
106
|
+
def hash
|
107
|
+
[accrued_at, amount, provider, service].hash
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
self.class.swagger_types.each_pair do |key, type|
|
116
|
+
if type =~ /\AArray<(.*)>/i
|
117
|
+
# check to ensure the input is an array given that the attribute
|
118
|
+
# is documented as an array but the input is not
|
119
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
120
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
121
|
+
end
|
122
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
123
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
124
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
125
|
+
end
|
126
|
+
|
127
|
+
self
|
128
|
+
end
|
129
|
+
|
130
|
+
# Deserializes the data based on type
|
131
|
+
# @param string type Data type
|
132
|
+
# @param string value Value to be deserialized
|
133
|
+
# @return [Object] Deserialized data
|
134
|
+
def _deserialize(type, value)
|
135
|
+
case type.to_sym
|
136
|
+
when :DateTime
|
137
|
+
DateTime.parse(value)
|
138
|
+
when :Date
|
139
|
+
Date.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :BOOLEAN
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
temp_model = Vantage.const_get(type).new
|
168
|
+
temp_model.build_from_hash(value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the string representation of the object
|
173
|
+
# @return [String] String presentation of the object
|
174
|
+
def to_s
|
175
|
+
to_hash.to_s
|
176
|
+
end
|
177
|
+
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_body
|
181
|
+
to_hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the object in the form of hash
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_hash
|
187
|
+
hash = {}
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
189
|
+
value = self.send(attr)
|
190
|
+
next if value.nil?
|
191
|
+
hash[param] = _to_hash(value)
|
192
|
+
end
|
193
|
+
hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Outputs non-array value in the form of hash
|
197
|
+
# For object, use to_hash. Otherwise, just return the value
|
198
|
+
# @param [Object] value Any valid value
|
199
|
+
# @return [Hash] Returns the value in the form of hash
|
200
|
+
def _to_hash(value)
|
201
|
+
if value.is_a?(Array)
|
202
|
+
value.compact.map { |v| _to_hash(v) }
|
203
|
+
elsif value.is_a?(Hash)
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
206
|
+
end
|
207
|
+
elsif value.respond_to? :to_hash
|
208
|
+
value.to_hash
|
209
|
+
else
|
210
|
+
value
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
end
|