Class: Billabear::UsageApi

Inherits:
Object
  • Object
show all
Defined in:
lib/billabear/api/usage_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UsageApi

Returns a new instance of UsageApi.



16
17
18
# File 'lib/billabear/api/usage_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/billabear/api/usage_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#create_customer_usage_limit(body, customer_id, opts = {}) ⇒ UsageLimit

Create Usage Limit Create Usage Limit for the custoemr

Parameters:

  • body
  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:



25
26
27
28
# File 'lib/billabear/api/usage_api.rb', line 25

def create_customer_usage_limit(body, customer_id, opts = {})
  data, _status_code, _headers = create_customer_usage_limit_with_http_info(body, customer_id, opts)
  data
end

#create_customer_usage_limit_with_http_info(body, customer_id, opts = {}) ⇒ Array<(UsageLimit, Integer, Hash)>

Create Usage Limit Create Usage Limit for the custoemr

Parameters:

  • body
  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:

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

    UsageLimit data, response status code and response headers



36
37
38
39
40
41
42
43
44
45
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
# File 'lib/billabear/api/usage_api.rb', line 36

def create_customer_usage_limit_with_http_info(body, customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsageApi.create_customer_usage_limit ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling UsageApi.create_customer_usage_limit"
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling UsageApi.create_customer_usage_limit"
  end
  # resource path
  local_var_path = '/customer/{customerId}/uasge-limit'.sub('{' + 'customerId' + '}', customer_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(body) 

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

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

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageApi#create_customer_usage_limit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_event(body, opts = {}) ⇒ nil

Create Event Creates an event that is used for usage billing

Parameters:

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

    the optional parameters

Returns:

  • (nil)


88
89
90
91
# File 'lib/billabear/api/usage_api.rb', line 88

def create_event(body, opts = {})
  create_event_with_http_info(body, opts)
  nil
end

#create_event_with_http_info(body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create Event Creates an event that is used for usage billing

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/billabear/api/usage_api.rb', line 98

def create_event_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsageApi.create_event ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling UsageApi.create_event"
  end
  # resource path
  local_var_path = '/events'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(body) 

  return_type = opts[:return_type] 

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

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsageApi#create_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#customer_customer_id_uasge_limit_limit_id_delete(customer_id, usage_limit_id, opts = {}) ⇒ nil

Delete Usage Limit Delete Usage Limit for the custoemr

Parameters:

  • customer_id

    The id of the customer to retrieve

  • usage_limit_id

    The id of the usage limit

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

    the optional parameters

Returns:

  • (nil)


147
148
149
150
# File 'lib/billabear/api/usage_api.rb', line 147

def customer_customer_id_uasge_limit_limit_id_delete(customer_id, usage_limit_id, opts = {})
  customer_customer_id_uasge_limit_limit_id_delete_with_http_info(customer_id, usage_limit_id, opts)
  nil
end

#customer_customer_id_uasge_limit_limit_id_delete_with_http_info(customer_id, usage_limit_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete Usage Limit Delete Usage Limit for the custoemr

Parameters:

  • customer_id

    The id of the customer to retrieve

  • usage_limit_id

    The id of the usage limit

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/billabear/api/usage_api.rb', line 158

def customer_customer_id_uasge_limit_limit_id_delete_with_http_info(customer_id, usage_limit_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsageApi.customer_customer_id_uasge_limit_limit_id_delete ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling UsageApi.customer_customer_id_uasge_limit_limit_id_delete"
  end
  # verify the required parameter 'usage_limit_id' is set
  if @api_client.config.client_side_validation && usage_limit_id.nil?
    fail ArgumentError, "Missing the required parameter 'usage_limit_id' when calling UsageApi.customer_customer_id_uasge_limit_limit_id_delete"
  end
  # resource path
  local_var_path = '/customer/{customerId}/uasge-limit/{limitId}'.sub('{' + 'customerId' + '}', customer_id.to_s).sub('{' + 'usageLimitId' + '}', usage_limit_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:DELETE, 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: UsageApi#customer_customer_id_uasge_limit_limit_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_customer_costs(customer_id, opts = {}) ⇒ InlineResponse2001

Usage Cost Estimate The estimated costs from usage based billing for a customer

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:



206
207
208
209
# File 'lib/billabear/api/usage_api.rb', line 206

def get_customer_costs(customer_id, opts = {})
  data, _status_code, _headers = get_customer_costs_with_http_info(customer_id, opts)
  data
end

#get_customer_costs_with_http_info(customer_id, opts = {}) ⇒ Array<(InlineResponse2001, Integer, Hash)>

Usage Cost Estimate The estimated costs from usage based billing for a customer

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:

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

    InlineResponse2001 data, response status code and response headers



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/billabear/api/usage_api.rb', line 216

def get_customer_costs_with_http_info(customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsageApi.get_customer_costs ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling UsageApi.get_customer_costs"
  end
  # resource path
  local_var_path = '/customer/{customerId}/costs'.sub('{' + 'customerId' + '}', customer_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

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

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

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

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

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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: UsageApi#get_customer_costs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_customer_usage_limits_by_id(customer_id, opts = {}) ⇒ InlineResponse2005

Fetch Customer Usage Limits Usage Limits for a specific customer

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:



262
263
264
265
# File 'lib/billabear/api/usage_api.rb', line 262

def get_customer_usage_limits_by_id(customer_id, opts = {})
  data, _status_code, _headers = get_customer_usage_limits_by_id_with_http_info(customer_id, opts)
  data
end

#get_customer_usage_limits_by_id_with_http_info(customer_id, opts = {}) ⇒ Array<(InlineResponse2005, Integer, Hash)>

Fetch Customer Usage Limits Usage Limits for a specific customer

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:

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

    InlineResponse2005 data, response status code and response headers



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/billabear/api/usage_api.rb', line 272

def get_customer_usage_limits_by_id_with_http_info(customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsageApi.get_customer_usage_limits_by_id ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling UsageApi.get_customer_usage_limits_by_id"
  end
  # resource path
  local_var_path = '/customer/{customerId}/uasge-limit'.sub('{' + 'customerId' + '}', customer_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

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

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

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

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

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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: UsageApi#get_customer_usage_limits_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end