Class: YouTubeG::Request::StandardSearch

Inherits:
BaseSearch
  • Object
show all
Defined in:
lib/youtube_g/request/standard_search.rb

Overview

:nodoc:

Constant Summary collapse

TYPES =
[ :top_rated, :top_favorites, :most_viewed, :most_popular,
:most_recent, :most_discussed, :most_linked, :most_responded,
:recently_featured, :watch_on_mobile ]

Instance Attribute Summary collapse

Attributes inherited from BaseSearch

#url

Instance Method Summary collapse

Constructor Details

#initialize(type, options = {}) ⇒ StandardSearch

Returns a new instance of StandardSearch.



13
14
15
16
17
18
19
20
21
# File 'lib/youtube_g/request/standard_search.rb', line 13

def initialize(type, options={})
  if TYPES.include?(type)
    @max_results, @order_by, @offset, @time = nil
    set_instance_variables(options)
    @url = base_url + type.to_s << build_query_params(to_youtube_params)
  else
    raise "Invalid type, must be one of: #{ TYPES.map { |t| t.to_s }.join(", ") }"
  end
end

Instance Attribute Details

#max_resultsObject (readonly)

max_results



4
5
6
# File 'lib/youtube_g/request/standard_search.rb', line 4

def max_results
  @max_results
end

#offsetObject (readonly)

start-index



6
7
8
# File 'lib/youtube_g/request/standard_search.rb', line 6

def offset
  @offset
end

#order_byObject (readonly)

orderby, ([relevance], viewCount, published, rating)



5
6
7
# File 'lib/youtube_g/request/standard_search.rb', line 5

def order_by
  @order_by
end

#timeObject (readonly)

time



7
8
9
# File 'lib/youtube_g/request/standard_search.rb', line 7

def time
  @time
end