class Bfwd::UsageperiodsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

get_usage_period(subscription_id, period_id, opts = {}) click to toggle source

Retrieve by subscription and period { "nickname" : "Retrieve by subscription and period","response" : "getUsagePeriodsForPeriod.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 [UsagePeriodPagedMetadata]

# File lib/bf_ruby2/api/usageperiods_api.rb, line 34
def get_usage_period(subscription_id, period_id, opts = {})
  data, _status_code, _headers = get_usage_period_with_http_info(subscription_id, period_id, opts)
  return data
end
get_usage_period_for_all(subscription_id, opts = {}) click to toggle source

Retrieve by subscription { "nickname" : "Retrieve by subscription","response" : "getUsagePeriods.html"} @param subscription_id The subscriptionID 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 [UsagePeriodPagedMetadata]

# File lib/bf_ruby2/api/usageperiods_api.rb, line 110
def get_usage_period_for_all(subscription_id, opts = {})
  data, _status_code, _headers = get_usage_period_for_all_with_http_info(subscription_id, opts)
  return data
end
get_usage_period_for_all_with_http_info(subscription_id, opts = {}) click to toggle source

Retrieve by subscription { "nickname&quot; : "Retrieve by subscription&quot;,&quot;response&quot; : "getUsagePeriods.html&quot;} @param subscription_id The subscriptionID 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<(UsagePeriodPagedMetadata, Fixnum, Hash)>] UsagePeriodPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usageperiods_api.rb, line 125
def get_usage_period_for_all_with_http_info(subscription_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsageperiodsApi.get_usage_period_for_all ..."
  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 UsageperiodsApi.get_usage_period_for_all"
  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-periods/{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 => 'UsagePeriodPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageperiodsApi#get_usage_period_for_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_usage_period_for_invoice(subscription_id, invoice_id, opts = {}) click to toggle source

Retrieve by invoice) { "nickname" : "Retrieve by invoice","response" : "getUsagePeriodForInvoice.html"} @param subscription_id The subscriptionID of the usage. @param invoice_id The invoiceID 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 [UsagePeriodPagedMetadata]

# File lib/bf_ruby2/api/usageperiods_api.rb, line 182
def get_usage_period_for_invoice(subscription_id, invoice_id, opts = {})
  data, _status_code, _headers = get_usage_period_for_invoice_with_http_info(subscription_id, invoice_id, opts)
  return data
end
get_usage_period_for_invoice_with_http_info(subscription_id, invoice_id, opts = {}) click to toggle source

Retrieve by invoice) { "nickname&quot; : "Retrieve by invoice&quot;,&quot;response&quot; : "getUsagePeriodForInvoice.html&quot;} @param subscription_id The subscriptionID of the usage. @param invoice_id The invoiceID 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<(UsagePeriodPagedMetadata, Fixnum, Hash)>] UsagePeriodPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usageperiods_api.rb, line 198
def get_usage_period_for_invoice_with_http_info(subscription_id, invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsageperiodsApi.get_usage_period_for_invoice ..."
  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 UsageperiodsApi.get_usage_period_for_invoice"
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling UsageperiodsApi.get_usage_period_for_invoice"
  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-periods/{subscription-id}/invoice/{invoice-id}".sub('{' + 'subscription-id' + '}', subscription_id.to_s).sub('{' + 'invoice-id' + '}', invoice_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 => 'UsagePeriodPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageperiodsApi#get_usage_period_for_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_usage_period_with_http_info(subscription_id, period_id, opts = {}) click to toggle source

Retrieve by subscription and period { "nickname&quot; : "Retrieve by subscription and period&quot;,&quot;response&quot; : "getUsagePeriodsForPeriod.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<(UsagePeriodPagedMetadata, Fixnum, Hash)>] UsagePeriodPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/usageperiods_api.rb, line 50
def get_usage_period_with_http_info(subscription_id, period_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsageperiodsApi.get_usage_period ..."
  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 UsageperiodsApi.get_usage_period"
  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 UsageperiodsApi.get_usage_period"
  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-periods/{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 => 'UsagePeriodPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageperiodsApi#get_usage_period\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end