Class: Ubiquity::Iconik::API::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ubiquity/iconik/api/client.rb,
lib/ubiquity/iconik/api/client/requests/base_request.rb,
lib/ubiquity/iconik/api/client/http_client.rb

Direct Known Subclasses

Utilities

Defined Under Namespace

Modules: Requests Classes: HTTPClient, Paginator

Instance Attribute Summary collapse

API Endpoints collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = { }) ⇒ Client

Returns a new instance of Client.



16
17
18
19
20
# File 'lib/ubiquity/iconik/api/client.rb', line 16

def initialize(args = { })
  @http_client = HTTPClient.new(args)
  @logger = http_client.logger

end

Instance Attribute Details

#http_clientObject

Returns the value of attribute http_client.



14
15
16
# File 'lib/ubiquity/iconik/api/client.rb', line 14

def http_client
  @http_client
end

#loggerObject

Returns the value of attribute logger.



14
15
16
# File 'lib/ubiquity/iconik/api/client.rb', line 14

def logger
  @logger
end

#requestObject

Returns the value of attribute request.



14
15
16
# File 'lib/ubiquity/iconik/api/client.rb', line 14

def request
  @request
end

#responseObject

Returns the value of attribute response.



14
15
16
# File 'lib/ubiquity/iconik/api/client.rb', line 14

def response
  @response
end

Instance Method Details

#asset_analyze(args = { }, options = { }) ⇒ Object

Start a job that creates sends an asset to Google Cloud Video Intelligence API



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/ubiquity/iconik/api/client.rb', line 136

def asset_analyze(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'transcode/v1/analyze/assets/#{path_arguments[:asset_id]}/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
        { :name => :asset_id, :aliases => [ :id ], :required => true, :send_in => :path },
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_create(args = { }, options = { }) ⇒ Object

Create a new asset



155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/ubiquity/iconik/api/client.rb', line 155

def asset_create(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/assets/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_delete(args = { }, options = { }) ⇒ Object



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/ubiquity/iconik/api/client.rb', line 170

def asset_delete(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/assets/#{path_arguments[:asset_id]}/',
      :http_method => :delete,
      :http_success_code => '204',
      :body => args,
      :parameters => [
        { :name => :asset_id, :aliases => [ :id ], :required => true, :send_in => :path },
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_download_url_get(args = { }, options = { }) ⇒ Object



186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/ubiquity/iconik/api/client.rb', line 186

def asset_download_url_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
      args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/#{path_arguments[:file_id]}/download_url/',
      :parameters => [
        { :name => :asset_id, :aliases => [ :id ], :required => true, :send_in => :path },
        { :name => :file_id, :required => true, :send_in => :path }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_file_create(args = { }, options = { }) ⇒ Object



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/ubiquity/iconik/api/client.rb', line 200

def asset_file_create(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },

        { :name => :file_set_id, :required => true },
        { :name => :file_date_create, :required => true },
        { :name => :file_date_modified, :required => true },
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_file_get(args = { }, options = { }) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/ubiquity/iconik/api/client.rb', line 220

def asset_file_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/#{path_arguments[:file_id]}/',
      :http_method => :get,
      :http_success_code => '200',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
        { :name => :file_id, :aliases => [ :id ], :send_in => :path }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_file_keyframes_create(args = { }, options = { }) ⇒ Object



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/ubiquity/iconik/api/client.rb', line 258

def asset_file_keyframes_create(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/#{path_arguments[:file_id]}/keyframes/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
        { :name => :file_id, :required => true, :send_in => :path },
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_file_set_create(args = { }, options = { }) ⇒ Object Also known as: asset_fileset_create



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/ubiquity/iconik/api/client.rb', line 275

def asset_file_set_create(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/file_sets/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_file_update(args = { }, options = { }) ⇒ Object



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/ubiquity/iconik/api/client.rb', line 237

def asset_file_update(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/#{path_arguments[:file_id]}/',
      :http_method => :patch,
      :http_success_code => '201',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
        { :name => :file_id, :required => true, :send_in => :path },

        { :name => :file_set_id, :required => true },
        { :name => :file_date_create, :required => true },
        { :name => :file_date_modified, :required => true },
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_files_get(args = { }, options = { }) ⇒ Object



292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/ubiquity/iconik/api/client.rb', line 292

def asset_files_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/',
      :parameters => [
        { :name => :asset_id, :aliases => [ :id ], :required => true, :send_in => :path },
        { :name => :generate_signed_url, :send_in => :query }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_format_create(args = { }, options = { }) ⇒ Object



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/ubiquity/iconik/api/client.rb', line 306

def asset_format_create(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
        { :name => :name, :default_value => 'ORIGINAL' },
        { :name => :metadata }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_format_file_sets_get(args = { }, options = { }) ⇒ Object



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/ubiquity/iconik/api/client.rb', line 324

def asset_format_file_sets_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/#{path_arguments[:format_id]}/file_sets/',
      :http_method => :get,
      :http_success_code => '200',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
        { :name => :format_id, :aliases => [ :id ], :send_in => :path }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_format_file_sets_sources_get(args = { }, options = { }) ⇒ Object



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/ubiquity/iconik/api/client.rb', line 341

def asset_format_file_sets_sources_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/#{path_arguments[:format_id]}/file_sets/sources/',
      :http_method => :get,
      :http_success_code => '200',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
        { :name => :format_id, :aliases => [ :id ], :send_in => :path }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_format_get_by_name(args = { }, options = { }) ⇒ Object



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/ubiquity/iconik/api/client.rb', line 358

def asset_format_get_by_name(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/#{path_arguments[:format_name]}/',
      :http_method => :get,
      :http_success_code => '200',
      :body => args,
      :parameters => [
          { :name => :asset_id, :required => true, :send_in => :path },
          { :name => :format_name, :aliases => [ :name ], :send_in => :path }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_formats_get(args = { }, options = { }) ⇒ Object



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/ubiquity/iconik/api/client.rb', line 375

def asset_formats_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/',
      :http_method => :get,
      :http_success_code => '200',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
        { :name => :name, :default_value => 'ORIGINAL' },
        { :name => :metadata }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#asset_keyframes_get(args = { }, options = { }) ⇒ Object



394
395
396
# File 'lib/ubiquity/iconik/api/client.rb', line 394

def asset_keyframes_get(args = { }, options = { })

end

#asset_metadata_set(args = { }, options = { }) ⇒ Object



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/ubiquity/iconik/api/client.rb', line 398

def (args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'metadata/v1/assets/#{path_arguments[:asset_id]}/views/#{path_arguments[:view_id]}/',
      :http_method => :put,
      :http_success_code => '201',
      :body => args,
      :parameters => [
        { :name => :asset_id, :required => true, :send_in => :path },
        { :name => :view_id, :required => true, :send_in => :path },
        { :name => :metadata_values }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#assets_get(args = { }, options = { }) ⇒ Object



416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/ubiquity/iconik/api/client.rb', line 416

def assets_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/assets/',
      :default_parameter_send_in_value => :query,
      :parameters => [
        { :name => :per_page },
        { :name => :page },
        { :name => :sort },
        { :name => :filter }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#assets_reindex(args = { }, options = { }) ⇒ Object



433
434
435
# File 'lib/ubiquity/iconik/api/client.rb', line 433

def assets_reindex(args = { }, options = { })
  http(:post, 'assets/v1/assets/reindex/')
end

#auth_login_simple(args = { }, options = { }) ⇒ Object

Login by using email and password



439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/ubiquity/iconik/api/client.rb', line 439

def (args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'auth/v1/auth/simple/login/',
      :http_method => :post,
      :http_success_code => '201',
      :parameters => [
        { :name => :email, :required => true },
        { :name => :password, :required => true }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#auth_token_get(args = { }, options = { }) ⇒ Object

Deprecated.

Check if auth token valid



458
459
460
461
462
# File 'lib/ubiquity/iconik/api/client.rb', line 458

def auth_token_get(args = { }, options = { })
  _token = args[:token] || token
  _token = token.to_s if _token.respond_to?(:to_s)
  http(:get, 'auth/v1/auth/token/', { :headers => { http_client.header_auth_key => _token } })
end

#auth_token_refresh(args = { }, options = { }) ⇒ Object

Deprecated.

Refresh token



467
468
469
# File 'lib/ubiquity/iconik/api/client.rb', line 467

def auth_token_refresh(args = { }, options = { })
  http(:put, 'auth/v1/auth/token/')
end

#collection_content_add(args = { }, options = { }) ⇒ Object



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/ubiquity/iconik/api/client.rb', line 563

def collection_content_add(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/contents/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
        { :name => :collection_id, :send_in => :path },
        { :name => :object_id },
        { :name => :object_type },
        { :name => :date_created },
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#collection_contents_get(args = { }, options = { }) ⇒ Object



583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/ubiquity/iconik/api/client.rb', line 583

def collection_contents_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/contents/',
      :parameters => [
        { :name => :collection_id, :aliases => [ :id ], :send_in => :path },
        { :name => :content_types }, # Comma separated list of content types. Example - assets,collections
        { :name => :per_page },
        { :name => :page },
        { :name => :sort }, # A comma separated list of fieldnames with order. For example - first_name,asc;last_name,desc
        { :name => :filter }, # A comma separated list of fieldnames with order For example - first_name,eq,Vlad;last_name,eq,Gudkov
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#collection_create(args = { }, options = { }) ⇒ Object



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/ubiquity/iconik/api/client.rb', line 471

def collection_create(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/collections/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,  # Passthrough all arguments passed to the request body
      :parameters => [
        { :name => :title, :aliases => [:collection_title, :collection_name, :name ] },
        { :name => :description },
        { :name => :parent_id },
        { :name => :is_root },
        { :name => :date_created },
        { :name => :description }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#collection_delete(args = { }, options = { }) ⇒ Object



492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/ubiquity/iconik/api/client.rb', line 492

def collection_delete(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/',
      :http_method => :delete,
      :http_success_code => '201',
      :parameters => [
        { :name => :collection_id, :aliases => [ :id ], :send_in => :path }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#collection_get(args = { }, options = { }) ⇒ Object



549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/ubiquity/iconik/api/client.rb', line 549

def collection_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/collections/#{arguments[:collection_id]}/',
      :body => args,
      :parameters => [
        { :name => :collection_id }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#collection_replace(args = { }, options = { }) ⇒ Object



507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/ubiquity/iconik/api/client.rb', line 507

def collection_replace(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/',
      :http_method => :put,
      :http_success_code => '200',
      :parameters => [
        { :name => :collection_id, :aliases => [ :id ], :send_in => :path },
        { :name => :title, :aliases => [ :collection_title, :collection_name, :name ] },
        { :name => :description },
        { :name => :parent_id },
        { :name => :is_root },
        { :name => :date_created },
        { :name => :description }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#collection_update(args = { }, options = { }) ⇒ Object



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/ubiquity/iconik/api/client.rb', line 528

def collection_update(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/',
      :http_method => :patch,
      :http_success_code => '200',
      :parameters => [
        { :name => :collection_id, :aliases => [ :id ], :send_in => :path },
        { :name => :title, :aliases => [ :collection_title, :collection_name, :name ] },
        { :name => :description },
        { :name => :parent_id },
        { :name => :is_root },
        { :name => :date_created },
        { :name => :description }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#collections_get(args = { }, options = { }) ⇒ Object



601
602
603
# File 'lib/ubiquity/iconik/api/client.rb', line 601

def collections_get(args = { }, options = { })
  http(:get, 'assets/v1/collections/')
end

#collections_reindex(args = { }, options = { }) ⇒ Object



605
606
607
# File 'lib/ubiquity/iconik/api/client.rb', line 605

def collections_reindex(args = { }, options = { })
  http(:post, 'assets/collections/reindex/')
end

#errorObject

Will try to return the most concise error message possible

Example: {

"invalidInput": {
    "id": "portal_mf734147",
    "context": "metadata-field",
    "value": null,
"explanation": "The metadata value is invalid"
},
"conflict": null,
"notAuthorized": null,
"fileAlreadyExists": null,
"licenseFault": null,
"notFound": null,
"internalServer": null,
"forbidden": null,
"notYetImplemented": null

}

will become

{

"invalidInput"=> {
  "id"=>"portal_mf734147",
  "context"=>"metadata-field",
  "value"=>nil,
  "explanation"=>"The metadata value is invalid"
}

}



119
120
121
122
123
124
125
126
127
128
# File 'lib/ubiquity/iconik/api/client.rb', line 119

def error
  _response_parsed = http_client.response_parsed
  if _response_parsed.is_a?(Hash)
    _error = _response_parsed.delete_if { |k,v| v.nil? }
    _error
  else
    _response = http_client.response
    _response.body if _response.respond_to?(:body)
  end
end

#file_set_files_get(args = { }, options = { }) ⇒ Object



609
610
611
612
613
614
615
616
617
618
619
620
# File 'lib/ubiquity/iconik/api/client.rb', line 609

def file_set_files_get(args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/file_sets/#{path_arguments[:file_set_id]}/files/',
      :parameters => [
        { :name => :file_set_id, :aliases => [ :id ], :send_in => :path },
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#http(method, *args) ⇒ Object

Exposes HTTP Methods

Examples:

http(:get, ‘/’)



24
25
26
27
28
29
# File 'lib/ubiquity/iconik/api/client.rb', line 24

def http(method, *args)
  @request = nil
  @response = http_client.send(method, *args)
  @request = http_client.request
  response
end

#metadata_field_create(args = { }, options = { }) ⇒ Object



622
623
624
625
626
627
628
629
630
631
632
633
634
635
# File 'lib/ubiquity/iconik/api/client.rb', line 622

def (args = { }, options = { })
  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/storages/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#paginatorObject



31
32
33
# File 'lib/ubiquity/iconik/api/client.rb', line 31

def paginator
  @paginator ||= Paginator.new(self) if @response
end

#process_request(request, options = nil) ⇒ Object



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
# File 'lib/ubiquity/iconik/api/client.rb', line 35

def process_request(request, options = nil)
  @paginator = nil
  @response = nil
  @request = request

  logger.warn { "Request is Missing Required Arguments: #{request.missing_required_arguments.inspect}" } unless request.missing_required_arguments.empty?

  if ([:all, 'all'].include?(request.arguments[:page]))
    request.arguments[:page] = 1
    include_remaining_pages = true
  else
    include_remaining_pages = false
  end

  request.client = self unless request.client
  options ||= request.options
  logger.warn { "Request is Missing Required Arguments: #{request.missing_required_arguments.inspect}" } unless request.missing_required_arguments.empty?

  return (options.fetch(:return_request, true) ? request : nil) unless options.fetch(:execute_request, true)

  #@response = http_client.call_method(request.http_method, { :path => request.path, :query => request.query, :body => request.body }, options)
  @response = request.execute

  if include_remaining_pages
    return paginator.include_remaining_pages
  end

  @response
end

#process_request_using_class(request_class, args, options = { }) ⇒ Object



65
66
67
68
69
# File 'lib/ubiquity/iconik/api/client.rb', line 65

def process_request_using_class(request_class, args, options = { })
  @response = nil
  @request = request_class.new(args, options.merge(:client => self))
  process_request(request, options)
end

#storage_create(args = { }, options = { }) ⇒ Object



637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
# File 'lib/ubiquity/iconik/api/client.rb', line 637

def storage_create(args = { }, options = { })
  # http(:post, 'files/v1/storages/', args)

  _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/storages/',
      :http_method => :post,
      :http_success_code => '201',
      :body => args,
      :parameters => [
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#storage_files_get(args = { }, options = { }) ⇒ Object



654
655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/ubiquity/iconik/api/client.rb', line 654

def storage_files_get(args = { }, options = { })
 _request = Requests::BaseRequest.new(
    args,
    {
      :http_path => 'files/v1/storages/#{path_arguments[:storage_id]}/files/',
      :body => args,
      :parameters => [
        { :name => :storage_id, :required => true, :send_in => :path },
        { :name => :path }
      ]
    }.merge(options)
  )
  process_request(_request, options)
end

#storages_get(args = { }, options = { }) ⇒ Object



669
670
671
# File 'lib/ubiquity/iconik/api/client.rb', line 669

def storages_get(args = { }, options = { })
  http(:get, 'files/v1/storages/')
end

#success?Boolean

Tries to determine if the last request got a successful response

Returns:

  • (Boolean)


72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/ubiquity/iconik/api/client.rb', line 72

def success?
  return unless @request
  if @request.respond_to?(:success?)
    @request.success?
  else
    _response = http_client.response
    _response && _response.code.start_with?('2')
  end
rescue => e
  logger.error { "Exception executing method :success?. '#{e.message}'\n#{e.backtrace}" }
  return false
end

#tokenObject



673
674
675
# File 'lib/ubiquity/iconik/api/client.rb', line 673

def token
  http_client.token
end

#token=(token_data) ⇒ Object



677
678
679
# File 'lib/ubiquity/iconik/api/client.rb', line 677

def token=(token_data)
  http_client.token = token_data
end

#transcode(args = { }, options = { }) ⇒ Object



681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/ubiquity/iconik/api/client.rb', line 681

def transcode(args = { }, options = { })
  _request = Requests::BaseRequest.new(
      args,
      {
          :http_path => 'transcode/v1/transcode/',
          :http_method => :post,
          :http_success_code => '201',
          :parameters => [
          ]
      }.merge(options)
  )
  process_request(_request, options)
end