Class: YouTubeApi::Query
- Inherits:
-
Object
- Object
- YouTubeApi::Query
- Defined in:
- lib/youtube_api.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Query
constructor
A new instance of Query.
- #query(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Query
Returns a new instance of Query.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/youtube_api.rb', line 7 def initialize(={}) = { :youtube_api_service_name => "youtube", :youtube_api_version => "v3" }.merge() @client = Google::APIClient.new(:key => [:api_key], :authorization => nil) #Please provide :application_name and :application_version when initializing the client @youtube = @client.discovered_api([:youtube_api_service_name], [:youtube_api_version]) end |
Instance Method Details
#query(options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/youtube_api.rb', line 19 def query(={}) = { :part => 'id,snippet' }.merge() search_response = @client.execute!( :api_method => @youtube.search.list, :parameters => ) return search_response.data.items end |