Class: YouTubeG::Response::CommentsSearch

Inherits:
YouTubeG::Record show all
Defined in:
lib/youtube_g/response/comments_search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from YouTubeG::Record

#initialize

Constructor Details

This class inherits a constructor from YouTubeG::Record

Instance Attribute Details

#commentsObject (readonly)

Array

Array of YouTubeG::Model::Video records



20
21
22
# File 'lib/youtube_g/response/comments_search.rb', line 20

def comments
  @comments
end

#feed_idObject (readonly)

String

Unique feed identifying url.



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

def feed_id
  @feed_id
end

#max_result_countObject (readonly)

Fixnum

Number of results per page.



8
9
10
# File 'lib/youtube_g/response/comments_search.rb', line 8

def max_result_count
  @max_result_count
end

#offsetObject (readonly)

Fixnum

1-based offset index into the full result set.



11
12
13
# File 'lib/youtube_g/response/comments_search.rb', line 11

def offset
  @offset
end

#total_result_countObject (readonly)

Fixnum

Total number of results available for the original request.



14
15
16
# File 'lib/youtube_g/response/comments_search.rb', line 14

def total_result_count
  @total_result_count
end

#updated_atObject (readonly)

Time

Date and time at which the feed was last updated



17
18
19
# File 'lib/youtube_g/response/comments_search.rb', line 17

def updated_at
  @updated_at
end

Instance Method Details

#current_pageObject



22
23
24
# File 'lib/youtube_g/response/comments_search.rb', line 22

def current_page
  ((offset - 1) / max_result_count) + 1
end

#next_pageObject

current_page + 1 or nil if there is no next page



27
28
29
# File 'lib/youtube_g/response/comments_search.rb', line 27

def next_page
  current_page < total_pages ? (current_page + 1) : nil
end

#previous_pageObject

current_page - 1 or nil if there is no previous page



32
33
34
# File 'lib/youtube_g/response/comments_search.rb', line 32

def previous_page
  current_page > 1 ? (current_page - 1) : nil
end

#total_pagesObject



36
37
38
# File 'lib/youtube_g/response/comments_search.rb', line 36

def total_pages
  (total_result_count / max_result_count.to_f).ceil
end