class Bfwd::UsageApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_usage_instance(usage, opts = {}) click to toggle source

Add usage {"nickname":"Add usage","request":"createUsageRequest.html","response":"createUsageResponse.html"} @param usage An array of The 'Usage' objects to be created. @param [Hash] opts the optional parameters @return [UsagePagedMetadata]

# File lib/bf_ruby2/api/usage_api.rb, line 28
def create_usage_instance(usage, opts = {})
  data, _status_code, _headers = create_usage_instance_with_http_info(usage, opts)
  return data
end
create_usage_instance_with_http_info(usage, opts = {}) click to toggle source

Add usage {&quot;nickname&quot;:&quot;Add usage&quot;,&quot;request&quot;:&quot;createUsageRequest.html&quot;,&quot;response&quot;:&quot;createUsageResponse.html&quot;} @param usage An array of The &#39;Usage&#39; objects to be created. @param [Hash] opts the optional parameters @return [Array<(UsagePagedMetadata, Fixnum, Hash)>] UsagePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usage_api.rb, line 38
def create_usage_instance_with_http_info(usage, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsageApi.create_usage_instance ..."
  end
  # verify the required parameter 'usage' is set
  if @api_client.config.client_side_validation && usage.nil?
    fail ArgumentError, "Missing the required parameter 'usage' when calling UsageApi.create_usage_instance"
  end
  # resource path
  local_var_path = "/usage"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(usage)
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UsagePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageApi#create_usage_instance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_usage_by_id(subscription_id, period_id, opts = {}) click to toggle source

Retrieve by subscription and period {"nickname":"Retrieve by subscription and period","response":"getUsageForPeriod.html"} @param subscription_id The subscriptionID of the usage. @param period_id The periodID of the usage. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. (default to 0) @option opts [Integer] :records The maximum number of amendments to return. (default to 8766) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order The direction of any ordering, either ASC or DESC. (default to ASC) @return [UsagePagedMetadata]

# File lib/bf_ruby2/api/usage_api.rb, line 89
def get_usage_by_id(subscription_id, period_id, opts = {})
  data, _status_code, _headers = get_usage_by_id_with_http_info(subscription_id, period_id, opts)
  return data
end
get_usage_by_id_with_http_info(subscription_id, period_id, opts = {}) click to toggle source

Retrieve by subscription and period {&quot;nickname&quot;:&quot;Retrieve by subscription and period&quot;,&quot;response&quot;:&quot;getUsageForPeriod.html&quot;} @param subscription_id The subscriptionID of the usage. @param period_id The periodID of the usage. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. @option opts [Integer] :records The maximum number of amendments to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order The direction of any ordering, either ASC or DESC. @return [Array<(UsagePagedMetadata, Fixnum, Hash)>] UsagePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usage_api.rb, line 105
def get_usage_by_id_with_http_info(subscription_id, period_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsageApi.get_usage_by_id ..."
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling UsageApi.get_usage_by_id"
  end
  # verify the required parameter 'period_id' is set
  if @api_client.config.client_side_validation && period_id.nil?
    fail ArgumentError, "Missing the required parameter 'period_id' when calling UsageApi.get_usage_by_id"
  end
  if @api_client.config.client_side_validation && opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/usage/{subscription-id}/{period-id}".sub('{' + 'subscription-id' + '}', subscription_id.to_s).sub('{' + 'period-id' + '}', period_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'UsagePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageApi#get_usage_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_usage_by_subscription_id(subscription_id, opts = {}) click to toggle source

Retrieve by subscription {"nickname":"Retrieve by subscription","response":"getUsage.html"} @param subscription_id The subscriptionID of the subscription whose Usage instances you wish to GET. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. (default to 0) @option opts [Integer] :records The maximum number of amendments to return. (default to 8766) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order The direction of any ordering, either ASC or DESC. (default to ASC) @return [UsagePagedMetadata]

# File lib/bf_ruby2/api/usage_api.rb, line 165
def get_usage_by_subscription_id(subscription_id, opts = {})
  data, _status_code, _headers = get_usage_by_subscription_id_with_http_info(subscription_id, opts)
  return data
end
get_usage_by_subscription_id_uo_m_period_and_usage_type(subscription_id, uom, period_id, usage_type, opts = {}) click to toggle source

Retrieve by subscription, period and type {"nickname":"Retrieve by subscription, period and type","response":"getDetailedUsageForPeriod.html"} @param subscription_id The subscriptionID of the usage. @param uom The uom of the usage. @param period_id The periodID of the usage. @param usage_type The type of the usage. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. (default to 0) @option opts [Integer] :records The maximum number of amendments to return. (default to 8766) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order The direction of any ordering, either ASC or DESC. (default to ASC) @return [UsagePagedMetadata]

# File lib/bf_ruby2/api/usage_api.rb, line 239
def get_usage_by_subscription_id_uo_m_period_and_usage_type(subscription_id, uom, period_id, usage_type, opts = {})
  data, _status_code, _headers = get_usage_by_subscription_id_uo_m_period_and_usage_type_with_http_info(subscription_id, uom, period_id, usage_type, opts)
  return data
end
get_usage_by_subscription_id_uo_m_period_and_usage_type_with_http_info(subscription_id, uom, period_id, usage_type, opts = {}) click to toggle source

Retrieve by subscription, period and type {&quot;nickname&quot;:&quot;Retrieve by subscription, period and type&quot;,&quot;response&quot;:&quot;getDetailedUsageForPeriod.html&quot;} @param subscription_id The subscriptionID of the usage. @param uom The uom of the usage. @param period_id The periodID of the usage. @param usage_type The type of the usage. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. @option opts [Integer] :records The maximum number of amendments to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order The direction of any ordering, either ASC or DESC. @return [Array<(UsagePagedMetadata, Fixnum, Hash)>] UsagePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usage_api.rb, line 257
def get_usage_by_subscription_id_uo_m_period_and_usage_type_with_http_info(subscription_id, uom, period_id, usage_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsageApi.get_usage_by_subscription_id_uo_m_period_and_usage_type ..."
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling UsageApi.get_usage_by_subscription_id_uo_m_period_and_usage_type"
  end
  # verify the required parameter 'uom' is set
  if @api_client.config.client_side_validation && uom.nil?
    fail ArgumentError, "Missing the required parameter 'uom' when calling UsageApi.get_usage_by_subscription_id_uo_m_period_and_usage_type"
  end
  # verify the required parameter 'period_id' is set
  if @api_client.config.client_side_validation && period_id.nil?
    fail ArgumentError, "Missing the required parameter 'period_id' when calling UsageApi.get_usage_by_subscription_id_uo_m_period_and_usage_type"
  end
  # verify the required parameter 'usage_type' is set
  if @api_client.config.client_side_validation && usage_type.nil?
    fail ArgumentError, "Missing the required parameter 'usage_type' when calling UsageApi.get_usage_by_subscription_id_uo_m_period_and_usage_type"
  end
  if @api_client.config.client_side_validation && opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/usage/{subscription-id}/{uom}/{period-id}/{usage-type}".sub('{' + 'subscription-id' + '}', subscription_id.to_s).sub('{' + 'uom' + '}', uom.to_s).sub('{' + 'period-id' + '}', period_id.to_s).sub('{' + 'usage-type' + '}', usage_type.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'UsagePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageApi#get_usage_by_subscription_id_uo_m_period_and_usage_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_usage_by_subscription_id_with_http_info(subscription_id, opts = {}) click to toggle source

Retrieve by subscription {&quot;nickname&quot;:&quot;Retrieve by subscription&quot;,&quot;response&quot;:&quot;getUsage.html&quot;} @param subscription_id The subscriptionID of the subscription whose Usage instances you wish to GET. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first amendment to return. @option opts [Integer] :records The maximum number of amendments to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order The direction of any ordering, either ASC or DESC. @return [Array<(UsagePagedMetadata, Fixnum, Hash)>] UsagePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usage_api.rb, line 180
def get_usage_by_subscription_id_with_http_info(subscription_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsageApi.get_usage_by_subscription_id ..."
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling UsageApi.get_usage_by_subscription_id"
  end
  if @api_client.config.client_side_validation && opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/usage/{subscription-id}".sub('{' + 'subscription-id' + '}', subscription_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'UsagePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageApi#get_usage_by_subscription_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_usage_instance(usage, opts = {}) click to toggle source

Update usage {"nickname":"Update usage","request":"updateUsageRequest.html","response":"updateUsageResponse.html"} @param usage An array of The &#39;Usage&#39; objects to be updated. @param [Hash] opts the optional parameters @return [UsagePagedMetadata]

# File lib/bf_ruby2/api/usage_api.rb, line 320
def update_usage_instance(usage, opts = {})
  data, _status_code, _headers = update_usage_instance_with_http_info(usage, opts)
  return data
end
update_usage_instance_with_http_info(usage, opts = {}) click to toggle source

Update usage {&quot;nickname&quot;:&quot;Update usage&quot;,&quot;request&quot;:&quot;updateUsageRequest.html&quot;,&quot;response&quot;:&quot;updateUsageResponse.html&quot;} @param usage An array of The &#39;Usage&#39; objects to be updated. @param [Hash] opts the optional parameters @return [Array<(UsagePagedMetadata, Fixnum, Hash)>] UsagePagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usage_api.rb, line 330
def update_usage_instance_with_http_info(usage, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsageApi.update_usage_instance ..."
  end
  # verify the required parameter 'usage' is set
  if @api_client.config.client_side_validation && usage.nil?
    fail ArgumentError, "Missing the required parameter 'usage' when calling UsageApi.update_usage_instance"
  end
  # resource path
  local_var_path = "/usage"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(usage)
  auth_names = []
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UsagePagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageApi#update_usage_instance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end