Class: GoogleVideo::TopVideosRequest

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

Overview

Describes a request for the current list of top videos on Google Video. Parameters are specified via a hash passed to the object on construction mapping attribute names to their respective values.

Constant Summary collapse

COUNTRIES =

the list of countries by which one can constrain a search for top videos

{
  'All' => 'all',
  'Argentina' => 'arg',
  'Australia' => 'aus',
  'Austria' => 'aut',
  'Brazil' => 'bra',
  'Canada' => 'can',
  'Chile' => 'chl',
  'Denmark' => 'dnk',
  'Finland' => 'fin',
  'France' => 'fra',
  'Germany' => 'deu',
  'Greece' => 'grc',
  'Hong Kong' => 'hkg',
  'India' => 'ind',
  'Indonesia' => 'idn',
  'Ireland' => 'irl',
  'Israel' => 'isr',
  'Italy' => 'ita',
  'Japan' => 'jpn',
  'Kenya' => 'ken',
  'Malaysia' => 'mys',
  'Mexico' => 'mex',
  'Netherlands' => 'nld',
  'New Zealand' => 'nzl',
  'Norway' => 'nor',
  'Peru' => 'per',
  'Philippines' => 'phl',
  'Poland' => 'pol',
  'Russia' => 'rus',
  'Saudi Arabia' => 'sau',
  'Singapore' => 'sgp',
  'South Africa' => 'zaf',
  'South Korea' => 'kor',
  'Spain' => 'esp',
  'Sweden' => 'swe',
  'Switzerland' => 'che',
  'Taiwan' => 'twn',
  'Thailand' => 'tha',
  'Turkey' => 'tur',
  'Ukraine' => 'ukr',
  'United Arab Emirates' => 'are',
  'United Kingdom' => 'gbr',
  'United States' => 'usa',
  'Vietnam' => 'vnm'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = nil) ⇒ TopVideosRequest

Constructs a TopVideosRequest with an optional supplied hash mapping attribute names to their respective values.



302
303
304
305
306
307
308
309
# File 'lib/google-video.rb', line 302

def initialize (params = nil)
  super(params)
  
  # validate request parameters
  if @country && !COUNTRIES.include?(@country)
    raise ArgumentError.new("invalid country parameter: #{@country}")
  end
end

Instance Attribute Details

#countryObject (readonly)

optional: the country by which results are to be constrained, defaulting to nil. Specifying ‘all’ or nil will provide results across all countries.



298
299
300
# File 'lib/google-video.rb', line 298

def country
  @country
end