Class: YouTubeG::Request::StandardSearch
- Inherits:
-
BaseSearch
- Object
- BaseSearch
- YouTubeG::Request::StandardSearch
- Defined in:
- lib/youtube_g/request/video_search.rb
Constant Summary collapse
- TYPES =
[ :most_viewed, :top_rated, :recently_featured, :watch_on_mobile ]
- TIMES =
[ :all_time, :today, :this_week, :this_month ]
Instance Attribute Summary
Attributes inherited from BaseSearch
Instance Method Summary collapse
- #base_url ⇒ Object
-
#initialize(type, options = {}) ⇒ StandardSearch
constructor
A new instance of StandardSearch.
Constructor Details
#initialize(type, options = {}) ⇒ StandardSearch
Returns a new instance of StandardSearch.
31 32 33 34 35 36 37 38 |
# File 'lib/youtube_g/request/video_search.rb', line 31 def initialize(type, ={}) if TYPES.include?(type) @url = base_url << type.to_s @url << "?time=#{CGI.escape(.delete(:time).to_s)}" if TIMES.include?([:time]) else raise "Invalid type, must be one of: #{ TYPES.map { |t| t.to_s }.join(", ") }" end end |
Instance Method Details
#base_url ⇒ Object
40 41 42 |
# File 'lib/youtube_g/request/video_search.rb', line 40 def base_url super << "standardfeeds/" end |