vidispine 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/Gemfile +11 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +296 -0
  6. data/Rakefile +2 -0
  7. data/bin/vidispine +7 -0
  8. data/bin/vidispine-notification-handler +339 -0
  9. data/bin/vidispine-utilities-http-server +13 -0
  10. data/dist/vidispine-1.4.0.gem +0 -0
  11. data/lib/vidispine.rb +5 -0
  12. data/lib/vidispine/api/client.rb +981 -0
  13. data/lib/vidispine/api/client/http_client.rb +291 -0
  14. data/lib/vidispine/api/client/requests.rb +27 -0
  15. data/lib/vidispine/api/client/requests/base_request.rb +234 -0
  16. data/lib/vidispine/api/client/requests/collection_access_add.rb +30 -0
  17. data/lib/vidispine/api/client/requests/collection_access_delete.rb +26 -0
  18. data/lib/vidispine/api/client/requests/collection_metadata_set.rb +24 -0
  19. data/lib/vidispine/api/client/requests/import_placeholder.rb +36 -0
  20. data/lib/vidispine/api/client/requests/import_placeholder_item.rb +38 -0
  21. data/lib/vidispine/api/client/requests/import_sidecar_file.rb +28 -0
  22. data/lib/vidispine/api/client/requests/import_using_uri.rb +44 -0
  23. data/lib/vidispine/api/client/requests/item_access_add.rb +30 -0
  24. data/lib/vidispine/api/client/requests/item_access_delete.rb +26 -0
  25. data/lib/vidispine/api/client/requests/item_delete.rb +17 -0
  26. data/lib/vidispine/api/client/requests/item_export.rb +44 -0
  27. data/lib/vidispine/api/client/requests/item_metadata_get.rb +37 -0
  28. data/lib/vidispine/api/client/requests/item_metadata_set.rb +29 -0
  29. data/lib/vidispine/api/client/requests/item_search.rb +0 -0
  30. data/lib/vidispine/api/client/requests/item_transcode.rb +23 -0
  31. data/lib/vidispine/api/client/requests/items_search.rb +40 -0
  32. data/lib/vidispine/api/client/requests/search.rb +59 -0
  33. data/lib/vidispine/api/client/requests/storage_file_create.rb +23 -0
  34. data/lib/vidispine/api/client/requests/storage_file_get.rb +40 -0
  35. data/lib/vidispine/api/client/requests/storage_files_get.rb +42 -0
  36. data/lib/vidispine/api/utilities.rb +1608 -0
  37. data/lib/vidispine/api/utilities/cli.rb +168 -0
  38. data/lib/vidispine/api/utilities/http_server.rb +230 -0
  39. data/lib/vidispine/api/utilities/http_server/cli.rb +77 -0
  40. data/lib/vidispine/cli.rb +174 -0
  41. data/lib/vidispine/version.rb +3 -0
  42. data/resources/postman/Vidispine API (From WADL v4.11).postman_collection.json +47437 -0
  43. data/vidispine.gemspec +26 -0
  44. metadata +117 -0
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ if %w(start stop restart reload run zap status).include?((command = ARGV.first) ? command.downcase : command)
4
+ require 'daemons'
5
+ Daemons.run($0)
6
+ exit
7
+ end
8
+
9
+ lib_path = File.expand_path('../../lib', __FILE__)
10
+ $:.unshift(lib_path) unless $:.include?(lib_path) or !File.exists?(lib_path)
11
+ require 'vidispine/api/utilities/http_server/cli'
12
+
13
+ Vidispine::API::Utilities::HTTPServer::CLI.run
Binary file
data/lib/vidispine.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'vidispine/version'
2
+
3
+ module Vidispine
4
+
5
+ end
@@ -0,0 +1,981 @@
1
+ require 'logger'
2
+
3
+ require 'vidispine/api/client/http_client'
4
+ require 'vidispine/api/client/requests'
5
+
6
+ module Vidispine
7
+ module API
8
+ class Client
9
+
10
+ attr_accessor :http_client, :request, :response, :logger
11
+
12
+ def initialize(args = { })
13
+ @http_client = HTTPClient.new(args)
14
+ @logger = http_client.logger
15
+ end
16
+
17
+ def process_request(request, options = nil)
18
+ @response = nil
19
+ @request = request
20
+ request.client = self unless request.client
21
+ options ||= request.options
22
+ logger.warn { "Request is Missing Required Arguments: #{request.missing_required_arguments.inspect}" } unless request.missing_required_arguments.empty?
23
+ @response = http_client.call_method(request.http_method, { :path => request.path, :query => request.query, :body => request.body }, options)
24
+ end
25
+
26
+ def process_request_using_class(request_class, args, options = { })
27
+ @response = nil
28
+ @request = request_class.new(args, options.merge(:client => self))
29
+ process_request(request, options)
30
+ end
31
+
32
+ # Exposes HTTP Methods
33
+ # @example http(:get, '/')
34
+ def http(method, *args)
35
+ @request = nil
36
+ @response = http_client.send(method, *args)
37
+ @request = http_client.request
38
+ response
39
+ end
40
+
41
+ # Tries to determine if the last request got a successful response
42
+ def success?
43
+ return unless @request
44
+ if @request.respond_to?(:success?)
45
+ @request.success?
46
+ else
47
+ _response = http_client.response
48
+ _response && _response.code.start_with?('2')
49
+ end
50
+ end
51
+
52
+ # def success?
53
+ # request && (request.respond_to?(:success?) ? request.success? : (response && response.code.start_with?('2')))
54
+ # end
55
+
56
+ # Will try to return the most concise error message possible
57
+ #
58
+ # Example:
59
+ # {
60
+ # "invalidInput": {
61
+ # "id": "portal_mf734147",
62
+ # "context": "metadata-field",
63
+ # "value": null,
64
+ # "explanation": "The metadata value is invalid"
65
+ # },
66
+ # "conflict": null,
67
+ # "notAuthorized": null,
68
+ # "fileAlreadyExists": null,
69
+ # "licenseFault": null,
70
+ # "notFound": null,
71
+ # "internalServer": null,
72
+ # "forbidden": null,
73
+ # "notYetImplemented": null
74
+ # }
75
+ #
76
+ # will become
77
+ #
78
+ # {
79
+ # "invalidInput"=> {
80
+ # "id"=>"portal_mf734147",
81
+ # "context"=>"metadata-field",
82
+ # "value"=>nil,
83
+ # "explanation"=>"The metadata value is invalid"
84
+ # }
85
+ # }
86
+ def error
87
+ _response_parsed = http_client.response_parsed
88
+ if _response_parsed.is_a?(Hash)
89
+ _error = _response_parsed.delete_if { |k,v| v.nil? }
90
+ _error
91
+ else
92
+ _response = http_client.response
93
+ _response.body if _response.respond_to?(:body)
94
+ end
95
+ end
96
+
97
+ # ############################################################################################################## #
98
+ # @!group API Endpoints
99
+
100
+ def collection_access_add(args = { }, options = { })
101
+ process_request_using_class(Requests::CollectionAccessAdd, args, options)
102
+ end
103
+
104
+ def collection_access_delete(args = { }, options = { })
105
+ process_request_using_class(Requests::CollectionAccessDelete, args, options)
106
+ end
107
+
108
+ # @see http://apidoc.vidispine.com/latest/ref/access-control.html#retrieve-a-specific-access-control-entry
109
+ def collection_access_get(args = { }, options = { })
110
+ _request = Requests::BaseRequest.new(
111
+ args,
112
+ {
113
+ :http_path => 'collection/#{path_arguments[:collection_id]}/access/#{path_arguments[:access_id]}',
114
+ :parameters => [
115
+ { :name => :collection_id, :aliases => [ :id ], :send_in => :path, :required => true },
116
+ { :name => :access_id, :send_in => :path },
117
+ ]
118
+ }.merge(options)
119
+ )
120
+ process_request(_request, options)
121
+ end
122
+
123
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#create-a-collection
124
+ def collection_create(args = { })
125
+ collection_name = args.is_a?(String) ? args : begin
126
+ _data = Requests::BaseRequest.process_parameters([ { :name => :name, :aliases => [ :collection_name ], :send_in => :query } ], args)
127
+ _args = _data[:arguments_out]
128
+ _args[:name]
129
+ end
130
+ http(:post, '/collection', '', :query => { :name => collection_name })
131
+ end
132
+
133
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#delete-a-collection
134
+ def collection_delete(args = { }, options = { })
135
+ collection_id = args.is_a?(String) ? args : begin
136
+ _data = Requests::BaseRequest.process_parameters([ { :name => :collection_id, :aliases => [ :id ] } ], args)
137
+ _args = _data[:arguments_out]
138
+ _args[:collection_id]
139
+ end
140
+ http(:delete, "/collection/#{collection_id}")
141
+ end
142
+
143
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#retrieve-the-contents-of-a-collection
144
+ def collection_get(args = { }, options = { })
145
+ collection_id = args.is_a?(String) ? args : begin
146
+ _data = Requests::BaseRequest.process_parameters([ { :name => :collection_id, :aliases => [ :id ] } ], args)
147
+ _args = _data[:arguments_out]
148
+ _args[:collection_id]
149
+ end
150
+ http(:get, "/collection/#{collection_id}")
151
+ end
152
+ alias :collection :collection_get
153
+
154
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#retrieve-the-items-of-a-collection
155
+ def collection_items_get(args = { }, options = { })
156
+ collection_id = args.is_a?(String) ? args : begin
157
+ _data = Requests::BaseRequest.process_parameters([ { :name => :collection_id, :aliases => [ :id ] } ], args)
158
+ _args = _data[:arguments_out]
159
+ _args[:collection_id]
160
+ end
161
+ http(:get, "collection/#{collection_id}/item")
162
+ end
163
+ alias :collection_items :collection_items_get
164
+
165
+
166
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#retrieve-collection-metadata
167
+ def collection_metadata_get(args = { }, options = { })
168
+ collection_id = args.is_a?(String) ? args : begin
169
+ _data = Requests::BaseRequest.process_parameters([ { :name => :collection_id, :aliases => [ :id ] } ], args)
170
+ _args = _data[:arguments_out]
171
+ _args[:collection_id]
172
+ end
173
+ http(:get, "/collection/#{collection_id}/metadata")
174
+ end
175
+
176
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#update-collection-metadata
177
+ def collection_metadata_set(args = { }, options = { })
178
+ process_request_using_class(Requests::CollectionMetadataSet, args, options)
179
+ end
180
+ alias :collection_metadata_update :collection_metadata_set
181
+
182
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#add-an-item-library-or-collection-to-a-collection
183
+ def collection_object_add(args = { }, options = { })
184
+ _request = Requests::BaseRequest.new(
185
+ args,
186
+ {
187
+ :http_path => 'collection/#{path_arguments[:collection_id]}/#{path_arguments[:object_id]}',
188
+ :http_method => :put,
189
+ :parameters => [
190
+ { :name => :collection_id, :required => true, :send_in => :path },
191
+ { :name => :object_id,
192
+ :aliases => [ :item_id, :library_id, :collection_to_add_id ], :required => true, :send_in => :path },
193
+ { :name => :type, :aliases => [ :object_type ], :default_value => 'item' }, # The documentation states that item is the default, but we get a 'Type is missing error if this is not passed'
194
+ :addItems
195
+ ],
196
+ }.merge(options)
197
+ )
198
+ process_request(_request, options)
199
+ end
200
+ alias :collection_item_add :collection_object_add
201
+
202
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#remove-an-item-library-or-collection-from-a-collection
203
+ def collection_object_remove(args = { }, options = { })
204
+ _request = Requests::BaseRequest.new(
205
+ args,
206
+ {
207
+ :http_path => 'collection/#{path_arguments[:collection_id]}/#{path_arguments[:object_id]}',
208
+ :http_method => :delete,
209
+ :parameters => [
210
+ { :name => :collection_id, :required => true, :send_in => :path },
211
+ { :name => :object_id,
212
+ :aliases => [ :item_id, :library_id, :collection_to_add_id ], :required => true, :send_in => :path },
213
+ { :name => :type, :aliases => [ :object_type ] },
214
+ ]
215
+ }.merge(options)
216
+ )
217
+ process_request(_request, options)
218
+ end
219
+ alias :collection_item_remove :collection_object_remove
220
+
221
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#rename-a-collection
222
+ # @param [Hash] args
223
+ # @option args [String] :collection_id
224
+ def collection_rename(args = { }, options = { })
225
+ _request = Requests::BaseRequest.new(
226
+ args,
227
+ {
228
+ :http_method => :put,
229
+ :http_path => 'collection/#{arguments[:collection_id]}/rename',
230
+ :parameters => [
231
+ { :name => :collection_id, :aliases => [ :id ], :send_in => :path },
232
+ { :name => :name, :aliases => [ :collection_name ] },
233
+ ]
234
+ }.merge(options)
235
+ )
236
+ return http(:put, _request.path, '', :query => _request.query_arguments, :headers => { 'Content-Type' => 'text/plain' } )
237
+ end
238
+
239
+ # @see http://apidoc.vidispine.com/4.2/ref/collection.html#retrieve-a-list-of-all-collections
240
+ def collections_get(args = { }, options = { })
241
+ _request = Requests::BaseRequest.new(
242
+ args,
243
+ {
244
+ :http_method => :get,
245
+ :http_path => 'collection',
246
+ :parameters => [
247
+ { :name => :first, :send_in => :matrix },
248
+ { :name => :number, :send_in => :matrix },
249
+ ]
250
+ }.merge(options)
251
+ )
252
+ process_request(_request, options)
253
+ end
254
+ alias :collections :collections_get
255
+
256
+ # @see http://apidoc.vidispine.com/latest/ref/item/import.html#create-a-placeholder-item
257
+ def import_placeholder(args = { }, options = { })
258
+ #query = options[:query] || { }
259
+ # http(:post, '/import/placeholder', :query => query)
260
+ process_request_using_class(Requests::ImportPlaceholder, args, options)
261
+ end
262
+ alias :placeholder_create :import_placeholder
263
+
264
+ # @see http://apidoc.vidispine.com/latest/ref/item/import.html#import-to-a-placeholder-item
265
+ def import_placeholder_item(args = { }, options = { })
266
+ process_request_using_class(Requests::ImportPlaceholderItem, args, options)
267
+ end
268
+
269
+ # @see http://apidoc.vidispine.com/4.2/ref/item/import.html#import-using-a-uri
270
+ def import_using_uri(args = { }, options = { })
271
+ process_request_using_class(Requests::ImportUsingURI, args, options)
272
+ end
273
+ alias :import :import_using_uri
274
+
275
+ def item_access_add(args = { }, options = { })
276
+ process_request_using_class(Requests::ItemAccessAdd, args, options)
277
+ end
278
+
279
+ def item_access_delete(args = { }, options = { })
280
+ process_request_using_class(Requests::ItemAccessDelete, args, options)
281
+ end
282
+
283
+ # @see http://apidoc.vidispine.com/latest/ref/access-control.html#retrieve-a-specific-access-control-entry
284
+ def item_access_get(args = { }, options = { })
285
+ _request = Requests::BaseRequest.new(
286
+ args,
287
+ {
288
+ :http_path => 'item/#{path_arguments[:item_id]}/access/#{path_arguments[:access_id]}',
289
+ :parameters => [
290
+ { :name => :item_id, :aliases => [ :id ], :send_in => :path, :required => true },
291
+ { :name => :access_id, :send_in => :path },
292
+ ]
293
+ }.merge(options)
294
+ )
295
+ process_request(_request, options)
296
+ end
297
+
298
+ # @see http://apidoc.vidispine.com/latest/ref/access-control.html#retrieve-access-control-list-for-an-item
299
+ def item_access_list(args = { }, options = { })
300
+ _request = Requests::BaseRequest.new(
301
+ args,
302
+ {
303
+ :http_path => 'item/#{path_arguments[:item_id]}/access',
304
+ :parameters => [
305
+ { :name => :item_id, :aliases => [ :id ], :send_in => :path, :required => true },
306
+ ]
307
+ }.merge(options)
308
+ )
309
+ process_request(_request, options)
310
+ end
311
+
312
+
313
+ # @see http://apidoc.vidispine.com/4.2/ref/item/item.html#list-collections-that-contain-an-item
314
+ def item_collections_get(args = { }, options = { })
315
+ item_id = args.is_a?(String) ? args : begin
316
+ _data = Requests::BaseRequest.process_parameters([ { :name => :item_id, :aliases => [ :id ] } ], args)
317
+ _args = _data[:arguments_out]
318
+ _args[:item_id]
319
+ end
320
+ http(:get, "/item/#{item_id}/collections")
321
+ end
322
+ alias :item_collections :item_collections_get
323
+
324
+ # @see http://apidoc.vidispine.com/latest/ref/item/item.html#delete-a-single-item
325
+ def item_delete(args = { }, options = { })
326
+ process_request_using_class(Requests::ItemDelete, args, options)
327
+ end
328
+
329
+ # http://apidoc.vidispine.com/latest/ref/item/export.html#item-export
330
+ def item_export(args = { }, options = { })
331
+ process_request_using_class(Requests::ItemExport, args, options)
332
+ end
333
+
334
+ # @see http://apidoc.vidispine.com/latest/ref/item/item.html#get-information-about-a-single-item
335
+ def item_get(args = { }, options = { })
336
+ # item_id = args.is_a?(String) ? args : begin
337
+ # _data = Requests::BaseRequest.process_parameters([ { :name => :item_id, :aliases => [ :id ] } ], args)
338
+ # _args = _data[:arguments_out]
339
+ # _args[:item_id]
340
+ # end
341
+ # http(:get, "/item/#{item_id}")
342
+
343
+ _request = Requests::BaseRequest.new(
344
+ args,
345
+ {
346
+ :http_path => 'item/#{path_arguments[:item_id]}',
347
+ :parameters => [
348
+ { :name => :item_id, :aliases => [ :id ], :send_in => :path, :required => true },
349
+ { :name => :starttc, :send_in => :matrix },
350
+
351
+ 'noauth-url',
352
+ 'baseURI'
353
+ ]
354
+ }.merge(options)
355
+ )
356
+ process_request(_request, options)
357
+ end
358
+ alias :item :item_get
359
+
360
+ def item_notifications_delete
361
+ http(:delete, '/item/notification')
362
+ end
363
+
364
+ # @see http://apidoc.vidispine.com/4.2/ref/metadata/metadata.html#get--item-(id)-metadata
365
+ def item_metadata_get(args = { }, options = { })
366
+ process_request_using_class(Requests::ItemMetadataGet, args, options)
367
+ end
368
+ alias :item_metadata :item_metadata_get
369
+
370
+ # @see http://apidoc.vidispine.com/4.2/ref/metadata/metadata.html#add-a-metadata-change-set
371
+ def item_metadata_set(args = { }, options = { })
372
+ process_request_using_class(Requests::ItemMetadataSet, args, options)
373
+ end
374
+
375
+ # @see http://apidoc.vidispine.com/4.2/ref/item/shape.html#get-files-for-shape
376
+ def item_shape_files_get(args = { }, options = { })
377
+ _request = Requests::BaseRequest.new(
378
+ args,
379
+ {
380
+ :http_path => '/item/#{path_arguments[:item_id]}/shape/#{path_arguments[:shape_id]}/file',
381
+ :default_parameter_send_in_value => :path,
382
+ :parameters => [
383
+ { :name => :item_id, :required => true },
384
+ { :name => :shape_id, :required => true }
385
+ ]
386
+ }.merge(options)
387
+ )
388
+ process_request(_request, options)
389
+ end
390
+ alias :item_shape_files :item_shape_files_get
391
+
392
+ def item_shape_add(args = { }, options = { })
393
+
394
+ end
395
+
396
+ # @see http://apidoc.vidispine.com/4.2.6/ref/item/shape.html#get-shape
397
+ def item_shape_get(args = { }, options = { })
398
+ _request = Requests::BaseRequest.new(
399
+ args,
400
+ {
401
+ :http_path => '/item/#{path_arguments[:item_id]}/shape/#{path_arguments[:shape_id]}',
402
+ :default_parameter_send_in_value => :path,
403
+ :parameters => [
404
+ { :name => :item_id, :required => true },
405
+ { :name => :shape_id },
406
+ ]
407
+ }.merge(options)
408
+ )
409
+ process_request(_request, options)
410
+ end
411
+
412
+ # Create a placeholder shape
413
+ # @see http://apidoc.vidispine.com/latest/ref/item/shape.html#create-a-placeholder-shape
414
+ def item_shape_placholder_create(args = { }, options = { })
415
+ _request = Requests::BaseRequest.new(
416
+ args,
417
+ {
418
+ :http_path => '/item/#{path_arguments[:item_id]}/shape/placeholder',
419
+ :default_parameter_send_in_value => :query,
420
+ :parameters => [
421
+ { :name => :item_id, :required => true, :type => :path },
422
+ { :name => :tag },
423
+ { :name => :container },
424
+ { :name => :audio },
425
+ { :name => :video },
426
+ { :name => :frameDuration },
427
+ ]
428
+ }.merge(options)
429
+ )
430
+ process_request(_request, options)
431
+ end
432
+
433
+ # @see http://apidoc.vidispine.com/4.2.6/ref/item/shape.html#get-list-of-shapes
434
+ def item_shapes_get(args = { }, options = { })
435
+ _request = Requests::BaseRequest.new(
436
+ args,
437
+ {
438
+ :http_path => '/item/#{path_arguments[:item_id]}/shape',
439
+ :default_parameter_send_in_value => :path,
440
+ :parameters => [
441
+ { :name => :item_id, :required => true },
442
+ { :name => :uri, :send_in => :query },
443
+ { :name => :placeholder, :send_in => :query },
444
+ { :name => :tag, :send_in => :query }, # Not Documented
445
+ { :name => :version, :send_in => :matrix }
446
+ ]
447
+ }.merge(options)
448
+ )
449
+ process_request(_request, options)
450
+ end
451
+
452
+
453
+ # @see http://apidoc.vidispine.com/4.2/ref/item/shape.html#import-a-shape-using-a-uri-or-an-existing-file
454
+ def item_shape_import(args = { }, options = { })
455
+ # _request = Requests::BaseRequest.new(
456
+ # args,
457
+ # {
458
+ # :http_path => '"/item/#{item_id}/shape"',
459
+ # :parameters => [
460
+ # { :name => :item_id, :aliases => [ :id ], :send_in => :path },
461
+ # :uri,
462
+ # :fileId,
463
+ # { :name => :tag, :aliases => [ :tags ] },
464
+ # :settings,
465
+ # :notification,
466
+ # :notificationData,
467
+ # :priority,
468
+ # :jobmetadata
469
+ # ],
470
+ # }.merge(options)
471
+ # )
472
+ # process_request(_request, options)
473
+
474
+ _data = Requests::BaseRequest.process_parameters(
475
+ [
476
+ { :name => :item_id, :aliases => [ :id ], :send_in => :path },
477
+ :uri,
478
+ :fileId,
479
+ { :name => :tag, :aliases => [ :tags ] },
480
+ :settings,
481
+ :notification,
482
+ :notificationData,
483
+ :priority,
484
+ :jobmetadata
485
+ ],
486
+ args
487
+ )
488
+ _args = _data[:arguments_out]
489
+
490
+ item_id = _args[:item_id]
491
+ uri = _args[:uri]
492
+ file_id = _args[:fileId]
493
+ tag = _args[:tag]
494
+ tag = tag.join(',') if tag.is_a?(Array)
495
+ settings = _args[:settings]
496
+ notification = _args[:notification]
497
+ notification_data = _args[:notificationData]
498
+ priority = _args[:priority]
499
+ job_metadata = _args[:jobmetadata]
500
+
501
+ query = { }
502
+ query[:uri] = uri if uri
503
+ query[:fileId] = file_id if file_id
504
+ query[:tag] = tag if tag
505
+ query[:settings] = settings if settings
506
+ query[:notification] = notification if notification
507
+ query[:notificationData] = notification_data if notification_data
508
+ query[:priority] = priority if priority
509
+ query[:jobmetadata] = job_metadata if job_metadata
510
+
511
+ http(:post, "/item/#{item_id}/shape", '', :query => query)
512
+ end
513
+
514
+ def item_sidecar_import(args = { }, options = { })
515
+ _request = Requests::BaseRequest.new(
516
+ args,
517
+ {
518
+ :http_path => 'import/sidecar/#{path_arguments[:item_id]}',
519
+ :http_method => :post,
520
+ :parameters => [
521
+ { :name => :item_id, :send_in => :path, :required => true },
522
+
523
+ :sidecar,
524
+ :notification,
525
+ :notificationData,
526
+ :priority,
527
+ :jobmetadata,
528
+ ]
529
+ }.merge(options)
530
+ )
531
+ process_request(_request, options)
532
+ end
533
+
534
+ # @see http://apidoc.vidispine.com/latest/ref/item/thumbnail.html#start-a-thumbnail-job
535
+ def item_thumbnail(args = { }, options = { })
536
+ _request = Requests::BaseRequest.new(
537
+ args,
538
+ {
539
+ :http_path => 'item/#{path_arguments[:item_id]}/thumbnail',
540
+ :http_method => :post,
541
+ :parameters => [
542
+ { :name => :item_id, :send_in => :path, :required => true },
543
+
544
+ :createThumbnails,
545
+ :createPosters,
546
+ :thumbnailWidth,
547
+ :thumbnailHeight,
548
+ :thumbnailPeriod,
549
+ :posterWidth,
550
+ :posterHeight,
551
+ :postFormat,
552
+ :notification,
553
+ :notificationData,
554
+ :priority,
555
+ :jobmetadata,
556
+ :version,
557
+ :sourceTag
558
+ ]
559
+ }.merge(options)
560
+ )
561
+ process_request(_request, options)
562
+ end
563
+
564
+ # @see http://apidoc.vidispine.com/4.2/ref/item/transcode.html#start-an-item-transcode-job
565
+ def item_transcode(args = { }, options = { })
566
+ process_request_using_class(Requests::ItemTranscode, args, options)
567
+ end
568
+ alias :item_create_thumbnail :item_transcode
569
+
570
+ # @see http://apidoc.vidispine.com/4.2/ref/item-content.html#get--item-(item-id)-uri
571
+ def item_uris_get(args = { }, options = { })
572
+ _request = Requests::BaseRequest.new(
573
+ args,
574
+ {
575
+ :http_path => '/item/#{arguments[:item_id]}/uri',
576
+ :parameters => [
577
+ { :name => :item_id, :aliases => [ :id ], :required => true, :send_in => :path },
578
+ :type,
579
+ { :name => :tag, :aliases => [ :tags ] },
580
+ :scheme,
581
+ :closedFiles
582
+ ]
583
+ }.merge(options)
584
+ )
585
+ process_request(_request, options)
586
+ end
587
+ alias :item_uri_get :item_uris_get
588
+ alias :item_uris :item_uris_get
589
+ alias :item_uri :item_uris_get
590
+
591
+ # @see http://apidoc.vidispine.com/latest/ref/item/item.html#retrieve-a-list-of-all-items
592
+ def items_get(args = { }, options = { })
593
+ #http(:get, 'item')
594
+ _request = Requests::BaseRequest.new(
595
+ args,
596
+ {
597
+ :http_path => 'item',
598
+ :default_parameter_send_in_value => :matrix,
599
+ :parameters => [
600
+ { :name => :result, :send_in => :query },
601
+ { :name => :q, :send_in => :query },
602
+
603
+ :library,
604
+ :first,
605
+ :number,
606
+ :libraryId,
607
+ :autoRefresh,
608
+ :updateMode,
609
+ :updateFrequency
610
+ ]
611
+ }.merge(options)
612
+ )
613
+ process_request(_request, options)
614
+ end
615
+ alias :items :items_get
616
+
617
+ # @see http://apidoc.vidispine.com/latest/ref/item/item.html#search-items
618
+ def items_search(args = { }, options = { })
619
+ process_request_using_class(Requests::ItemsSearch, args, options)
620
+ end
621
+ alias :item_search :items_search
622
+
623
+ # @see http://apidoc.vidispine.com/4.2/ref/job.html#delete--job-(job-id)
624
+ def job_abort(args = { }, options = { })
625
+ _request = Requests::BaseRequest.new(
626
+ args,
627
+ {
628
+ :http_path => 'job/#{arguments[:job_id]}',
629
+ :http_method => :delete,
630
+ :parameters => [
631
+ { :name => :job_id, :aliases => [ :id ], :send_in => :path },
632
+ :reason
633
+ ]
634
+ }.merge(options)
635
+ )
636
+ process_request(_request, options)
637
+ end
638
+
639
+ # @see http://apidoc.vidispine.com/4.2/ref/job.html#get-job-information
640
+ def job_get(args = { }, options = { })
641
+ _request = Requests::BaseRequest.new(
642
+ args,
643
+ {
644
+ :http_path => 'job/#{arguments[:job_id]}',
645
+ :parameters => [
646
+ { :name => :job_id, :aliases => [ :id ], :send_in => :path },
647
+ :metadata
648
+ ]
649
+ }
650
+ )
651
+ process_request(_request, options)
652
+ end
653
+
654
+ # @see http://apidoc.vidispine.com/4.2/ref/job.html#get-list-of-jobs
655
+ def jobs_get(args = { }, options = { })
656
+ _request = Requests::BaseRequest.new(
657
+ args,
658
+ {
659
+ :http_path => 'job',
660
+ :parameters => [
661
+ { :name => :jobmetadata, :send_in => :query },
662
+ { :name => :metadata, :send_in => :query },
663
+ { :name => :idOnly, :send_in => :query },
664
+ { :name => 'starttime-from', :send_in => :query },
665
+ { :name => 'starttime-to', :send_in => :qeury },
666
+ { :name => :step, :send_in => :query },
667
+
668
+ { :name => :type, :send_in => :matrix },
669
+ { :name => :state, :send_in => :matrix },
670
+ { :name => :first, :send_in => :matrix },
671
+ { :name => :number, :send_in => :matrix },
672
+ { :name => :sort, :send_in => :matrix },
673
+ { :name => :user, :send_in => :matrix }
674
+ ]
675
+ }.merge(options)
676
+ )
677
+ process_request(_request, options)
678
+ end
679
+ alias :jobs :jobs_get
680
+
681
+ # @see http://apidoc.vidispine.com/4.2/ref/metadata/field.html#delete--metadata-field-(field-name)
682
+ def metadata_field_delete(args = { }, options = { })
683
+ _request = Requests::BaseRequest.new(
684
+ args,
685
+ {
686
+ :http_path => 'metadata/#{arguments[:field_name]}',
687
+ :http_method => :delete,
688
+ :parameters => [
689
+ { :name => :field_name, :aliases => [ :name ], :send_in => :path }
690
+ ]
691
+ }.merge(options)
692
+ )
693
+ process_request(_request, options)
694
+ end
695
+
696
+ # @see http://apidoc.vidispine.com/4.2/ref/metadata/field.html#get--metadata-field-(field-name)
697
+ def metadata_field_get(args = { }, options = { })
698
+ _request = Requests::BaseRequest.new(
699
+ args,
700
+ {
701
+ :http_path => 'metadata/#{arguments[:field_name]}',
702
+ :parameters => [
703
+ { :name => :field_name, :aliases => [ :name ], :send_in => :path }
704
+ ]
705
+ }.merge(options)
706
+ )
707
+ process_request(_request, options)
708
+ end
709
+
710
+ # @see http://apidoc.vidispine.com/latest/ref/metadata/field-group.html#retrieving-the-fields-of-a-group
711
+ def metadata_field_group_get(args = { }, options = { })
712
+ _request = Requests::BaseRequest.new(
713
+ args,
714
+ {
715
+ :http_path => 'metadata-field/field-group/#{path_arguments[:group_name]}',
716
+ :parameters => [
717
+ { :name => :group_name, :aliases => [ :name ], :send_in => :path },
718
+ :include_values,
719
+ :traverse,
720
+ :data
721
+ ]
722
+ }.merge(options)
723
+ )
724
+ process_request(_request, options)
725
+ end
726
+
727
+ # @see http://apidoc.vidispine.com/4.2.3/ref/metadata/field-group.html#get-a-list-of-known-groups
728
+ def metadata_field_groups_get(args = { }, options = { })
729
+ _request = Requests::BaseRequest.new(
730
+ args,
731
+ {
732
+ :http_path => 'metadata-field/field-group',
733
+ :parameters => [
734
+ :content,
735
+ :traverse,
736
+ :data
737
+ ]
738
+ }.merge(options)
739
+ )
740
+ process_request(_request, options)
741
+ end
742
+
743
+ # @see http://apidoc.vidispine.com/4.2/ref/metadata/field.html#retrieve-terse-metadata-schema
744
+ def metadata_field_terse_schema(args = { }, options = { })
745
+ default_options = { :headers => { 'accept' => '*/*' } }
746
+ _options = default_options.merge(options)
747
+ http(:get, 'metadata-field/terse-schema', _options)
748
+ end
749
+
750
+ # @see http://apidoc.vidispine.com/4.2/ref/metadata/field.html#get--metadata-field
751
+ def metadata_fields_get(args = { }, options = { })
752
+ http(:get, 'metadata-field', options)
753
+ end
754
+ alias :metadata_fields :metadata_fields_get
755
+
756
+ # @see http://apidoc.vidispine.com/latest/ref/search.html#id2
757
+ # @example search(:content => :metadata, :field => :title, :item_search_document => { :field => [ { :name => 'title', :value => [ { :value => 'something' } ] } ] } )
758
+ def search(args = { }, options = { })
759
+ process_request_using_class(Requests::Search, args, options)
760
+ end
761
+
762
+ def search_browse(args = { }, options = { })
763
+ _request = Requests::BaseRequest.new(
764
+ args,
765
+ {
766
+ :http_path => 'search',
767
+ :parameters => [
768
+ :content,
769
+ :interval,
770
+ :field,
771
+ :group,
772
+ :language,
773
+ :samplerate,
774
+ :track,
775
+ :terse,
776
+ :include,
777
+ :type,
778
+ :tag,
779
+ :scheme,
780
+ :closedFiles,
781
+ 'noauth-url',
782
+ :defaultValue,
783
+ :methodType,
784
+ :version,
785
+ :revision,
786
+
787
+ { :name => :first, :send_in => :matrix },
788
+
789
+ { :name => :ItemSearchDocument, :send_in => :body }
790
+ ]
791
+ }.merge(options)
792
+ )
793
+ process_request(_request, options)
794
+ end
795
+
796
+ # @see http://apidoc.vidispine.com/4.2/ref/storage/storage.html#delete--storage-(storage-id)
797
+ def storage_delete(args = { }, options = { })
798
+ args = { :storage_id => args } if args.is_a?(String)
799
+ _request = Requests::BaseRequest.new(
800
+ args,
801
+ {
802
+ :http_path => 'storage/#{path_arguments[:storage_id]}',
803
+ :http_method => :delete,
804
+ :parameters => [
805
+ { :name => :storage_id, :aliases => [ :id ], :send_in => :path, :required => true },
806
+ :safe
807
+ ]
808
+ }.merge(options)
809
+ )
810
+ process_request(_request, options)
811
+ end
812
+
813
+
814
+ def storage_file_copy(args = { }, options = { })
815
+ _request = Requests::BaseRequest.new(
816
+ args,
817
+ {
818
+ :http_path => 'storage/#{path_arguments[:source_storage_id]}/file/#{path_argumetns[:file_id]}/storage/#{path_arguments[:target_source_id]}',
819
+ :http_method => :post,
820
+ :parameters => [
821
+ { :name => :file_id, :send_in => :path, :required => true },
822
+ { :name => :source_storage_id, :send_in => :path, :required => true },
823
+ { :name => :target_storage_id, :send_in => :path, :required => true },
824
+
825
+ :move,
826
+ :filename,
827
+ :timeDependency,
828
+ :limitRate,
829
+ :notification,
830
+ :notificationData,
831
+ :priority,
832
+ :jobmetadata
833
+ ]
834
+ }.merge(options)
835
+ )
836
+ process_request(_request, options)
837
+ end
838
+
839
+ # @note UNDOCUMENTED API METHOD
840
+ # @param [Hash] args
841
+ # @option args [String] :storage_id (Required)
842
+ # @option args [String] :path (Required)
843
+ # @option args [Boolean] :create_only
844
+ # @option args [String] :state
845
+ def storage_file_create(args = { }, options = { })
846
+ _request = Requests::BaseRequest.new(
847
+ args,
848
+ {
849
+ :http_path => 'storage/#{path_arguments[:storage_id]}/file',
850
+ :http_method => :post,
851
+ :parameters => [
852
+ { :name => :storage_id, :send_in => :path, :required => true },
853
+
854
+ :createOnly,
855
+ :state,
856
+
857
+ { :name => :path, :send_in => :body }
858
+ ]
859
+ }.merge(options)
860
+ )
861
+ process_request(_request, options)
862
+ end
863
+
864
+ def storage_file_item_get(args = { }, options = { })
865
+ _request = Requests::BaseRequest.new(
866
+ args,
867
+ {
868
+ :http_path => 'storage/#{path_arguments[:storage_id]}/file/#{path_arguments[:file_id]}/item',
869
+ :http_method => :get,
870
+ :parameters => [
871
+ { :name => :storage_id, :send_in => :path, :required => true },
872
+ { :name => :file_id, :send_in => :path, :required => true },
873
+
874
+ { :name => :uri, :send_in => :matrix },
875
+ { :name => :path, :send_in => :matrix }
876
+ ]
877
+ }.merge(options)
878
+ )
879
+ process_request(_request, options)
880
+ end
881
+
882
+ # Exposes two functions
883
+ # 1. Get status of file in storage
884
+ # @see http://apidoc.vidispine.com/4.2.3/ref/storage/file.html#get-status-of-file-in-storage
885
+ #
886
+ # 2. Get direct download access to file in storage
887
+ # @see http://apidoc.vidispine.com/4.2.3/ref/storage/file.html#get-direct-download-access-to-file-in-storage
888
+ def storage_file_get(args = { }, options = { })
889
+ process_request_using_class(Requests::StorageFileGet, args, options)
890
+ end
891
+
892
+ # @see http://apidoc.vidispine.com/4.2/ref/storage/file.html#list-files-in-storage
893
+ def storage_files_get(args = { }, options = { })
894
+ process_request_using_class(Requests::StorageFilesGet, args, options)
895
+ end
896
+
897
+ # @see http://apidoc.vidispine.com/4.2/ref/storage/storage.html#get--storage-(storage-id)
898
+ def storage_get(args = { }, options = { })
899
+ args = { :storage_id => args } if args.is_a?(String)
900
+ _request = Requests::BaseRequest.new(
901
+ args,
902
+ {
903
+ :http_path => 'storage/#{path_arguments[:storage_id]}',
904
+ :parameters => [
905
+ { :name => :storage_id, :aliases => [ :id ], :send_in => :path, :required => true },
906
+ ]
907
+ }.merge(options)
908
+ )
909
+ process_request(_request, options)
910
+ end
911
+ alias :storage :storage_get
912
+
913
+ # @see http://apidoc.vidispine.com/4.2/ref/storage/storage.html#storage-methods
914
+ def storage_method_get(args = { }, options = { })
915
+ args = { :storage_id => args } if args.is_a?(String)
916
+ _request = Requests::BaseRequest.new(
917
+ args,
918
+ {
919
+ :http_path => 'storage/#{path_arguments[:storage_id]}/method',
920
+ :parameters => [
921
+ { :name => :storage_id, :aliases => [ :id ], :send_in => :path, :required => true },
922
+
923
+ { :name => :read, :send_in => :matrix },
924
+ { :name => :write, :send_in => :matrix },
925
+ { :name => :browse, :send_in => :matrix },
926
+
927
+ :url,
928
+ ]
929
+ }.merge(options)
930
+ )
931
+ process_request(_request, options)
932
+ end
933
+
934
+ # @see http://apidoc.vidispine.com/4.2/ref/storage/storage.html#rescanning
935
+ # @param [String|Hash] args
936
+ # @option args [String] :storage_id
937
+ def storage_rescan(args = { }, options = { })
938
+ storage_id = args.is_a?(String) ? args : begin
939
+ _data = Requests::BaseRequest.process_parameters([ { :name => :storage_id, :aliases => [ :id ] } ], args)
940
+ _args = _data[:arguments_out]
941
+ _args[:storage_id]
942
+ end
943
+ http(:post, "storage/#{storage_id ? "#{storage_id}/" : ''}rescan", '')
944
+ end
945
+
946
+ # @see http://apidoc.vidispine.com/4.2/ref/storage/storage.html#retrieve-list-of-storages
947
+ def storages_get(args = { }, options = { })
948
+ _request = Requests::BaseRequest.new(
949
+ args,
950
+ {
951
+ :http_path => 'storage',
952
+ :parameters => [
953
+ :size,
954
+ :freebytes,
955
+ :usedbytes,
956
+ :freeamount,
957
+ :files,
958
+ :storagegroup,
959
+ :status
960
+ ]
961
+ }.merge(options)
962
+ )
963
+ process_request(_request, options)
964
+ end
965
+ alias :storages :storages_get
966
+
967
+ def version(args = { }, options = { })
968
+ http(:get, 'API/version')
969
+ end
970
+
971
+ # @!endgroup API Endpoints
972
+ # ############################################################################################################## #
973
+
974
+ # Client
975
+ end
976
+
977
+ # API
978
+ end
979
+
980
+ # Vidispine
981
+ end