Class: VeniceClient::BillingApi
- Inherits:
-
Object
- Object
- VeniceClient::BillingApi
- Defined in:
- lib/venice_client/api/billing_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_billing_usage(opts = {}) ⇒ GetBillingUsage200Response
/api/v1/billing/usage Get paginated billing usage data for the authenticated user.
-
#get_billing_usage_with_http_info(opts = {}) ⇒ Array<(GetBillingUsage200Response, Integer, Hash)>
/api/v1/billing/usage Get paginated billing usage data for the authenticated user.
-
#initialize(api_client = ApiClient.default) ⇒ BillingApi
constructor
A new instance of BillingApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ BillingApi
Returns a new instance of BillingApi.
19 20 21 |
# File 'lib/venice_client/api/billing_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/venice_client/api/billing_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_billing_usage(opts = {}) ⇒ GetBillingUsage200Response
/api/v1/billing/usage Get paginated billing usage data for the authenticated user. NOTE: This is a beta endpoint and may be subject to change.
33 34 35 36 |
# File 'lib/venice_client/api/billing_api.rb', line 33 def get_billing_usage(opts = {}) data, _status_code, _headers = get_billing_usage_with_http_info(opts) data end |
#get_billing_usage_with_http_info(opts = {}) ⇒ Array<(GetBillingUsage200Response, Integer, Hash)>
/api/v1/billing/usage Get paginated billing usage data for the authenticated user. NOTE: This is a beta endpoint and may be subject to change.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/venice_client/api/billing_api.rb', line 49 def get_billing_usage_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_billing_usage ...' end allowable_values = ["USD", "VCU", "DIEM"] if @api_client.config.client_side_validation && opts[:'currency'] && !allowable_values.include?(opts[:'currency']) fail ArgumentError, "invalid value for \"currency\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BillingApi.get_billing_usage, must be smaller than or equal to 500.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] <= 0 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BillingApi.get_billing_usage, must be greater than 0.' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] <= 0 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling BillingApi.get_billing_usage, must be greater than 0.' end allowable_values = ["asc", "desc"] if @api_client.config.client_side_validation && opts[:'sort_order'] && !allowable_values.include?(opts[:'sort_order']) fail ArgumentError, "invalid value for \"sort_order\", must be one of #{allowable_values}" end # resource path local_var_path = '/billing/usage' # query parameters query_params = opts[:query_params] || {} query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil? query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil? query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv']) unless header_params['Accept'] header_params[:'Accept'] = opts[:'accept'] if !opts[:'accept'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetBillingUsage200Response' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] = opts.merge( :operation => :"BillingApi.get_billing_usage", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_billing_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |