Class: ApiReference::LicenseApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/api_reference/apis/license_api.rb

Overview

LicenseApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from ApiReference::BaseApi

Instance Method Details

#create_license(body) ⇒ ApiResponse

This endpoint is used to create a new license for a user. If a start date is provided, the license will be activated at the start of the specified date in the customer's timezone. Otherwise, the activation time will default to the start of the current day in the customer's timezone.

Parameters:

  • body (NewLicense)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
109
110
111
# File 'lib/api_reference/apis/license_api.rb', line 74

def create_license(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/licenses',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('APIKeyAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LicenseApiResource.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             AuthorizationErrorException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('409',
                             'Conflict',
                             IdempotencyRequestMismatchException)
                .local_error('413',
                             'Content Too Large',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             TooManyRequestsException)
                .local_error('500',
                             'Internal Server Error',
                             ServerErrorException))
    .execute
end

#deactivate_license(license_id, body) ⇒ ApiResponse

This endpoint is used to deactivate an existing license. If an end date is provided, the license will be deactivated at the start of the specified date in the customer's timezone. Otherwise, the deactivation time will default to the end of the current day in the customer's timezone. here here

Parameters:

  • license_id (String)

    Required parameter: TODO: type description

  • body (DeactivateLicense)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/api_reference/apis/license_api.rb', line 350

def deactivate_license(license_id,
                       body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/licenses/{license_id}/deactivate',
                                 Server::DEFAULT)
               .template_param(new_parameter(license_id, key: 'license_id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('APIKeyAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LicenseApiResource.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             AuthorizationErrorException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('409',
                             'Conflict',
                             IdempotencyRequestMismatchException)
                .local_error('413',
                             'Content Too Large',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             TooManyRequestsException)
                .local_error('500',
                             'Internal Server Error',
                             ServerErrorException))
    .execute
end

#fetch_license(license_id) ⇒ ApiResponse

This endpoint is used to fetch a license given an identifier. here

Parameters:

  • license_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/api_reference/apis/license_api.rb', line 302

def fetch_license(license_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/licenses/{license_id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(license_id, key: 'license_id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('APIKeyAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LicenseApiResource.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             AuthorizationErrorException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('409',
                             'Conflict',
                             IdempotencyRequestMismatchException)
                .local_error('413',
                             'Content Too Large',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             TooManyRequestsException)
                .local_error('500',
                             'Internal Server Error',
                             ServerErrorException))
    .execute
end

#fetch_license_external_id(external_license_id, subscription_id, license_type_id) ⇒ ApiResponse

This endpoint is used to fetch a license given an external license identifier. description here here here

Parameters:

  • external_license_id (String)

    Required parameter: TODO: type

  • subscription_id (String)

    Required parameter: TODO: type description

  • license_type_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/api_reference/apis/license_api.rb', line 122

def fetch_license_external_id(external_license_id,
                              subscription_id,
                              license_type_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/licenses/external_license_id/{external_license_id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(external_license_id, key: 'external_license_id')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(subscription_id, key: 'subscription_id')
                             .is_required(true))
               .query_param(new_parameter(license_type_id, key: 'license_type_id')
                             .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('APIKeyAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LicenseApiResource.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             AuthorizationErrorException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('409',
                             'Conflict',
                             IdempotencyRequestMismatchException)
                .local_error('413',
                             'Content Too Large',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             TooManyRequestsException)
                .local_error('500',
                             'Internal Server Error',
                             ServerErrorException))
    .execute
end

#get_license_usage_by_external_id(external_license_id, subscription_id, license_type_id, start_date: nil, end_date: nil, group_by: nil, cursor: nil, limit: 20) ⇒ ApiResponse

Returns usage and remaining credits for a license identified by its external license ID. Date range defaults to the current billing period if not specified. description here here here

Parameters:

  • external_license_id (String)

    Required parameter: TODO: type

  • subscription_id (String)

    Required parameter: TODO: type description

  • license_type_id (String)

    Required parameter: TODO: type description

  • start_date (Date) (defaults to: nil)

    Optional parameter: TODO: type description here

  • end_date (Date) (defaults to: nil)

    Optional parameter: TODO: type description here

  • group_by (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • limit (Integer) (defaults to: 20)

    Optional parameter: Example:20

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/api_reference/apis/license_api.rb', line 181

def get_license_usage_by_external_id(external_license_id,
                                     subscription_id,
                                     license_type_id,
                                     start_date: nil,
                                     end_date: nil,
                                     group_by: nil,
                                     cursor: nil,
                                     limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/licenses/external_licenses/{external_license_id}/usage',
                                 Server::DEFAULT)
               .template_param(new_parameter(external_license_id, key: 'external_license_id')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(subscription_id, key: 'subscription_id')
                             .is_required(true))
               .query_param(new_parameter(license_type_id, key: 'license_type_id')
                             .is_required(true))
               .query_param(new_parameter(start_date, key: 'start_date'))
               .query_param(new_parameter(end_date, key: 'end_date'))
               .query_param(new_parameter(group_by, key: 'group_by'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('APIKeyAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LicenseUsages.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             AuthorizationErrorException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('409',
                             'Conflict',
                             IdempotencyRequestMismatchException)
                .local_error('413',
                             'Content Too Large',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             TooManyRequestsException)
                .local_error('500',
                             'Internal Server Error',
                             ServerErrorException))
    .execute
end

#get_license_usage_by_id(license_id, start_date: nil, end_date: nil, group_by: nil, cursor: nil, limit: 20) ⇒ ApiResponse

Returns usage and remaining credits for a specific license over a date range. Date range defaults to the current billing period if not specified. here

Parameters:

  • license_id (String)

    Required parameter: TODO: type description

  • start_date (Date) (defaults to: nil)

    Optional parameter: TODO: type description here

  • end_date (Date) (defaults to: nil)

    Optional parameter: TODO: type description here

  • group_by (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • limit (Integer) (defaults to: 20)

    Optional parameter: Example:20

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/api_reference/apis/license_api.rb', line 404

def get_license_usage_by_id(license_id,
                            start_date: nil,
                            end_date: nil,
                            group_by: nil,
                            cursor: nil,
                            limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/licenses/{license_id}/usage',
                                 Server::DEFAULT)
               .template_param(new_parameter(license_id, key: 'license_id')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(start_date, key: 'start_date'))
               .query_param(new_parameter(end_date, key: 'end_date'))
               .query_param(new_parameter(group_by, key: 'group_by'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('APIKeyAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LicenseUsages.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             AuthorizationErrorException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('409',
                             'Conflict',
                             IdempotencyRequestMismatchException)
                .local_error('413',
                             'Content Too Large',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             TooManyRequestsException)
                .local_error('500',
                             'Internal Server Error',
                             ServerErrorException))
    .execute
end

#get_license_usage_by_type(subscription_id, license_type_id, start_date: nil, end_date: nil, group_by: nil, cursor: nil, limit: 20) ⇒ ApiResponse

Returns usage and remaining credits for all licenses of a given type on a subscription. Date range defaults to the current billing period if not specified. here here

Parameters:

  • subscription_id (String)

    Required parameter: TODO: type description

  • license_type_id (String)

    Required parameter: TODO: type description

  • start_date (Date) (defaults to: nil)

    Optional parameter: TODO: type description here

  • end_date (Date) (defaults to: nil)

    Optional parameter: TODO: type description here

  • group_by (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • limit (Integer) (defaults to: 20)

    Optional parameter: Example:20

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
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
# File 'lib/api_reference/apis/license_api.rb', line 248

def get_license_usage_by_type(subscription_id,
                              license_type_id,
                              start_date: nil,
                              end_date: nil,
                              group_by: nil,
                              cursor: nil,
                              limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/licenses/usage',
                                 Server::DEFAULT)
               .query_param(new_parameter(subscription_id, key: 'subscription_id')
                             .is_required(true))
               .query_param(new_parameter(license_type_id, key: 'license_type_id')
                             .is_required(true))
               .query_param(new_parameter(start_date, key: 'start_date'))
               .query_param(new_parameter(end_date, key: 'end_date'))
               .query_param(new_parameter(group_by, key: 'group_by'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('APIKeyAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LicenseUsages.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             AuthorizationErrorException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('409',
                             'Conflict',
                             IdempotencyRequestMismatchException)
                .local_error('413',
                             'Content Too Large',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             TooManyRequestsException)
                .local_error('500',
                             'Internal Server Error',
                             ServerErrorException))
    .execute
end

#list_licenses(subscription_id, limit: 20, cursor: nil, license_type_id: nil, external_license_id: nil, status: nil) ⇒ ApiResponse

This endpoint returns a list of all licenses for a subscription. here here description here

Parameters:

  • subscription_id (String)

    Required parameter: TODO: type description

  • limit (Integer) (defaults to: 20)

    Optional parameter: Example:20

  • cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • license_type_id (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • external_license_id (String) (defaults to: nil)

    Optional parameter: TODO: type

  • status (Status7) (defaults to: nil)

    Optional parameter: Example:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
# File 'lib/api_reference/apis/license_api.rb', line 20

def list_licenses(subscription_id,
                  limit: 20,
                  cursor: nil,
                  license_type_id: nil,
                  external_license_id: nil,
                  status: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/licenses',
                                 Server::DEFAULT)
               .query_param(new_parameter(subscription_id, key: 'subscription_id')
                             .is_required(true))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(license_type_id, key: 'license_type_id'))
               .query_param(new_parameter(external_license_id, key: 'external_license_id'))
               .query_param(new_parameter(status, key: 'status'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('APIKeyAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LicenseApiResources.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             AuthorizationErrorException)
                .local_error('404',
                             'Not Found',
                             APIException)
                .local_error('409',
                             'Conflict',
                             IdempotencyRequestMismatchException)
                .local_error('413',
                             'Content Too Large',
                             APIException)
                .local_error('429',
                             'Too Many Requests',
                             TooManyRequestsException)
                .local_error('500',
                             'Internal Server Error',
                             ServerErrorException))
    .execute
end