Class: YouTubeG::Response::CommentsSearch
- Inherits:
-
YouTubeG::Record
- Object
- YouTubeG::Record
- YouTubeG::Response::CommentsSearch
- Defined in:
- lib/youtube_g/response/comments_search.rb
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array
-
Array of YouTubeG::Model::Video records.
-
#feed_id ⇒ Object
readonly
- String
-
Unique feed identifying url.
-
#max_result_count ⇒ Object
readonly
- Fixnum
-
Number of results per page.
-
#offset ⇒ Object
readonly
- Fixnum
-
1-based offset index into the full result set.
-
#total_result_count ⇒ Object
readonly
- Fixnum
-
Total number of results available for the original request.
-
#updated_at ⇒ Object
readonly
- Time
-
Date and time at which the feed was last updated.
Instance Method Summary collapse
- #current_page ⇒ Object
-
#next_page ⇒ Object
current_page + 1 or nil if there is no next page.
-
#previous_page ⇒ Object
current_page - 1 or nil if there is no previous page.
- #total_pages ⇒ Object
Methods inherited from YouTubeG::Record
Constructor Details
This class inherits a constructor from YouTubeG::Record
Instance Attribute Details
#comments ⇒ Object (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_id ⇒ Object (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_count ⇒ Object (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 |
#offset ⇒ Object (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_count ⇒ Object (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_at ⇒ Object (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_page ⇒ Object
22 23 24 |
# File 'lib/youtube_g/response/comments_search.rb', line 22 def current_page ((offset - 1) / max_result_count) + 1 end |
#next_page ⇒ Object
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_page ⇒ Object
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_pages ⇒ Object
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 |