class Vantage::CostsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/vantage-client/api/costs_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

get_costs(report_id, opts = {}) click to toggle source

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. @param report_id @param [Hash] opts the optional parameters @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. @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. @option opts [Integer] :page The page of results to return. @option opts [Integer] :limit The amount of results to return. The maximum is 1000 @return [Costs]

# File lib/vantage-client/api/costs_api.rb, line 30
def get_costs(report_id, opts = {})
  data, _status_code, _headers = get_costs_with_http_info(report_id, opts)
  data
end
get_costs_with_http_info(report_id, opts = {}) click to toggle source

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. @param report_id @param [Hash] opts the optional parameters @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. @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. @option opts [Integer] :page The page of results to return. @option opts [Integer] :limit The amount of results to return. The maximum is 1000 @return [Array<(Costs, Fixnum, Hash)>] Costs data, response status code and response headers

# File lib/vantage-client/api/costs_api.rb, line 43
def get_costs_with_http_info(report_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CostsApi.get_costs ...'
  end
  # verify the required parameter 'report_id' is set
  if @api_client.config.client_side_validation && report_id.nil?
    fail ArgumentError, "Missing the required parameter 'report_id' when calling CostsApi.get_costs"
  end
  # resource path
  local_var_path = '/v1/reports/{report_id}/costs'.sub('{' + 'report_id' + '}', report_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Costs')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CostsApi#get_costs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_report(report_id, opts = {}) click to toggle source

Return a Cost Report. @param report_id @param [Hash] opts the optional parameters @return [Report]

# File lib/vantage-client/api/costs_api.rb, line 88
def get_report(report_id, opts = {})
  data, _status_code, _headers = get_report_with_http_info(report_id, opts)
  data
end
get_report_with_http_info(report_id, opts = {}) click to toggle source

Return a Cost Report. @param report_id @param [Hash] opts the optional parameters @return [Array<(Report, Fixnum, Hash)>] Report data, response status code and response headers

# File lib/vantage-client/api/costs_api.rb, line 97
def get_report_with_http_info(report_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CostsApi.get_report ...'
  end
  # verify the required parameter 'report_id' is set
  if @api_client.config.client_side_validation && report_id.nil?
    fail ArgumentError, "Missing the required parameter 'report_id' when calling CostsApi.get_report"
  end
  # resource path
  local_var_path = '/v1/reports/{report_id}'.sub('{' + 'report_id' + '}', report_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Report')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CostsApi#get_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_reports(opts = {}) click to toggle source

Return all Cost Reports. @param [Hash] opts the optional parameters @option opts [Integer] :page The page of results to return. @option opts [Integer] :limit The amount of results to return. The maximum is 1000 @return [Reports]

# File lib/vantage-client/api/costs_api.rb, line 139
def get_reports(opts = {})
  data, _status_code, _headers = get_reports_with_http_info(opts)
  data
end
get_reports_with_http_info(opts = {}) click to toggle source

Return all Cost Reports. @param [Hash] opts the optional parameters @option opts [Integer] :page The page of results to return. @option opts [Integer] :limit The amount of results to return. The maximum is 1000 @return [Array<(Reports, Fixnum, Hash)>] Reports data, response status code and response headers

# File lib/vantage-client/api/costs_api.rb, line 149
def get_reports_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CostsApi.get_reports ...'
  end
  # resource path
  local_var_path = '/v1/reports'

  # query parameters
  query_params = {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Reports')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CostsApi#get_reports\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end