Class: Tubeclip::Response::VideoSearch
- Inherits:
-
Tubeclip::Record
- Object
- Tubeclip::Record
- Tubeclip::Response::VideoSearch
- Defined in:
- lib/tubeclip/response/video_search.rb
Instance Attribute Summary collapse
-
#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.
-
#videos ⇒ Object
readonly
- Array
-
Array of Tubeclip::Model::Video records.
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 Tubeclip::Record
Constructor Details
This class inherits a constructor from Tubeclip::Record
Instance Attribute Details
#feed_id ⇒ Object (readonly)
- String
-
Unique feed identifying url.
5 6 7 |
# File 'lib/tubeclip/response/video_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/tubeclip/response/video_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/tubeclip/response/video_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/tubeclip/response/video_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/tubeclip/response/video_search.rb', line 17 def updated_at @updated_at end |
#videos ⇒ Object (readonly)
- Array
-
Array of Tubeclip::Model::Video records
20 21 22 |
# File 'lib/tubeclip/response/video_search.rb', line 20 def videos @videos end |
Instance Method Details
#current_page ⇒ Object
22 23 24 |
# File 'lib/tubeclip/response/video_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/tubeclip/response/video_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/tubeclip/response/video_search.rb', line 32 def previous_page current_page > 1 ? (current_page - 1) : nil end |
#total_pages ⇒ Object
36 37 38 |
# File 'lib/tubeclip/response/video_search.rb', line 36 def total_pages (total_result_count / max_result_count.to_f).ceil end |