Class: YouTubeIt::Request::VideoSearch
- Inherits:
-
BaseSearch
- Object
- BaseSearch
- YouTubeIt::Request::VideoSearch
- Includes:
- FieldSearch
- Defined in:
- lib/youtube_it/request/video_search.rb
Overview
:nodoc:
Constant Summary
- ONLY_EMBEDDABLE =
5
Instance Attribute Summary (collapse)
-
- (Object) author
readonly
Returns the value of attribute author.
-
- (Object) categories
readonly
Returns the value of attribute categories.
-
- (Object) lang
readonly
lt.
-
- (Object) max_results
readonly
Returns the value of attribute max_results.
-
- (Object) offset
readonly
Returns the value of attribute offset.
-
- (Object) order_by
readonly
Returns the value of attribute order_by.
-
- (Object) query
readonly
Returns the value of attribute query.
-
- (Object) racy
readonly
max_results orderby, ([relevance], viewCount, published, rating) start-index vq alt, ([atom], rss, json) /-/tag1/tag2 /-/Category1/Category2 format (1=mobile devices) racy ([exclude], include).
-
- (Object) response_format
readonly
Returns the value of attribute response_format.
-
- (Object) tags
readonly
Returns the value of attribute tags.
-
- (Object) video_format
readonly
Returns the value of attribute video_format.
Attributes inherited from BaseSearch
Instance Method Summary (collapse)
-
- (VideoSearch) initialize(params = {})
constructor
A new instance of VideoSearch.
Methods included from FieldSearch
#default_fields, #fields_to_params, #formatted_date
Constructor Details
- (VideoSearch) initialize(params = {})
A new instance of VideoSearch
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/youtube_it/request/video_search.rb', line 21 def initialize(params={}) # Initialize our various member data to avoid warnings and so we'll # automatically fall back to the youtube api defaults @max_results, @order_by, @offset, @query, @response_format, @video_format, @racy, @author, @lang = nil @url = base_url @dev_key = params[:dev_key] if params[:dev_key] # Return a single video (base_url + /T7YazwP8GtY) return @url << "/" << params[:video_id] << "?v=2" if params[:video_id] @url << "/-/" if (params[:categories] || params[:tags]) @url << categories_to_params(params.delete(:categories)) if params[:categories] @url << (params.delete(:tags)) if params[:tags] set_instance_variables(params) if( params[ :only_embeddable ] ) @video_format = ONLY_EMBEDDABLE end @url << build_query_params(to_youtube_params) @url << fields_to_params(params.delete(:fields)) if params[:fields] end |
Instance Attribute Details
- (Object) author (readonly)
Returns the value of attribute author
18 19 20 |
# File 'lib/youtube_it/request/video_search.rb', line 18 def @author end |
- (Object) categories (readonly)
Returns the value of attribute categories
15 16 17 |
# File 'lib/youtube_it/request/video_search.rb', line 15 def categories @categories end |
- (Object) lang (readonly)
lt
19 20 21 |
# File 'lib/youtube_it/request/video_search.rb', line 19 def lang @lang end |
- (Object) max_results (readonly)
Returns the value of attribute max_results
9 10 11 |
# File 'lib/youtube_it/request/video_search.rb', line 9 def max_results @max_results end |
- (Object) offset (readonly)
Returns the value of attribute offset
11 12 13 |
# File 'lib/youtube_it/request/video_search.rb', line 11 def offset @offset end |
- (Object) order_by (readonly)
Returns the value of attribute order_by
10 11 12 |
# File 'lib/youtube_it/request/video_search.rb', line 10 def order_by @order_by end |
- (Object) query (readonly)
Returns the value of attribute query
12 13 14 |
# File 'lib/youtube_it/request/video_search.rb', line 12 def query @query end |
- (Object) racy (readonly)
max_results orderby, ([relevance], viewCount, published, rating) start-index vq alt, ([atom], rss, json) /-/tag1/tag2 /-/Category1/Category2 format (1=mobile devices) racy ([exclude], include)
17 18 19 |
# File 'lib/youtube_it/request/video_search.rb', line 17 def racy @racy end |
- (Object) response_format (readonly)
Returns the value of attribute response_format
13 14 15 |
# File 'lib/youtube_it/request/video_search.rb', line 13 def response_format @response_format end |
- (Object) tags (readonly)
Returns the value of attribute tags
14 15 16 |
# File 'lib/youtube_it/request/video_search.rb', line 14 def @tags end |
- (Object) video_format (readonly)
Returns the value of attribute video_format
16 17 18 |
# File 'lib/youtube_it/request/video_search.rb', line 16 def video_format @video_format end |