Class: Tubeclip::Request::StandardSearch
- Inherits:
-
BaseSearch
- Object
- BaseSearch
- Tubeclip::Request::StandardSearch
- Defined in:
- lib/tubeclip/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
-
#category ⇒ Object
readonly
category.
-
#max_results ⇒ Object
readonly
max_results.
-
#offset ⇒ Object
readonly
start-index.
-
#order_by ⇒ Object
readonly
orderby, ([relevance], viewCount, published, rating).
-
#region ⇒ Object
readonly
region.
-
#time ⇒ Object
readonly
time.
Attributes inherited from BaseSearch
Instance Method Summary collapse
-
#initialize(type, options = {}) ⇒ StandardSearch
constructor
A new instance of StandardSearch.
Constructor Details
#initialize(type, options = {}) ⇒ StandardSearch
Returns a new instance of StandardSearch.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tubeclip/request/standard_search.rb', line 15 def initialize(type, ={}) @dev_key = [:dev_key] if [:dev_key] if TYPES.include?(type) @max_results, @order_by, @offset, @time = nil set_instance_variables() @url = base_url @url << @region << "/" if @region @url << type.to_s @url << "_" << @category if @category @url << 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
#category ⇒ Object (readonly)
category
9 10 11 |
# File 'lib/tubeclip/request/standard_search.rb', line 9 def category @category end |
#max_results ⇒ Object (readonly)
max_results
4 5 6 |
# File 'lib/tubeclip/request/standard_search.rb', line 4 def max_results @max_results end |
#offset ⇒ Object (readonly)
start-index
6 7 8 |
# File 'lib/tubeclip/request/standard_search.rb', line 6 def offset @offset end |
#order_by ⇒ Object (readonly)
orderby, ([relevance], viewCount, published, rating)
5 6 7 |
# File 'lib/tubeclip/request/standard_search.rb', line 5 def order_by @order_by end |
#region ⇒ Object (readonly)
region
8 9 10 |
# File 'lib/tubeclip/request/standard_search.rb', line 8 def region @region end |
#time ⇒ Object (readonly)
time
7 8 9 |
# File 'lib/tubeclip/request/standard_search.rb', line 7 def time @time end |