Class: WalleeRubySdk::ConsumedResourcesService

Inherits:
Object
  • Object
show all
Defined in:
lib/wallee-ruby-sdk/service/consumed_resources_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ConsumedResourcesService

Returns a new instance of ConsumedResourcesService.



28
29
30
# File 'lib/wallee-ruby-sdk/service/consumed_resources_service.rb', line 28

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



25
26
27
# File 'lib/wallee-ruby-sdk/service/consumed_resources_service.rb', line 25

def api_client
  @api_client
end

Instance Method Details

#get_spaces_consumed_resources(start_date, end_date, space, opts = {}) ⇒ MetricUsageListResponse

List consumed resources

Parameters:

  • start_date (Time)

    The start date of the period for which the consumed resources are to be returned.

  • end_date (Time)

    The end date of the period for which the consumed resources are to be returned.

  • space (Integer)

    Specifies the ID of the space the operation should be executed in.

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

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)

Returns:



38
39
40
41
# File 'lib/wallee-ruby-sdk/service/consumed_resources_service.rb', line 38

def get_spaces_consumed_resources(start_date, end_date, space, opts = {})
  data, _status_code, _headers = get_spaces_consumed_resources_with_http_info(start_date, end_date, space, opts)
  data
end

#get_spaces_consumed_resources_with_http_info(start_date, end_date, space, opts = {}) ⇒ Array<(MetricUsageListResponse, Integer, Hash)>

Returns MetricUsageListResponse data, response status code and response headers.

Parameters:

  • start_date (Time)

    The start date of the period for which the consumed resources are to be returned.

  • end_date (Time)

    The end date of the period for which the consumed resources are to be returned.

  • space (Integer)

    Specifies the ID of the space the operation should be executed in.

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

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)

Returns:

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

    MetricUsageListResponse data, response status code and response headers



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
# File 'lib/wallee-ruby-sdk/service/consumed_resources_service.rb', line 51

def get_spaces_consumed_resources_with_http_info(start_date, end_date, space, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ConsumedResourcesService.get_spaces_consumed_resources ...'
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling ConsumedResourcesService.get_spaces_consumed_resources"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling ConsumedResourcesService.get_spaces_consumed_resources"
  end
  # verify the required parameter 'space' is set
  if @api_client.config.client_side_validation && space.nil?
    fail ArgumentError, "Missing the required parameter 'space' when calling ConsumedResourcesService.get_spaces_consumed_resources"
  end
  # resource path
  local_var_path = '/spaces/consumed-resources'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'startDate'] = start_date
  query_params[:'endDate'] = end_date
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) unless opts[:'expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'Space'] = space

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

  # connection timeout
  connection_timeout = @api_client.config.timeout

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

  # return_type
  return_type = opts[:debug_return_type] || 'MetricUsageListResponse'

  new_options = opts.merge(
    :operation => :"ConsumedResourcesService.get_spaces_consumed_resources",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET.to_sym.downcase, local_var_path, new_options, connection_timeout)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConsumedResourcesService#get_spaces_consumed_resources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}\nConnection Timeout: #{connection_timeout}"
  end
  return data, status_code, headers
end