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 25 |
# 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') args.fetch(:user_agent, "Vidispine Ruby SDK v#{Vidispine::VERSION}") @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
############################################################################################################## #
110 111 112 |
# File 'lib/vidispine/api/client.rb', line 110 def collection_access_add(args = { }, = { }) process_request_using_class(Requests::CollectionAccessAdd, args, ) end |
#collection_access_delete(args = { }, options = { }) ⇒ Object
114 115 116 |
# File 'lib/vidispine/api/client.rb', line 114 def collection_access_delete(args = { }, = { }) process_request_using_class(Requests::CollectionAccessDelete, args, ) end |
#collection_access_get(args = { }, options = { }) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/vidispine/api/client.rb', line 119 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
134 135 136 137 138 139 140 141 142 |
# File 'lib/vidispine/api/client.rb', line 134 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
145 146 147 148 149 150 151 152 153 |
# File 'lib/vidispine/api/client.rb', line 145 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
156 157 158 159 160 161 162 163 164 |
# File 'lib/vidispine/api/client.rb', line 156 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
168 169 170 171 172 173 174 175 176 |
# File 'lib/vidispine/api/client.rb', line 168 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
181 182 183 184 185 186 187 188 189 |
# File 'lib/vidispine/api/client.rb', line 181 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
192 193 194 |
# File 'lib/vidispine/api/client.rb', line 192 def (args = { }, = { }) process_request_using_class(Requests::CollectionMetadataSet, args, ) end |
#collection_object_add(args = { }, options = { }) ⇒ Object Also known as: collection_item_add
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/vidispine/api/client.rb', line 198 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
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/vidispine/api/client.rb', line 218 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
239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/vidispine/api/client.rb', line 239 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
255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/vidispine/api/client.rb', line 255 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"
}
}
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/vidispine/api/client.rb', line 96 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
44 45 46 47 48 49 |
# File 'lib/vidispine/api/client.rb', line 44 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
272 273 274 275 276 |
# File 'lib/vidispine/api/client.rb', line 272 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
280 281 282 |
# File 'lib/vidispine/api/client.rb', line 280 def import_placeholder_item(args = { }, = { }) process_request_using_class(Requests::ImportPlaceholderItem, args, ) end |
#import_using_uri(args = { }, options = { }) ⇒ Object Also known as: import
285 286 287 |
# File 'lib/vidispine/api/client.rb', line 285 def import_using_uri(args = { }, = { }) process_request_using_class(Requests::ImportUsingURI, args, ) end |
#item_access_add(args = { }, options = { }) ⇒ Object
290 291 292 |
# File 'lib/vidispine/api/client.rb', line 290 def item_access_add(args = { }, = { }) process_request_using_class(Requests::ItemAccessAdd, args, ) end |
#item_access_delete(args = { }, options = { }) ⇒ Object
294 295 296 |
# File 'lib/vidispine/api/client.rb', line 294 def item_access_delete(args = { }, = { }) process_request_using_class(Requests::ItemAccessDelete, args, ) end |
#item_access_get(args = { }, options = { }) ⇒ Object
299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/vidispine/api/client.rb', line 299 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
314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/vidispine/api/client.rb', line 314 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
329 330 331 332 333 334 335 336 337 |
# File 'lib/vidispine/api/client.rb', line 329 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
341 342 343 |
# File 'lib/vidispine/api/client.rb', line 341 def item_delete(args = { }, = { }) process_request_using_class(Requests::ItemDelete, args, ) end |
#item_export(args = { }, options = { }) ⇒ Object
346 347 348 |
# File 'lib/vidispine/api/client.rb', line 346 def item_export(args = { }, = { }) process_request_using_class(Requests::ItemExport, args, ) end |
#item_get(args = { }, options = { }) ⇒ Object Also known as: item
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/vidispine/api/client.rb', line 351 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
381 382 383 |
# File 'lib/vidispine/api/client.rb', line 381 def (args = { }, = { }) process_request_using_class(Requests::ItemMetadataGet, args, ) end |
#item_metadata_set(args = { }, options = { }) ⇒ Object
387 388 389 |
# File 'lib/vidispine/api/client.rb', line 387 def (args = { }, = { }) process_request_using_class(Requests::ItemMetadataSet, args, ) end |
#item_notifications_delete ⇒ Object
376 377 378 |
# File 'lib/vidispine/api/client.rb', line 376 def item_notifications_delete http(:delete, '/item/notification') end |
#item_shape_files_get(args = { }, options = { }) ⇒ Object Also known as: item_shape_files
392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/vidispine/api/client.rb', line 392 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
409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/vidispine/api/client.rb', line 409 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
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 525 |
# File 'lib/vidispine/api/client.rb', line 466 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
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/vidispine/api/client.rb', line 426 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
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/vidispine/api/client.rb', line 446 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
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
# File 'lib/vidispine/api/client.rb', line 527 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
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
# File 'lib/vidispine/api/client.rb', line 548 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
578 579 580 |
# File 'lib/vidispine/api/client.rb', line 578 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
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 |
# File 'lib/vidispine/api/client.rb', line 584 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
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 |
# File 'lib/vidispine/api/client.rb', line 605 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
631 632 633 |
# File 'lib/vidispine/api/client.rb', line 631 def items_search(args = { }, = { }) process_request_using_class(Requests::ItemsSearch, args, ) end |
#job_abort(args = { }, options = { }) ⇒ Object
637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
# File 'lib/vidispine/api/client.rb', line 637 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
653 654 655 656 657 658 659 660 661 662 663 664 665 |
# File 'lib/vidispine/api/client.rb', line 653 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
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'lib/vidispine/api/client.rb', line 668 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
695 696 697 698 699 700 701 702 703 704 705 706 707 |
# File 'lib/vidispine/api/client.rb', line 695 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
710 711 712 713 714 715 716 717 718 719 720 721 |
# File 'lib/vidispine/api/client.rb', line 710 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
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 |
# File 'lib/vidispine/api/client.rb', line 724 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
741 742 743 744 745 746 747 748 749 750 751 752 753 754 |
# File 'lib/vidispine/api/client.rb', line 741 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
757 758 759 760 761 762 |
# File 'lib/vidispine/api/client.rb', line 757 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
765 766 767 768 |
# File 'lib/vidispine/api/client.rb', line 765 def (args = { }, = { }) path = File.join(api_endpoint_prefix, 'metadata-field') http(:get, path, ) end |
#process_request(request, options = nil) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/vidispine/api/client.rb', line 27 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
36 37 38 39 40 |
# File 'lib/vidispine/api/client.rb', line 36 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
773 774 775 |
# File 'lib/vidispine/api/client.rb', line 773 def search(args = { }, = { }) process_request_using_class(Requests::Search, args, ) end |
#search_browse(args = { }, options = { }) ⇒ Object
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 809 |
# File 'lib/vidispine/api/client.rb', line 777 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
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
# File 'lib/vidispine/api/client.rb', line 812 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
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
# File 'lib/vidispine/api/client.rb', line 829 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
861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 |
# File 'lib/vidispine/api/client.rb', line 861 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
904 905 906 |
# File 'lib/vidispine/api/client.rb', line 904 def storage_file_get(args = { }, = { }) process_request_using_class(Requests::StorageFileGet, args, ) end |
#storage_file_item_get(args = { }, options = { }) ⇒ Object
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 |
# File 'lib/vidispine/api/client.rb', line 880 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
909 910 911 |
# File 'lib/vidispine/api/client.rb', line 909 def storage_files_get(args = { }, = { }) process_request_using_class(Requests::StorageFilesGet, args, ) end |
#storage_get(args = { }, options = { }) ⇒ Object Also known as: storage
914 915 916 917 918 919 920 921 922 923 924 925 926 |
# File 'lib/vidispine/api/client.rb', line 914 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
930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 |
# File 'lib/vidispine/api/client.rb', line 930 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
953 954 955 956 957 958 959 960 961 |
# File 'lib/vidispine/api/client.rb', line 953 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
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 |
# File 'lib/vidispine/api/client.rb', line 964 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
52 53 54 55 56 57 58 59 60 |
# File 'lib/vidispine/api/client.rb', line 52 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
984 985 986 |
# File 'lib/vidispine/api/client.rb', line 984 def version(args = { }, = { }) http(:get, File.join(api_endpoint_prefix, 'version')) end |