Class: BlueprintClient::AssetsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/blueprint_ruby_client/api/assets_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AssetsApi

Returns a new instance of AssetsApi.



19
20
21
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_asset_to_node(namespace, type, id, asset_type, asset_id, opts = {}) ⇒ AssetBody

Add an asset to the node. Body must be empty. Will upsert the asset if it doesn’t exist

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • type

    subtype of Node, e.g. 'modules', 'departments', etc.

  • id

    id identifying a domain model

  • asset_type

    subtype of Asset, e.g. 'textbooks', 'digitisations', etc.

  • asset_id

    id of an asset

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

    the optional parameters

Returns:



32
33
34
35
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 32

def add_asset_to_node(namespace, type, id, asset_type, asset_id, opts = {})
  data, _status_code, _headers = add_asset_to_node_with_http_info(namespace, type, id, asset_type, asset_id, opts)
  return data
end

#add_asset_to_node_with_http_info(namespace, type, id, asset_type, asset_id, opts = {}) ⇒ Array<(AssetBody, Fixnum, Hash)>

Add an asset to the node. Body must be empty. Will upsert the asset if it doesn&#39;t exist

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • type

    subtype of Node, e.g. &#39;modules&#39;, &#39;departments&#39;, etc.

  • id

    id identifying a domain model

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

  • asset_id

    id of an asset

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

    the optional parameters

Returns:

  • (Array<(AssetBody, Fixnum, Hash)>)

    AssetBody data, response status code and response headers



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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 46

def add_asset_to_node_with_http_info(namespace, type, id, asset_type, asset_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: AssetsApi.add_asset_to_node ..."
  end
  
  
  # verify the required parameter 'namespace' is set
  fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.add_asset_to_node" if namespace.nil?
  
  
  
  
  
  
  # verify the required parameter 'type' is set
  fail ArgumentError, "Missing the required parameter 'type' when calling AssetsApi.add_asset_to_node" if type.nil?
  
  
  
  
  
  
  # verify the required parameter 'id' is set
  fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.add_asset_to_node" if id.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_type' is set
  fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.add_asset_to_node" if asset_type.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_id' is set
  fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.add_asset_to_node" if asset_id.nil?
  
  
  
  
  
  # resource path
  local_var_path = "/{namespace}/nodes/{type}/{id}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'type' + '}', type.to_s).sub('{' + 'id' + '}', id.to_s).sub('{' + 'assetType' + '}', asset_type.to_s).sub('{' + 'assetId' + '}', asset_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/vnd.api+json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  
  auth_names = ['oauth2']
  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 => 'AssetBody')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#add_asset_to_node\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_asset(namespace, asset_id, asset_type, opts = {}) ⇒ nil

Delete an Asset

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • asset_id

    id of an asset

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

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

    the optional parameters

Returns:

  • (nil)


135
136
137
138
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 135

def delete_asset(namespace, asset_id, asset_type, opts = {})
  delete_asset_with_http_info(namespace, asset_id, asset_type, opts)
  return nil
end

#delete_asset_with_http_info(namespace, asset_id, asset_type, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete an Asset

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • asset_id

    id of an asset

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



147
148
149
150
151
152
153
154
155
156
157
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
201
202
203
204
205
206
207
208
209
210
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 147

def delete_asset_with_http_info(namespace, asset_id, asset_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: AssetsApi.delete_asset ..."
  end
  
  
  # verify the required parameter 'namespace' is set
  fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.delete_asset" if namespace.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_id' is set
  fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.delete_asset" if asset_id.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_type' is set
  fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.delete_asset" if asset_type.nil?
  
  
  
  
  
  # resource path
  local_var_path = "/{namespace}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'assetId' + '}', asset_id.to_s).sub('{' + 'assetType' + '}', asset_type.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/vnd.api+json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  
  auth_names = ['oauth2']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#delete_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_assets(namespace, opts = {}) ⇒ nil

Delete assets Delete all assets belonging to the given namespace.

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

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

    the optional parameters

Returns:

  • (nil)


217
218
219
220
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 217

def delete_assets(namespace, opts = {})
  delete_assets_with_http_info(namespace, opts)
  return nil
end

#delete_assets_with_http_info(namespace, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete assets Delete all assets belonging to the given namespace.

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 227

def delete_assets_with_http_info(namespace, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: AssetsApi.delete_assets ..."
  end
  
  
  # verify the required parameter 'namespace' is set
  fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.delete_assets" if namespace.nil?
  
  
  
  
  
  # resource path
  local_var_path = "/{namespace}/assets".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/vnd.api+json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  
  auth_names = ['oauth2']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#delete_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_asset(namespace, asset_type, asset_id, opts = {}) ⇒ AssetBody

Get details of a given asset

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

  • asset_id

    id of an asset

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

    the optional parameters

Returns:



283
284
285
286
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 283

def get_asset(namespace, asset_type, asset_id, opts = {})
  data, _status_code, _headers = get_asset_with_http_info(namespace, asset_type, asset_id, opts)
  return data
end

#get_asset_with_http_info(namespace, asset_type, asset_id, opts = {}) ⇒ Array<(AssetBody, Fixnum, Hash)>

Get details of a given asset

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

  • asset_id

    id of an asset

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

    the optional parameters

Returns:

  • (Array<(AssetBody, Fixnum, Hash)>)

    AssetBody data, response status code and response headers



295
296
297
298
299
300
301
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 295

def get_asset_with_http_info(namespace, asset_type, asset_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: AssetsApi.get_asset ..."
  end
  
  
  # verify the required parameter 'namespace' is set
  fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.get_asset" if namespace.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_type' is set
  fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.get_asset" if asset_type.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_id' is set
  fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.get_asset" if asset_id.nil?
  
  
  
  
  
  # resource path
  local_var_path = "/{namespace}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'assetType' + '}', asset_type.to_s).sub('{' + 'assetId' + '}', asset_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/vnd.api+json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  
  auth_names = ['oauth2']
  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 => 'AssetBody')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#get_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_assets_in_node(namespace, type, id, opts = {}) ⇒ AssetResultSet

Get for assets in the relevant node

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • type

    subtype of Node, e.g. &#39;modules&#39;, &#39;departments&#39;, etc.

  • id

    id identifying a domain model

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

    the optional parameters

Options Hash (opts):

  • :filter_asset_type (Array<String>)

    type of asset to return. This filters the results by asset type, but returns all the assets associated with the result.

  • :offset (Float)

    index to start result set from

  • :limit (Float)

    number of records to return

Returns:



371
372
373
374
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 371

def get_assets_in_node(namespace, type, id, opts = {})
  data, _status_code, _headers = get_assets_in_node_with_http_info(namespace, type, id, opts)
  return data
end

#get_assets_in_node_with_http_info(namespace, type, id, opts = {}) ⇒ Array<(AssetResultSet, Fixnum, Hash)>

Get for assets in the relevant node

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • type

    subtype of Node, e.g. &#39;modules&#39;, &#39;departments&#39;, etc.

  • id

    id identifying a domain model

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

    the optional parameters

Options Hash (opts):

  • :filter_asset_type (Array<String>)

    type of asset to return. This filters the results by asset type, but returns all the assets associated with the result.

  • :offset (Float)

    index to start result set from

  • :limit (Float)

    number of records to return

Returns:

  • (Array<(AssetResultSet, Fixnum, Hash)>)

    AssetResultSet data, response status code and response headers



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 386

def get_assets_in_node_with_http_info(namespace, type, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: AssetsApi.get_assets_in_node ..."
  end
  
  
  # verify the required parameter 'namespace' is set
  fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.get_assets_in_node" if namespace.nil?
  
  
  
  
  
  
  # verify the required parameter 'type' is set
  fail ArgumentError, "Missing the required parameter 'type' when calling AssetsApi.get_assets_in_node" if type.nil?
  
  
  
  
  
  
  # verify the required parameter 'id' is set
  fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.get_assets_in_node" if id.nil?
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  # resource path
  local_var_path = "/{namespace}/nodes/{type}/{id}/assets".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'type' + '}', type.to_s).sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'filter[assetType]'] = @api_client.build_collection_param(opts[:'filter_asset_type'], :csv) if opts[:'filter_asset_type']
  query_params[:'offset'] = opts[:'offset'] if opts[:'offset']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/vnd.api+json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  
  auth_names = ['oauth2']
  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 => 'AssetResultSet')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#get_assets_in_node\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_asset_from_node(namespace, type, id, asset_type, asset_id, opts = {}) ⇒ nil

Remove an asset from the relevant node

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • type

    subtype of Node, e.g. &#39;modules&#39;, &#39;departments&#39;, etc.

  • id

    id identifying a domain model

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

  • asset_id

    id of an asset

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

    the optional parameters

Returns:

  • (nil)


482
483
484
485
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 482

def remove_asset_from_node(namespace, type, id, asset_type, asset_id, opts = {})
  remove_asset_from_node_with_http_info(namespace, type, id, asset_type, asset_id, opts)
  return nil
end

#remove_asset_from_node_with_http_info(namespace, type, id, asset_type, asset_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Remove an asset from the relevant node

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • type

    subtype of Node, e.g. &#39;modules&#39;, &#39;departments&#39;, etc.

  • id

    id identifying a domain model

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

  • asset_id

    id of an asset

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 496

def remove_asset_from_node_with_http_info(namespace, type, id, asset_type, asset_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: AssetsApi.remove_asset_from_node ..."
  end
  
  
  # verify the required parameter 'namespace' is set
  fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.remove_asset_from_node" if namespace.nil?
  
  
  
  
  
  
  # verify the required parameter 'type' is set
  fail ArgumentError, "Missing the required parameter 'type' when calling AssetsApi.remove_asset_from_node" if type.nil?
  
  
  
  
  
  
  # verify the required parameter 'id' is set
  fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.remove_asset_from_node" if id.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_type' is set
  fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.remove_asset_from_node" if asset_type.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_id' is set
  fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.remove_asset_from_node" if asset_id.nil?
  
  
  
  
  
  # resource path
  local_var_path = "/{namespace}/nodes/{type}/{id}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'type' + '}', type.to_s).sub('{' + 'id' + '}', id.to_s).sub('{' + 'assetType' + '}', asset_type.to_s).sub('{' + 'assetId' + '}', asset_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/vnd.api+json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  
  auth_names = ['oauth2']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#remove_asset_from_node\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_asset(namespace, asset_id, asset_type, opts = {}) ⇒ AssetBody

Replaces the Asset with the data sent in the body Wholesale replacement of Asset data: if you were to PUT to:n /1/namespace/assets/sometype/someidnnwith a body of:n { type: "someothertype", id: "someotherid" }nnIt would change the Asset’s path to:n /1/namespace/assets/someothertype/someotheridnnandn /1/namespace/assets/sometype/someidnwould return a 404.nIt would also update the assets associated with any node.n

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • asset_id

    id of an asset

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

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

    the optional parameters

Options Hash (opts):

Returns:



585
586
587
588
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 585

def replace_asset(namespace, asset_id, asset_type, opts = {})
  data, _status_code, _headers = replace_asset_with_http_info(namespace, asset_id, asset_type, opts)
  return data
end

#replace_asset_with_http_info(namespace, asset_id, asset_type, opts = {}) ⇒ Array<(AssetBody, Fixnum, Hash)>

Replaces the Asset with the data sent in the body Wholesale replacement of Asset data: if you were to PUT to:n /1/namespace/assets/sometype/someidnnwith a body of:n { type: &quot;someothertype&quot;, id: &quot;someotherid&quot; }nnIt would change the Asset&#39;s path to:n /1/namespace/assets/someothertype/someotheridnnandn /1/namespace/assets/sometype/someidnwould return a 404.nIt would also update the assets associated with any node.n

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

  • asset_id

    id of an asset

  • asset_type

    subtype of Asset, e.g. &#39;textbooks&#39;, &#39;digitisations&#39;, etc.

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(AssetBody, Fixnum, Hash)>)

    AssetBody data, response status code and response headers



598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 598

def replace_asset_with_http_info(namespace, asset_id, asset_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: AssetsApi.replace_asset ..."
  end
  
  
  # verify the required parameter 'namespace' is set
  fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.replace_asset" if namespace.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_id' is set
  fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.replace_asset" if asset_id.nil?
  
  
  
  
  
  
  # verify the required parameter 'asset_type' is set
  fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.replace_asset" if asset_type.nil?
  
  
  
  
  
  
  
  
  
  
  
  # resource path
  local_var_path = "/{namespace}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'assetId' + '}', asset_id.to_s).sub('{' + 'assetType' + '}', asset_type.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/vnd.api+json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  
  auth_names = ['oauth2']
  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 => 'AssetBody')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#replace_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_assets(namespace, opts = {}) ⇒ AssetResultSet

Search assets This endpoint provides a way to get assets as a pageable result set, based (optionally) on filters.nThe include parameter can only be set to ‘nodes`nn###### Find all assets in namespace abcn`/1/abc/assets`nn###### Find all lists for abc:n`/1/abc/assets?filter=lists`nn###### Find all assets that are related to a given node of DEP101:n`/1/abc/assets?filter=departments%2Fdep101`nn###### Find all assets that are related to both node DEP101 and DEP102:n`/1/abc/assets?filter=departments%2Fdep101&filter=departments%2Fdep102`nn###### Find all assets that are related to either node DEP101 and DEP102:n`/1/abc/assets?filter=departments%2Fdep101,departments%2Fdep102`n

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

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

    the optional parameters

Options Hash (opts):

  • :offset (Float)

    index to start result set from

  • :limit (Float)

    number of records to return

  • :include (Array<String>)

    comma separated list of elements to hydrate. Can include children, parents, nodes, and/or assets

  • :filter_node (Array<String>)

    limit to assets that are related to a node matching type/code

  • :filter_asset_type (Array<String>)

    type of asset to return. This filters the results by asset type, but returns all the assets associated with the result.

Returns:



680
681
682
683
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 680

def search_assets(namespace, opts = {})
  data, _status_code, _headers = search_assets_with_http_info(namespace, opts)
  return data
end

#search_assets_with_http_info(namespace, opts = {}) ⇒ Array<(AssetResultSet, Fixnum, Hash)>

Search assets This endpoint provides a way to get assets as a pageable result set, based (optionally) on filters.nThe include parameter can only be set to ‘nodes`nn###### Find all assets in namespace abcn`/1/abc/assets`nn###### Find all lists for abc:n`/1/abc/assets?filter=lists`nn###### Find all assets that are related to a given node of DEP101:n`/1/abc/assets?filter=departments%2Fdep101`nn###### Find all assets that are related to both node DEP101 and DEP102:n`/1/abc/assets?filter=departments%2Fdep101&amp;filter=departments%2Fdep102`nn###### Find all assets that are related to either node DEP101 and DEP102:n`/1/abc/assets?filter=departments%2Fdep101,departments%2Fdep102`n

Parameters:

  • namespace

    identifier namespacing the blueprint. It must start with a letter or underscore and can only be followed by letters, numbers and underscores.

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

    the optional parameters

Options Hash (opts):

  • :offset (Float)

    index to start result set from

  • :limit (Float)

    number of records to return

  • :include (Array<String>)

    comma separated list of elements to hydrate. Can include children, parents, nodes, and/or assets

  • :filter_node (Array<String>)

    limit to assets that are related to a node matching type/code

  • :filter_asset_type (Array<String>)

    type of asset to return. This filters the results by asset type, but returns all the assets associated with the result.

Returns:

  • (Array<(AssetResultSet, Fixnum, Hash)>)

    AssetResultSet data, response status code and response headers



695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'lib/blueprint_ruby_client/api/assets_api.rb', line 695

def search_assets_with_http_info(namespace, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: AssetsApi.search_assets ..."
  end
  
  
  # verify the required parameter 'namespace' is set
  fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.search_assets" if namespace.nil?
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  # resource path
  local_var_path = "/{namespace}/assets".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s)

  # query parameters
  query_params = {}
  query_params[:'offset'] = opts[:'offset'] if opts[:'offset']
  query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if opts[:'include']
  query_params[:'filter[node]'] = @api_client.build_collection_param(opts[:'filter_node'], :csv) if opts[:'filter_node']
  query_params[:'filter[assetType]'] = @api_client.build_collection_param(opts[:'filter_asset_type'], :csv) if opts[:'filter_asset_type']

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/vnd.api+json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  
  auth_names = ['oauth2']
  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 => 'AssetResultSet')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#search_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end