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
-
#api_endpoint_prefix ⇒ Object
Returns the value of attribute api_endpoint_prefix.
-
#api_noauth_endpoint_prefix ⇒ Object
Returns the value of attribute api_noauth_endpoint_prefix.
-
#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_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.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vidispine/api/client.rb', line 14 def initialize(args = { }) # API Path @api_endpoint_prefix = args.fetch(:api_endpoint_prefix, 'API') # APInoAuth Path @api_noauth_endpoint_prefix = args.fetch(:api_noauth_endpoint_prefix, 'APInoauth') @http_client = HTTPClient.new(args) @logger = http_client.logger end |
Instance Attribute Details
#api_endpoint_prefix ⇒ Object
Returns the value of attribute api_endpoint_prefix.
12 13 14 |
# File 'lib/vidispine/api/client.rb', line 12 def api_endpoint_prefix @api_endpoint_prefix end |
#api_noauth_endpoint_prefix ⇒ Object
Returns the value of attribute api_noauth_endpoint_prefix.
12 13 14 |
# File 'lib/vidispine/api/client.rb', line 12 def api_noauth_endpoint_prefix @api_noauth_endpoint_prefix end |
#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
############################################################################################################## #
109 110 111 |
# File 'lib/vidispine/api/client.rb', line 109 def collection_access_add(args = { }, = { }) process_request_using_class(Requests::CollectionAccessAdd, args, ) end |
#collection_access_delete(args = { }, options = { }) ⇒ Object
113 114 115 |
# File 'lib/vidispine/api/client.rb', line 113 def collection_access_delete(args = { }, = { }) process_request_using_class(Requests::CollectionAccessDelete, args, ) end |
#collection_access_get(args = { }, options = { }) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/vidispine/api/client.rb', line 118 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
133 134 135 136 137 138 139 140 141 |
# File 'lib/vidispine/api/client.rb', line 133 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 path = File.join(api_endpoint_prefix, '/collection') http(:post, path, '{}', :query => { :name => collection_name }) end |
#collection_delete(args = { }, options = { }) ⇒ Object
144 145 146 147 148 149 150 151 152 |
# File 'lib/vidispine/api/client.rb', line 144 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 path = File.join(api_endpoint_prefix, "/collection/#{collection_id}") http(:delete, path) end |
#collection_get(args = { }, options = { }) ⇒ Object Also known as: collection
155 156 157 158 159 160 161 162 163 |
# File 'lib/vidispine/api/client.rb', line 155 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 path = File.join(api_endpoint_prefix, "/collection/#{collection_id}") http(:get, path) end |
#collection_items_get(args = { }, options = { }) ⇒ Object Also known as: collection_items
167 168 169 170 171 172 173 174 175 |
# File 'lib/vidispine/api/client.rb', line 167 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 path = File.join(api_endpoint_prefix, "collection/#{collection_id}/item") http(:get, path) end |
#collection_metadata_get(args = { }, options = { }) ⇒ Object
180 181 182 183 184 185 186 187 188 |
# File 'lib/vidispine/api/client.rb', line 180 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 path = File.join(api_endpoint_prefix, "/collection/#{collection_id}/metadata") http(:get, path) end |
#collection_metadata_set(args = { }, options = { }) ⇒ Object Also known as: collection_metadata_update
191 192 193 |
# File 'lib/vidispine/api/client.rb', line 191 def (args = { }, = { }) process_request_using_class(Requests::CollectionMetadataSet, args, ) end |
#collection_object_add(args = { }, options = { }) ⇒ Object Also known as: collection_item_add
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/vidispine/api/client.rb', line 197 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
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/vidispine/api/client.rb', line 217 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
238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/vidispine/api/client.rb', line 238 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
254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/vidispine/api/client.rb', line 254 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"
}
}
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/vidispine/api/client.rb', line 95 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
43 44 45 46 47 48 |
# File 'lib/vidispine/api/client.rb', line 43 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
271 272 273 274 275 |
# File 'lib/vidispine/api/client.rb', line 271 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
279 280 281 |
# File 'lib/vidispine/api/client.rb', line 279 def import_placeholder_item(args = { }, = { }) process_request_using_class(Requests::ImportPlaceholderItem, args, ) end |
#import_using_uri(args = { }, options = { }) ⇒ Object Also known as: import
284 285 286 |
# File 'lib/vidispine/api/client.rb', line 284 def import_using_uri(args = { }, = { }) process_request_using_class(Requests::ImportUsingURI, args, ) end |
#item_access_add(args = { }, options = { }) ⇒ Object
289 290 291 |
# File 'lib/vidispine/api/client.rb', line 289 def item_access_add(args = { }, = { }) process_request_using_class(Requests::ItemAccessAdd, args, ) end |
#item_access_delete(args = { }, options = { }) ⇒ Object
293 294 295 |
# File 'lib/vidispine/api/client.rb', line 293 def item_access_delete(args = { }, = { }) process_request_using_class(Requests::ItemAccessDelete, args, ) end |
#item_access_get(args = { }, options = { }) ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/vidispine/api/client.rb', line 298 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
313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/vidispine/api/client.rb', line 313 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
328 329 330 331 332 333 334 335 336 |
# File 'lib/vidispine/api/client.rb', line 328 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 path = File.join(api_endpoint_prefix, "/item/#{item_id}/collections") http(:get, path) end |
#item_delete(args = { }, options = { }) ⇒ Object
340 341 342 |
# File 'lib/vidispine/api/client.rb', line 340 def item_delete(args = { }, = { }) process_request_using_class(Requests::ItemDelete, args, ) end |
#item_export(args = { }, options = { }) ⇒ Object
345 346 347 |
# File 'lib/vidispine/api/client.rb', line 345 def item_export(args = { }, = { }) process_request_using_class(Requests::ItemExport, args, ) end |
#item_get(args = { }, options = { }) ⇒ Object Also known as: item
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/vidispine/api/client.rb', line 350 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
380 381 382 |
# File 'lib/vidispine/api/client.rb', line 380 def (args = { }, = { }) process_request_using_class(Requests::ItemMetadataGet, args, ) end |
#item_metadata_set(args = { }, options = { }) ⇒ Object
386 387 388 |
# File 'lib/vidispine/api/client.rb', line 386 def (args = { }, = { }) process_request_using_class(Requests::ItemMetadataSet, args, ) end |
#item_notifications_delete ⇒ Object
375 376 377 |
# File 'lib/vidispine/api/client.rb', line 375 def item_notifications_delete http(:delete, '/item/notification') end |
#item_shape_files_get(args = { }, options = { }) ⇒ Object Also known as: item_shape_files
391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/vidispine/api/client.rb', line 391 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
408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/vidispine/api/client.rb', line 408 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
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 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/vidispine/api/client.rb', line 465 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 path = File.join(api_endpoint_prefix, "/item/#{item_id}/shape") http(:post, path, '', :query => query) end |
#item_shape_placholder_create(args = { }, options = { }) ⇒ Object
Create a placeholder shape
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/vidispine/api/client.rb', line 425 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
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/vidispine/api/client.rb', line 445 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
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 |
# File 'lib/vidispine/api/client.rb', line 526 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
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
# File 'lib/vidispine/api/client.rb', line 547 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
577 578 579 |
# File 'lib/vidispine/api/client.rb', line 577 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
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
# File 'lib/vidispine/api/client.rb', line 583 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
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
# File 'lib/vidispine/api/client.rb', line 604 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
630 631 632 |
# File 'lib/vidispine/api/client.rb', line 630 def items_search(args = { }, = { }) process_request_using_class(Requests::ItemsSearch, args, ) end |
#job_abort(args = { }, options = { }) ⇒ Object
636 637 638 639 640 641 642 643 644 645 646 647 648 649 |
# File 'lib/vidispine/api/client.rb', line 636 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
652 653 654 655 656 657 658 659 660 661 662 663 664 |
# File 'lib/vidispine/api/client.rb', line 652 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
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
# File 'lib/vidispine/api/client.rb', line 667 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
694 695 696 697 698 699 700 701 702 703 704 705 706 |
# File 'lib/vidispine/api/client.rb', line 694 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
709 710 711 712 713 714 715 716 717 718 719 720 |
# File 'lib/vidispine/api/client.rb', line 709 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
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 |
# File 'lib/vidispine/api/client.rb', line 723 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
740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
# File 'lib/vidispine/api/client.rb', line 740 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
756 757 758 759 760 761 |
# File 'lib/vidispine/api/client.rb', line 756 def (args = { }, = { }) = { :headers => { 'accept' => '*/*' } } = .merge() path = File.join(api_endpoint_prefix, 'metadata-field/terse-schema') http(:get, path, ) end |
#metadata_fields_get(args = { }, options = { }) ⇒ Object Also known as: metadata_fields
764 765 766 767 |
# File 'lib/vidispine/api/client.rb', line 764 def (args = { }, = { }) path = File.join(api_endpoint_prefix, 'metadata-field') http(:get, path, ) end |
#process_request(request, options = nil) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/vidispine/api/client.rb', line 26 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.build_and_send_request(request.http_method, { :path => request.path, :query => request.query, :body => request.body }, ) end |
#process_request_using_class(request_class, args, options = { }) ⇒ Object
35 36 37 38 39 |
# File 'lib/vidispine/api/client.rb', line 35 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
772 773 774 |
# File 'lib/vidispine/api/client.rb', line 772 def search(args = { }, = { }) process_request_using_class(Requests::Search, args, ) end |
#search_browse(args = { }, options = { }) ⇒ Object
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 |
# File 'lib/vidispine/api/client.rb', line 776 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
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 |
# File 'lib/vidispine/api/client.rb', line 811 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
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 |
# File 'lib/vidispine/api/client.rb', line 828 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
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
# File 'lib/vidispine/api/client.rb', line 860 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
903 904 905 |
# File 'lib/vidispine/api/client.rb', line 903 def storage_file_get(args = { }, = { }) process_request_using_class(Requests::StorageFileGet, args, ) end |
#storage_file_item_get(args = { }, options = { }) ⇒ Object
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
# File 'lib/vidispine/api/client.rb', line 879 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
908 909 910 |
# File 'lib/vidispine/api/client.rb', line 908 def storage_files_get(args = { }, = { }) process_request_using_class(Requests::StorageFilesGet, args, ) end |
#storage_get(args = { }, options = { }) ⇒ Object Also known as: storage
913 914 915 916 917 918 919 920 921 922 923 924 925 |
# File 'lib/vidispine/api/client.rb', line 913 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
929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 |
# File 'lib/vidispine/api/client.rb', line 929 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
952 953 954 955 956 957 958 959 960 |
# File 'lib/vidispine/api/client.rb', line 952 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 path = File.join(api_endpoint_prefix, "storage/#{storage_id ? "#{storage_id}/" : ''}rescan") http(:post, path, '') end |
#storages_get(args = { }, options = { }) ⇒ Object Also known as: storages
963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 |
# File 'lib/vidispine/api/client.rb', line 963 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
51 52 53 54 55 56 57 58 59 |
# File 'lib/vidispine/api/client.rb', line 51 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
983 984 985 |
# File 'lib/vidispine/api/client.rb', line 983 def version(args = { }, = { }) http(:get, File.join(api_endpoint_prefix, 'version')) end |