Class: GoogleVideo::VideoDetailsRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/google-video.rb

Overview

Describes a request of the Google Video service for details on a specific previously retrieved Video or its stored doc_id. Only one of either video or doc_id should be specified in the request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ VideoDetailsRequest

Constructs a VideoDetailsRequest with the supplied hash mapping attribute names to their respective values.



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/google-video.rb', line 398

def initialize (params)
  params.each { |key, value| instance_variable_set('@' + key.to_s, value) }
  
  # validate request parameters
  if !@video && !@doc_id
    raise ArgumentError.new("invalid request, one of video or doc_id parameter required")
  end
  if @video && @doc_id
    raise ArgumentError.new("invalid request, only one of video or doc_id parameters may be specified")
  end
  if @video && !@video.is_a?(Video)
    raise ArgumentError.new("invalid request, video must be a GoogleVideo::Video")
  end
  if @doc_id && !@doc_id.is_a?(Bignum)
    raise ArgumentError.new("invalid request, doc_id must be a Bignum")
  end
end

Instance Attribute Details

#doc_idObject (readonly)

the doc_id of the video whose details are sought.



394
395
396
# File 'lib/google-video.rb', line 394

def doc_id
  @doc_id
end

#videoObject (readonly)

the Video object whose details are sought.



391
392
393
# File 'lib/google-video.rb', line 391

def video
  @video
end