Class: YouTubeG::Request::CommentsSearch

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

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from BaseSearch

#url

Instance Method Summary collapse

Constructor Details

#initialize(video_id, options = {}) ⇒ CommentsSearch

Returns a new instance of CommentsSearch.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/youtube_g/request/comments_search.rb', line 7

def initialize(video_id, options={})
  @max_results, @order_by, @offset = nil
  @url = base_url

  @url << "videos/#{video_id}/comments"
  set_instance_variables(options)

  if options.has_key?(:per_page)
    @max_results = options[:per_page]
  end
  
  if options.has_key?(:page)
    per_page = @max_results || 25
    @offset = calculate_offset(options[:page], per_page)
  end
  
  @url << build_query_params(to_youtube_params)
end

Instance Attribute Details

#max_resultsObject (readonly)

max_results



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

def max_results
  @max_results
end

#offsetObject (readonly)

start-index



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

def offset
  @offset
end