Class: Vidispine::API::Client
- Inherits:
-
Object
- Object
- Vidispine::API::Client
- Defined in:
- lib/vidispine/api/client.rb,
lib/vidispine/api/client/http_client.rb,
lib/vidispine/api/client/requests/base_request.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Requests Classes: HTTPClient
Instance Attribute Summary collapse
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
API Endpoints collapse
-
#collection_access_add(args = { }, options = { }) ⇒ Object
############################################################################################################## #.
- #collection_access_delete(args = { }, options = { }) ⇒ Object
- #collection_access_get(args = { }, options = { }) ⇒ Object
- #collection_create(args = { }) ⇒ Object
- #collection_delete(args = { }, options = { }) ⇒ Object
- #collection_get(args = { }, options = { }) ⇒ Object (also: #collection)
- #collection_items_get(args = { }, options = { }) ⇒ Object (also: #collection_items)
- #collection_metadata_get(args = { }, options = { }) ⇒ Object
- #collection_metadata_set(args = { }, options = { }) ⇒ Object (also: #collection_metadata_update)
- #collection_object_add(args = { }, options = { }) ⇒ Object (also: #collection_item_add)
- #collection_object_remove(args = { }, options = { }) ⇒ Object (also: #collection_item_remove)
- #collection_rename(args = { }, options = { }) ⇒ Object
- #collections_get(args = { }, options = { }) ⇒ Object (also: #collections)
- #import_placeholder(args = { }, options = { }) ⇒ Object (also: #placeholder_create)
- #import_placeholder_item(args = { }, options = { }) ⇒ Object
- #import_using_uri(args = { }, options = { }) ⇒ Object (also: #import)
- #item_access_add(args = { }, options = { }) ⇒ Object
- #item_access_delete(args = { }, options = { }) ⇒ Object
- #item_access_get(args = { }, options = { }) ⇒ Object
- #item_access_list(args = { }, options = { }) ⇒ Object
- #item_collections_get(args = { }, options = { }) ⇒ Object (also: #item_collections)
- #item_delete(args = { }, options = { }) ⇒ Object
- #item_export(args = { }, options = { }) ⇒ Object
- #item_get(args = { }, options = { }) ⇒ Object (also: #item)
- #item_metadata_get(args = { }, options = { }) ⇒ Object (also: #item_metadata)
- #item_metadata_set(args = { }, options = { }) ⇒ Object
- #item_notifications_delete ⇒ Object
- #item_shape_add(args = { }, options = { }) ⇒ Object
- #item_shape_files_get(args = { }, options = { }) ⇒ Object (also: #item_shape_files)
- #item_shape_get(args = { }, options = { }) ⇒ Object
- #item_shape_import(args = { }, options = { }) ⇒ Object
-
#item_shape_placholder_create(args = { }, options = { }) ⇒ Object
Create a placeholder shape.
- #item_shapes_get(args = { }, options = { }) ⇒ Object
- #item_sidecar_import(args = { }, options = { }) ⇒ Object
- #item_thumbnail(args = { }, options = { }) ⇒ Object
- #item_transcode(args = { }, options = { }) ⇒ Object (also: #item_create_thumbnail)
- #item_uris_get(args = { }, options = { }) ⇒ Object (also: #item_uri_get, #item_uris, #item_uri)
- #items_get(args = { }, options = { }) ⇒ Object (also: #items)
- #items_search(args = { }, options = { }) ⇒ Object (also: #item_search)
- #job_abort(args = { }, options = { }) ⇒ Object
- #job_get(args = { }, options = { }) ⇒ Object
- #jobs_get(args = { }, options = { }) ⇒ Object (also: #jobs)
- #metadata_field_delete(args = { }, options = { }) ⇒ Object
- #metadata_field_get(args = { }, options = { }) ⇒ Object
- #metadata_field_group_get(args = { }, options = { }) ⇒ Object
- #metadata_field_groups_get(args = { }, options = { }) ⇒ Object
- #metadata_field_terse_schema(args = { }, options = { }) ⇒ Object
- #metadata_fields_get(args = { }, options = { }) ⇒ Object (also: #metadata_fields)
- #search(args = { }, options = { }) ⇒ Object
- #search_browse(args = { }, options = { }) ⇒ Object
- #storage_delete(args = { }, options = { }) ⇒ Object
- #storage_file_copy(args = { }, options = { }) ⇒ Object
- #storage_file_create(args = { }, options = { }) ⇒ Object
-
#storage_file_get(args = { }, options = { }) ⇒ Object
Exposes two functions 1.
- #storage_file_item_get(args = { }, options = { }) ⇒ Object
- #storage_files_get(args = { }, options = { }) ⇒ Object
- #storage_get(args = { }, options = { }) ⇒ Object (also: #storage)
- #storage_method_get(args = { }, options = { }) ⇒ Object
- #storage_rescan(args = { }, options = { }) ⇒ Object
- #storages_get(args = { }, options = { }) ⇒ Object (also: #storages)
- #version(args = { }, options = { }) ⇒ Object
Instance Method Summary collapse
-
#error ⇒ Object
Will try to return the most concise error message possible.
-
#http(method, *args) ⇒ Object
Exposes HTTP Methods.
-
#initialize(args = { }) ⇒ Client
constructor
A new instance of Client.
- #process_request(request, options = nil) ⇒ Object
- #process_request_using_class(request_class, args, options = { }) ⇒ Object
-
#success? ⇒ Boolean
Tries to determine if the last request got a successful response.
Constructor Details
#initialize(args = { }) ⇒ Client
Returns a new instance of Client.
12 13 14 15 |
# File 'lib/vidispine/api/client.rb', line 12 def initialize(args = { }) @http_client = HTTPClient.new(args) @logger = http_client.logger end |
Instance Attribute Details
#http_client ⇒ Object
Returns the value of attribute http_client.
10 11 12 |
# File 'lib/vidispine/api/client.rb', line 10 def http_client @http_client end |
#logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/vidispine/api/client.rb', line 10 def logger @logger end |
#request ⇒ Object
Returns the value of attribute request.
10 11 12 |
# File 'lib/vidispine/api/client.rb', line 10 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
10 11 12 |
# File 'lib/vidispine/api/client.rb', line 10 def response @response end |
Instance Method Details
#collection_access_add(args = { }, options = { }) ⇒ Object
############################################################################################################## #
100 101 102 |
# File 'lib/vidispine/api/client.rb', line 100 def collection_access_add(args = { }, = { }) process_request_using_class(Requests::CollectionAccessAdd, args, ) end |
#collection_access_delete(args = { }, options = { }) ⇒ Object
104 105 106 |
# File 'lib/vidispine/api/client.rb', line 104 def collection_access_delete(args = { }, = { }) process_request_using_class(Requests::CollectionAccessDelete, args, ) end |
#collection_access_get(args = { }, options = { }) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/vidispine/api/client.rb', line 109 def collection_access_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'collection/#{path_arguments[:collection_id]}/access/#{path_arguments[:access_id]}', :parameters => [ { :name => :collection_id, :aliases => [ :id ], :send_in => :path, :required => true }, { :name => :access_id, :send_in => :path }, ] }.merge() ) process_request(_request, ) end |
#collection_create(args = { }) ⇒ Object
124 125 126 127 128 129 130 131 |
# File 'lib/vidispine/api/client.rb', line 124 def collection_create(args = { }) collection_name = args.is_a?(String) ? args : begin _data = Requests::BaseRequest.process_parameters([ { :name => :name, :aliases => [ :collection_name ], :send_in => :query } ], args) _args = _data[:arguments_out] _args[:name] end http(:post, '/collection', '', :query => { :name => collection_name }) end |
#collection_delete(args = { }, options = { }) ⇒ Object
134 135 136 137 138 139 140 141 |
# File 'lib/vidispine/api/client.rb', line 134 def collection_delete(args = { }, = { }) collection_id = args.is_a?(String) ? args : begin _data = Requests::BaseRequest.process_parameters([ { :name => :collection_id, :aliases => [ :id ] } ], args) _args = _data[:arguments_out] _args[:collection_id] end http(:delete, "/collection/#{collection_id}") end |
#collection_get(args = { }, options = { }) ⇒ Object Also known as: collection
144 145 146 147 148 149 150 151 |
# File 'lib/vidispine/api/client.rb', line 144 def collection_get(args = { }, = { }) collection_id = args.is_a?(String) ? args : begin _data = Requests::BaseRequest.process_parameters([ { :name => :collection_id, :aliases => [ :id ] } ], args) _args = _data[:arguments_out] _args[:collection_id] end http(:get, "/collection/#{collection_id}") end |
#collection_items_get(args = { }, options = { }) ⇒ Object Also known as: collection_items
155 156 157 158 159 160 161 162 |
# File 'lib/vidispine/api/client.rb', line 155 def collection_items_get(args = { }, = { }) collection_id = args.is_a?(String) ? args : begin _data = Requests::BaseRequest.process_parameters([ { :name => :collection_id, :aliases => [ :id ] } ], args) _args = _data[:arguments_out] _args[:collection_id] end http(:get, "collection/#{collection_id}/item") end |
#collection_metadata_get(args = { }, options = { }) ⇒ Object
167 168 169 170 171 172 173 174 |
# File 'lib/vidispine/api/client.rb', line 167 def (args = { }, = { }) collection_id = args.is_a?(String) ? args : begin _data = Requests::BaseRequest.process_parameters([ { :name => :collection_id, :aliases => [ :id ] } ], args) _args = _data[:arguments_out] _args[:collection_id] end http(:get, "/collection/#{collection_id}/metadata") end |
#collection_metadata_set(args = { }, options = { }) ⇒ Object Also known as: collection_metadata_update
177 178 179 |
# File 'lib/vidispine/api/client.rb', line 177 def (args = { }, = { }) process_request_using_class(Requests::CollectionMetadataSet, args, ) end |
#collection_object_add(args = { }, options = { }) ⇒ Object Also known as: collection_item_add
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/vidispine/api/client.rb', line 183 def collection_object_add(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'collection/#{path_arguments[:collection_id]}/#{path_arguments[:object_id]}', :http_method => :put, :parameters => [ { :name => :collection_id, :required => true, :send_in => :path }, { :name => :object_id, :aliases => [ :item_id, :library_id, :collection_to_add_id ], :required => true, :send_in => :path }, { :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' :addItems ], }.merge() ) process_request(_request, ) end |
#collection_object_remove(args = { }, options = { }) ⇒ Object Also known as: collection_item_remove
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/vidispine/api/client.rb', line 203 def collection_object_remove(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'collection/#{path_arguments[:collection_id]}/#{path_arguments[:object_id]}', :http_method => :delete, :parameters => [ { :name => :collection_id, :required => true, :send_in => :path }, { :name => :object_id, :aliases => [ :item_id, :library_id, :collection_to_add_id ], :required => true, :send_in => :path }, { :name => :type, :aliases => [ :object_type ] }, ] }.merge() ) process_request(_request, ) end |
#collection_rename(args = { }, options = { }) ⇒ Object
224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/vidispine/api/client.rb', line 224 def collection_rename(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_method => :put, :http_path => 'collection/#{arguments[:collection_id]}/rename', :parameters => [ { :name => :collection_id, :aliases => [ :id ], :send_in => :path }, { :name => :name, :aliases => [ :collection_name ] }, ] }.merge() ) return http(:put, _request.path, '', :query => _request.query_arguments, :headers => { 'Content-Type' => 'text/plain' } ) end |
#collections_get(args = { }, options = { }) ⇒ Object Also known as: collections
240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/vidispine/api/client.rb', line 240 def collections_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_method => :get, :http_path => 'collection', :parameters => [ { :name => :first, :send_in => :matrix }, { :name => :number, :send_in => :matrix }, ] }.merge() ) process_request(_request, ) end |
#error ⇒ Object
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"
}
}
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/vidispine/api/client.rb', line 86 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 |
#http(method, *args) ⇒ Object
Exposes HTTP Methods
34 35 36 37 38 39 |
# File 'lib/vidispine/api/client.rb', line 34 def http(method, *args) @request = nil @response = http_client.send(method, *args) @request = http_client.request response end |
#import_placeholder(args = { }, options = { }) ⇒ Object Also known as: placeholder_create
257 258 259 260 261 |
# File 'lib/vidispine/api/client.rb', line 257 def import_placeholder(args = { }, = { }) #query = options[:query] || { } # http(:post, '/import/placeholder', :query => query) process_request_using_class(Requests::ImportPlaceholder, args, ) end |
#import_placeholder_item(args = { }, options = { }) ⇒ Object
265 266 267 |
# File 'lib/vidispine/api/client.rb', line 265 def import_placeholder_item(args = { }, = { }) process_request_using_class(Requests::ImportPlaceholderItem, args, ) end |
#import_using_uri(args = { }, options = { }) ⇒ Object Also known as: import
270 271 272 |
# File 'lib/vidispine/api/client.rb', line 270 def import_using_uri(args = { }, = { }) process_request_using_class(Requests::ImportUsingURI, args, ) end |
#item_access_add(args = { }, options = { }) ⇒ Object
275 276 277 |
# File 'lib/vidispine/api/client.rb', line 275 def item_access_add(args = { }, = { }) process_request_using_class(Requests::ItemAccessAdd, args, ) end |
#item_access_delete(args = { }, options = { }) ⇒ Object
279 280 281 |
# File 'lib/vidispine/api/client.rb', line 279 def item_access_delete(args = { }, = { }) process_request_using_class(Requests::ItemAccessDelete, args, ) end |
#item_access_get(args = { }, options = { }) ⇒ Object
284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/vidispine/api/client.rb', line 284 def item_access_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'item/#{path_arguments[:item_id]}/access/#{path_arguments[:access_id]}', :parameters => [ { :name => :item_id, :aliases => [ :id ], :send_in => :path, :required => true }, { :name => :access_id, :send_in => :path }, ] }.merge() ) process_request(_request, ) end |
#item_access_list(args = { }, options = { }) ⇒ Object
299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/vidispine/api/client.rb', line 299 def item_access_list(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'item/#{path_arguments[:item_id]}/access', :parameters => [ { :name => :item_id, :aliases => [ :id ], :send_in => :path, :required => true }, ] }.merge() ) process_request(_request, ) end |
#item_collections_get(args = { }, options = { }) ⇒ Object Also known as: item_collections
314 315 316 317 318 319 320 321 |
# File 'lib/vidispine/api/client.rb', line 314 def item_collections_get(args = { }, = { }) item_id = args.is_a?(String) ? args : begin _data = Requests::BaseRequest.process_parameters([ { :name => :item_id, :aliases => [ :id ] } ], args) _args = _data[:arguments_out] _args[:item_id] end http(:get, "/item/#{item_id}/collections") end |
#item_delete(args = { }, options = { }) ⇒ Object
325 326 327 |
# File 'lib/vidispine/api/client.rb', line 325 def item_delete(args = { }, = { }) process_request_using_class(Requests::ItemDelete, args, ) end |
#item_export(args = { }, options = { }) ⇒ Object
330 331 332 |
# File 'lib/vidispine/api/client.rb', line 330 def item_export(args = { }, = { }) process_request_using_class(Requests::ItemExport, args, ) end |
#item_get(args = { }, options = { }) ⇒ Object Also known as: item
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/vidispine/api/client.rb', line 335 def item_get(args = { }, = { }) # item_id = args.is_a?(String) ? args : begin # _data = Requests::BaseRequest.process_parameters([ { :name => :item_id, :aliases => [ :id ] } ], args) # _args = _data[:arguments_out] # _args[:item_id] # end # http(:get, "/item/#{item_id}") _request = Requests::BaseRequest.new( args, { :http_path => 'item/#{path_arguments[:item_id]}', :parameters => [ { :name => :item_id, :aliases => [ :id ], :send_in => :path, :required => true }, { :name => :starttc, :send_in => :matrix }, 'noauth-url', 'baseURI' ] }.merge() ) process_request(_request, ) end |
#item_metadata_get(args = { }, options = { }) ⇒ Object Also known as: item_metadata
365 366 367 |
# File 'lib/vidispine/api/client.rb', line 365 def (args = { }, = { }) process_request_using_class(Requests::ItemMetadataGet, args, ) end |
#item_metadata_set(args = { }, options = { }) ⇒ Object
371 372 373 |
# File 'lib/vidispine/api/client.rb', line 371 def (args = { }, = { }) process_request_using_class(Requests::ItemMetadataSet, args, ) end |
#item_notifications_delete ⇒ Object
360 361 362 |
# File 'lib/vidispine/api/client.rb', line 360 def item_notifications_delete http(:delete, '/item/notification') end |
#item_shape_add(args = { }, options = { }) ⇒ Object
392 393 394 |
# File 'lib/vidispine/api/client.rb', line 392 def item_shape_add(args = { }, = { }) end |
#item_shape_files_get(args = { }, options = { }) ⇒ Object Also known as: item_shape_files
376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/vidispine/api/client.rb', line 376 def item_shape_files_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => '/item/#{path_arguments[:item_id]}/shape/#{path_arguments[:shape_id]}/file', :default_parameter_send_in_value => :path, :parameters => [ { :name => :item_id, :required => true }, { :name => :shape_id, :required => true } ] }.merge() ) process_request(_request, ) end |
#item_shape_get(args = { }, options = { }) ⇒ Object
397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/vidispine/api/client.rb', line 397 def item_shape_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => '/item/#{path_arguments[:item_id]}/shape/#{path_arguments[:shape_id]}', :default_parameter_send_in_value => :path, :parameters => [ { :name => :item_id, :required => true }, { :name => :shape_id }, ] }.merge() ) process_request(_request, ) end |
#item_shape_import(args = { }, options = { }) ⇒ Object
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/vidispine/api/client.rb', line 454 def item_shape_import(args = { }, = { }) # _request = Requests::BaseRequest.new( # args, # { # :http_path => '"/item/#{item_id}/shape"', # :parameters => [ # { :name => :item_id, :aliases => [ :id ], :send_in => :path }, # :uri, # :fileId, # { :name => :tag, :aliases => [ :tags ] }, # :settings, # :notification, # :notificationData, # :priority, # :jobmetadata # ], # }.merge(options) # ) # process_request(_request, options) _data = Requests::BaseRequest.process_parameters( [ { :name => :item_id, :aliases => [ :id ], :send_in => :path }, :uri, :fileId, { :name => :tag, :aliases => [ :tags ] }, :settings, :notification, :notificationData, :priority, :jobmetadata ], args ) _args = _data[:arguments_out] item_id = _args[:item_id] uri = _args[:uri] file_id = _args[:fileId] tag = _args[:tag] tag = tag.join(',') if tag.is_a?(Array) settings = _args[:settings] notification = _args[:notification] notification_data = _args[:notificationData] priority = _args[:priority] = _args[:jobmetadata] query = { } query[:uri] = uri if uri query[:fileId] = file_id if file_id query[:tag] = tag if tag query[:settings] = settings if settings query[:notification] = notification if notification query[:notificationData] = notification_data if notification_data query[:priority] = priority if priority query[:jobmetadata] = if http(:post, "/item/#{item_id}/shape", '', :query => query) end |
#item_shape_placholder_create(args = { }, options = { }) ⇒ Object
Create a placeholder shape
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/vidispine/api/client.rb', line 414 def item_shape_placholder_create(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => '/item/#{path_arguments[:item_id]}/shape/placeholder', :default_parameter_send_in_value => :query, :parameters => [ { :name => :item_id, :required => true, :type => :path }, { :name => :tag }, { :name => :container }, { :name => :audio }, { :name => :video }, { :name => :frameDuration }, ] }.merge() ) process_request(_request, ) end |
#item_shapes_get(args = { }, options = { }) ⇒ Object
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/vidispine/api/client.rb', line 434 def item_shapes_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => '/item/#{path_arguments[:item_id]}/shape', :default_parameter_send_in_value => :path, :parameters => [ { :name => :item_id, :required => true }, { :name => :uri, :send_in => :query }, { :name => :placeholder, :send_in => :query }, { :name => :tag, :send_in => :query }, # Not Documented { :name => :version, :send_in => :matrix } ] }.merge() ) process_request(_request, ) end |
#item_sidecar_import(args = { }, options = { }) ⇒ Object
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
# File 'lib/vidispine/api/client.rb', line 514 def item_sidecar_import(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'import/sidecar/#{path_arguments[:item_id]}', :http_method => :post, :parameters => [ { :name => :item_id, :send_in => :path, :required => true }, :sidecar, :notification, :notificationData, :priority, :jobmetadata, ] }.merge() ) process_request(_request, ) end |
#item_thumbnail(args = { }, options = { }) ⇒ Object
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 |
# File 'lib/vidispine/api/client.rb', line 535 def item_thumbnail(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'item/#{path_arguments[:item_id]}/thumbnail', :http_method => :post, :parameters => [ { :name => :item_id, :send_in => :path, :required => true }, :createThumbnails, :createPosters, :thumbnailWidth, :thumbnailHeight, :thumbnailPeriod, :posterWidth, :posterHeight, :postFormat, :notification, :notificationData, :priority, :jobmetadata, :version, :sourceTag ] }.merge() ) process_request(_request, ) end |
#item_transcode(args = { }, options = { }) ⇒ Object Also known as: item_create_thumbnail
565 566 567 |
# File 'lib/vidispine/api/client.rb', line 565 def item_transcode(args = { }, = { }) process_request_using_class(Requests::ItemTranscode, args, ) end |
#item_uris_get(args = { }, options = { }) ⇒ Object Also known as: item_uri_get, item_uris, item_uri
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
# File 'lib/vidispine/api/client.rb', line 571 def item_uris_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => '/item/#{arguments[:item_id]}/uri', :parameters => [ { :name => :item_id, :aliases => [ :id ], :required => true, :send_in => :path }, :type, { :name => :tag, :aliases => [ :tags ] }, :scheme, :closedFiles ] }.merge() ) process_request(_request, ) end |
#items_get(args = { }, options = { }) ⇒ Object Also known as: items
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
# File 'lib/vidispine/api/client.rb', line 592 def items_get(args = { }, = { }) #http(:get, 'item') _request = Requests::BaseRequest.new( args, { :http_path => 'item', :default_parameter_send_in_value => :matrix, :parameters => [ { :name => :result, :send_in => :query }, { :name => :q, :send_in => :query }, :library, :first, :number, :libraryId, :autoRefresh, :updateMode, :updateFrequency ] }.merge() ) process_request(_request, ) end |
#items_search(args = { }, options = { }) ⇒ Object Also known as: item_search
618 619 620 |
# File 'lib/vidispine/api/client.rb', line 618 def items_search(args = { }, = { }) process_request_using_class(Requests::ItemsSearch, args, ) end |
#job_abort(args = { }, options = { }) ⇒ Object
624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
# File 'lib/vidispine/api/client.rb', line 624 def job_abort(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'job/#{arguments[:job_id]}', :http_method => :delete, :parameters => [ { :name => :job_id, :aliases => [ :id ], :send_in => :path }, :reason ] }.merge() ) process_request(_request, ) end |
#job_get(args = { }, options = { }) ⇒ Object
640 641 642 643 644 645 646 647 648 649 650 651 652 |
# File 'lib/vidispine/api/client.rb', line 640 def job_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'job/#{arguments[:job_id]}', :parameters => [ { :name => :job_id, :aliases => [ :id ], :send_in => :path }, :metadata ] } ) process_request(_request, ) end |
#jobs_get(args = { }, options = { }) ⇒ Object Also known as: jobs
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/vidispine/api/client.rb', line 655 def jobs_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'job', :parameters => [ { :name => :jobmetadata, :send_in => :query }, { :name => :metadata, :send_in => :query }, { :name => :idOnly, :send_in => :query }, { :name => 'starttime-from', :send_in => :query }, { :name => 'starttime-to', :send_in => :qeury }, { :name => :step, :send_in => :query }, { :name => :type, :send_in => :matrix }, { :name => :state, :send_in => :matrix }, { :name => :first, :send_in => :matrix }, { :name => :number, :send_in => :matrix }, { :name => :sort, :send_in => :matrix }, { :name => :user, :send_in => :matrix } ] }.merge() ) process_request(_request, ) end |
#metadata_field_delete(args = { }, options = { }) ⇒ Object
682 683 684 685 686 687 688 689 690 691 692 693 694 |
# File 'lib/vidispine/api/client.rb', line 682 def (args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'metadata/#{arguments[:field_name]}', :http_method => :delete, :parameters => [ { :name => :field_name, :aliases => [ :name ], :send_in => :path } ] }.merge() ) process_request(_request, ) end |
#metadata_field_get(args = { }, options = { }) ⇒ Object
697 698 699 700 701 702 703 704 705 706 707 708 |
# File 'lib/vidispine/api/client.rb', line 697 def (args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'metadata/#{arguments[:field_name]}', :parameters => [ { :name => :field_name, :aliases => [ :name ], :send_in => :path } ] }.merge() ) process_request(_request, ) end |
#metadata_field_group_get(args = { }, options = { }) ⇒ Object
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 |
# File 'lib/vidispine/api/client.rb', line 711 def (args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'metadata-field/field-group/#{path_arguments[:group_name]}', :parameters => [ { :name => :group_name, :aliases => [ :name ], :send_in => :path }, :include_values, :traverse, :data ] }.merge() ) process_request(_request, ) end |
#metadata_field_groups_get(args = { }, options = { }) ⇒ Object
728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
# File 'lib/vidispine/api/client.rb', line 728 def (args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'metadata-field/field-group', :parameters => [ :content, :traverse, :data ] }.merge() ) process_request(_request, ) end |
#metadata_field_terse_schema(args = { }, options = { }) ⇒ Object
744 745 746 747 748 |
# File 'lib/vidispine/api/client.rb', line 744 def (args = { }, = { }) = { :headers => { 'accept' => '*/*' } } = .merge() http(:get, 'metadata-field/terse-schema', ) end |
#metadata_fields_get(args = { }, options = { }) ⇒ Object Also known as: metadata_fields
751 752 753 |
# File 'lib/vidispine/api/client.rb', line 751 def (args = { }, = { }) http(:get, 'metadata-field', ) end |
#process_request(request, options = nil) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/vidispine/api/client.rb', line 17 def process_request(request, = nil) @response = nil @request = request request.client = self unless request.client ||= request. logger.warn { "Request is Missing Required Arguments: #{request.missing_required_arguments.inspect}" } unless request.missing_required_arguments.empty? @response = http_client.call_method(request.http_method, { :path => request.path, :query => request.query, :body => request.body }, ) end |
#process_request_using_class(request_class, args, options = { }) ⇒ Object
26 27 28 29 30 |
# File 'lib/vidispine/api/client.rb', line 26 def process_request_using_class(request_class, args, = { }) @response = nil @request = request_class.new(args, .merge(:client => self)) process_request(request, ) end |
#search(args = { }, options = { }) ⇒ Object
758 759 760 |
# File 'lib/vidispine/api/client.rb', line 758 def search(args = { }, = { }) process_request_using_class(Requests::Search, args, ) end |
#search_browse(args = { }, options = { }) ⇒ Object
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File 'lib/vidispine/api/client.rb', line 762 def search_browse(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'search', :parameters => [ :content, :interval, :field, :group, :language, :samplerate, :track, :terse, :include, :type, :tag, :scheme, :closedFiles, 'noauth-url', :defaultValue, :methodType, :version, :revision, { :name => :first, :send_in => :matrix }, { :name => :ItemSearchDocument, :send_in => :body } ] }.merge() ) process_request(_request, ) end |
#storage_delete(args = { }, options = { }) ⇒ Object
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
# File 'lib/vidispine/api/client.rb', line 797 def storage_delete(args = { }, = { }) args = { :storage_id => args } if args.is_a?(String) _request = Requests::BaseRequest.new( args, { :http_path => 'storage/#{path_arguments[:storage_id]}', :http_method => :delete, :parameters => [ { :name => :storage_id, :aliases => [ :id ], :send_in => :path, :required => true }, :safe ] }.merge() ) process_request(_request, ) end |
#storage_file_copy(args = { }, options = { }) ⇒ Object
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 |
# File 'lib/vidispine/api/client.rb', line 814 def storage_file_copy(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'storage/#{path_arguments[:source_storage_id]}/file/#{path_argumetns[:file_id]}/storage/#{path_arguments[:target_source_id]}', :http_method => :post, :parameters => [ { :name => :file_id, :send_in => :path, :required => true }, { :name => :source_storage_id, :send_in => :path, :required => true }, { :name => :target_storage_id, :send_in => :path, :required => true }, :move, :filename, :timeDependency, :limitRate, :notification, :notificationData, :priority, :jobmetadata ] }.merge() ) process_request(_request, ) end |
#storage_file_create(args = { }, options = { }) ⇒ Object
UNDOCUMENTED API METHOD
845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 |
# File 'lib/vidispine/api/client.rb', line 845 def storage_file_create(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'storage/#{path_arguments[:storage_id]}/file', :http_method => :post, :parameters => [ { :name => :storage_id, :send_in => :path, :required => true }, :createOnly, :state, { :name => :path, :send_in => :body } ] }.merge() ) process_request(_request, ) end |
#storage_file_get(args = { }, options = { }) ⇒ Object
Exposes two functions
1. Get status of file in storage
@see http://apidoc.vidispine.com/4.2.3/ref/storage/file.html#get-status-of-file-in-storage
2. Get direct download access to file in storage
@see http://apidoc.vidispine.com/4.2.3/ref/storage/file.html#get-direct-download-access-to-file-in-storage
888 889 890 |
# File 'lib/vidispine/api/client.rb', line 888 def storage_file_get(args = { }, = { }) process_request_using_class(Requests::StorageFileGet, args, ) end |
#storage_file_item_get(args = { }, options = { }) ⇒ Object
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 |
# File 'lib/vidispine/api/client.rb', line 864 def storage_file_item_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'storage/#{path_arguments[:storage_id]}/file/#{path_arguments[:file_id]}/item', :http_method => :get, :parameters => [ { :name => :storage_id, :send_in => :path, :required => true }, { :name => :file_id, :send_in => :path, :required => true }, { :name => :uri, :send_in => :matrix }, { :name => :path, :send_in => :matrix } ] }.merge() ) process_request(_request, ) end |
#storage_files_get(args = { }, options = { }) ⇒ Object
893 894 895 |
# File 'lib/vidispine/api/client.rb', line 893 def storage_files_get(args = { }, = { }) process_request_using_class(Requests::StorageFilesGet, args, ) end |
#storage_get(args = { }, options = { }) ⇒ Object Also known as: storage
898 899 900 901 902 903 904 905 906 907 908 909 910 |
# File 'lib/vidispine/api/client.rb', line 898 def storage_get(args = { }, = { }) args = { :storage_id => args } if args.is_a?(String) _request = Requests::BaseRequest.new( args, { :http_path => 'storage/#{path_arguments[:storage_id]}', :parameters => [ { :name => :storage_id, :aliases => [ :id ], :send_in => :path, :required => true }, ] }.merge() ) process_request(_request, ) end |
#storage_method_get(args = { }, options = { }) ⇒ Object
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 |
# File 'lib/vidispine/api/client.rb', line 914 def storage_method_get(args = { }, = { }) args = { :storage_id => args } if args.is_a?(String) _request = Requests::BaseRequest.new( args, { :http_path => 'storage/#{path_arguments[:storage_id]}/method', :parameters => [ { :name => :storage_id, :aliases => [ :id ], :send_in => :path, :required => true }, { :name => :read, :send_in => :matrix }, { :name => :write, :send_in => :matrix }, { :name => :browse, :send_in => :matrix }, :url, ] }.merge() ) process_request(_request, ) end |
#storage_rescan(args = { }, options = { }) ⇒ Object
937 938 939 940 941 942 943 944 |
# File 'lib/vidispine/api/client.rb', line 937 def storage_rescan(args = { }, = { }) storage_id = args.is_a?(String) ? args : begin _data = Requests::BaseRequest.process_parameters([ { :name => :storage_id, :aliases => [ :id ] } ], args) _args = _data[:arguments_out] _args[:storage_id] end http(:post, "storage/#{storage_id ? "#{storage_id}/" : ''}rescan", '') end |
#storages_get(args = { }, options = { }) ⇒ Object Also known as: storages
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 |
# File 'lib/vidispine/api/client.rb', line 947 def storages_get(args = { }, = { }) _request = Requests::BaseRequest.new( args, { :http_path => 'storage', :parameters => [ :size, :freebytes, :usedbytes, :freeamount, :files, :storagegroup, :status ] }.merge() ) process_request(_request, ) end |
#success? ⇒ Boolean
Tries to determine if the last request got a successful response
42 43 44 45 46 47 48 49 50 |
# File 'lib/vidispine/api/client.rb', line 42 def success? return unless @request if @request.respond_to?(:success?) @request.success? else _response = http_client.response _response && _response.code.start_with?('2') end end |
#version(args = { }, options = { }) ⇒ Object
967 968 969 |
# File 'lib/vidispine/api/client.rb', line 967 def version(args = { }, = { }) http(:get, 'API/version') end |