Class: Tubeclip::Request::VideoSearch
- Inherits:
-
BaseSearch
- Object
- BaseSearch
- Tubeclip::Request::VideoSearch
- Includes:
- FieldSearch
- Defined in:
- lib/tubeclip/request/video_search.rb
Overview
:nodoc:
Constant Summary collapse
- ONLY_EMBEDDABLE =
5
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#caption ⇒ Object
readonly
Returns the value of attribute caption.
-
#categories ⇒ Object
readonly
/-/Category1/Category2.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#hd ⇒ Object
readonly
Returns the value of attribute hd.
-
#lang ⇒ Object
readonly
lt.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#location_radius ⇒ Object
readonly
Returns the value of attribute location_radius.
-
#max_results ⇒ Object
readonly
max_results.
-
#offset ⇒ Object
readonly
start-index.
-
#order_by ⇒ Object
readonly
orderby, ([relevance], viewCount, published, rating).
-
#paid_content ⇒ Object
readonly
Returns the value of attribute paid_content.
-
#query ⇒ Object
readonly
vq.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#response_format ⇒ Object
readonly
alt, ([atom], rss, json).
-
#restriction ⇒ Object
readonly
Returns the value of attribute restriction.
-
#safe_search ⇒ Object
readonly
safeSearch (none, [moderate], strict).
-
#tags ⇒ Object
readonly
/-/tag1/tag2.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#uploader ⇒ Object
readonly
Returns the value of attribute uploader.
-
#video_format ⇒ Object
readonly
format (1=mobile devices).
Attributes inherited from BaseSearch
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ VideoSearch
constructor
A new instance of VideoSearch.
Methods included from FieldSearch
#default_fields, #fields_to_params, #formatted_date
Constructor Details
#initialize(params = {}) ⇒ VideoSearch
Returns a new instance of VideoSearch.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/tubeclip/request/video_search.rb', line 32 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, @safe_search, @author, @lang, @duration, @time, @hd, @caption, @uploader, @region, @location, @location_radius, @paid_content = 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=#{Tubeclip::API_VERSION}" 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
#author ⇒ Object (readonly)
Returns the value of attribute author.
18 19 20 |
# File 'lib/tubeclip/request/video_search.rb', line 18 def @author end |
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
24 25 26 |
# File 'lib/tubeclip/request/video_search.rb', line 24 def @caption end |
#categories ⇒ Object (readonly)
/-/Category1/Category2
15 16 17 |
# File 'lib/tubeclip/request/video_search.rb', line 15 def categories @categories end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
21 22 23 |
# File 'lib/tubeclip/request/video_search.rb', line 21 def duration @duration end |
#hd ⇒ Object (readonly)
Returns the value of attribute hd.
23 24 25 |
# File 'lib/tubeclip/request/video_search.rb', line 23 def hd @hd end |
#lang ⇒ Object (readonly)
lt
19 20 21 |
# File 'lib/tubeclip/request/video_search.rb', line 19 def lang @lang end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
28 29 30 |
# File 'lib/tubeclip/request/video_search.rb', line 28 def location @location end |
#location_radius ⇒ Object (readonly)
Returns the value of attribute location_radius.
29 30 31 |
# File 'lib/tubeclip/request/video_search.rb', line 29 def location_radius @location_radius end |
#max_results ⇒ Object (readonly)
max_results
9 10 11 |
# File 'lib/tubeclip/request/video_search.rb', line 9 def max_results @max_results end |
#offset ⇒ Object (readonly)
start-index
11 12 13 |
# File 'lib/tubeclip/request/video_search.rb', line 11 def offset @offset end |
#order_by ⇒ Object (readonly)
orderby, ([relevance], viewCount, published, rating)
10 11 12 |
# File 'lib/tubeclip/request/video_search.rb', line 10 def order_by @order_by end |
#paid_content ⇒ Object (readonly)
Returns the value of attribute paid_content.
27 28 29 |
# File 'lib/tubeclip/request/video_search.rb', line 27 def paid_content @paid_content end |
#query ⇒ Object (readonly)
vq
12 13 14 |
# File 'lib/tubeclip/request/video_search.rb', line 12 def query @query end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
26 27 28 |
# File 'lib/tubeclip/request/video_search.rb', line 26 def region @region end |
#response_format ⇒ Object (readonly)
alt, ([atom], rss, json)
13 14 15 |
# File 'lib/tubeclip/request/video_search.rb', line 13 def response_format @response_format end |
#restriction ⇒ Object (readonly)
Returns the value of attribute restriction.
20 21 22 |
# File 'lib/tubeclip/request/video_search.rb', line 20 def restriction @restriction end |
#safe_search ⇒ Object (readonly)
safeSearch (none, [moderate], strict)
17 18 19 |
# File 'lib/tubeclip/request/video_search.rb', line 17 def safe_search @safe_search end |
#tags ⇒ Object (readonly)
/-/tag1/tag2
14 15 16 |
# File 'lib/tubeclip/request/video_search.rb', line 14 def @tags end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
22 23 24 |
# File 'lib/tubeclip/request/video_search.rb', line 22 def time @time end |
#uploader ⇒ Object (readonly)
Returns the value of attribute uploader.
25 26 27 |
# File 'lib/tubeclip/request/video_search.rb', line 25 def uploader @uploader end |
#video_format ⇒ Object (readonly)
format (1=mobile devices)
16 17 18 |
# File 'lib/tubeclip/request/video_search.rb', line 16 def video_format @video_format end |