Class: VeniceClient::BillingApi

Inherits:
Object
  • Object
show all
Defined in:
lib/venice_client/api/billing_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BillingApi

Returns a new instance of BillingApi.



16
17
18
# File 'lib/venice_client/api/billing_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/venice_client/api/billing_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#get_billing_usage(opts = {}) ⇒ InlineResponse20015

/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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :accept (String)

    Accept header to specify the response format

  • :currency (String)
  • :end_date (DateTime)
  • :limit (Integer) — default: default to 200
  • :page (Integer) — default: default to 1
  • :sort_order (String) — default: default to desc
  • :start_date (DateTime)

Returns:



30
31
32
33
# File 'lib/venice_client/api/billing_api.rb', line 30

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<(InlineResponse20015, 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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :accept (String)

    Accept header to specify the response format

  • :currency (String)
  • :end_date (DateTime)
  • :limit (Integer)
  • :page (Integer)
  • :sort_order (String)
  • :start_date (DateTime)

Returns:

  • (Array<(InlineResponse20015, Integer, Hash)>)

    InlineResponse20015 data, response status code and response headers



46
47
48
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
# File 'lib/venice_client/api/billing_api.rb', line 46

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
  if @api_client.config.client_side_validation && opts[:'currency'] && !['USD', 'VCU'].include?(opts[:'currency'])
    fail ArgumentError, 'invalid value for "currency", must be one of USD, VCU'
  end
  if @api_client.config.client_side_validation && opts[:'sort_order'] && !['asc', 'desc'].include?(opts[:'sort_order'])
    fail ArgumentError, 'invalid value for "sort_order", must be one of asc, desc'
  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'])
  header_params[:'Accept'] = opts[:'accept'] if !opts[:'accept'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'InlineResponse20015' 

  auth_names = opts[:auth_names] || ['BearerAuth']
  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 => return_type)

  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