Class: Hypem::TrackFavorites
- Inherits:
-
Object
- Object
- Hypem::TrackFavorites
- Includes:
- Helper
- Defined in:
- lib/hypem/track_favorites.rb
Constant Summary collapse
- LIMIT =
20
Instance Attribute Summary collapse
-
#media_id ⇒ Object
Returns the value of attribute media_id.
-
#users ⇒ Object
Returns the value of attribute users.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(media_id, page = nil) ⇒ TrackFavorites
constructor
A new instance of TrackFavorites.
- #next_page ⇒ Object
- #page(num) ⇒ Object
- #prev_page ⇒ Object
Methods included from Helper
included, #update_from_response
Constructor Details
#initialize(media_id, page = nil) ⇒ TrackFavorites
Returns a new instance of TrackFavorites.
9 10 11 12 13 |
# File 'lib/hypem/track_favorites.rb', line 9 def initialize(media_id, page=nil) page = 1 if page.nil? @media_id = media_id @page = page end |
Instance Attribute Details
#media_id ⇒ Object
Returns the value of attribute media_id.
5 6 7 |
# File 'lib/hypem/track_favorites.rb', line 5 def media_id @media_id end |
#users ⇒ Object
Returns the value of attribute users.
5 6 7 |
# File 'lib/hypem/track_favorites.rb', line 5 def users @users end |
Instance Method Details
#get ⇒ Object
15 16 17 18 19 |
# File 'lib/hypem/track_favorites.rb', line 15 def get user_ids = TrackFavoritesRequest.get_data(path) @users = user_ids.map{|user_id| User.new(user_id)} self end |
#next_page ⇒ Object
21 22 23 |
# File 'lib/hypem/track_favorites.rb', line 21 def next_page TrackFavorites.new(@media_id,@page+1).get end |
#page(num) ⇒ Object
29 30 31 |
# File 'lib/hypem/track_favorites.rb', line 29 def page(num) TrackFavorites.new(@media_id,num).get end |
#prev_page ⇒ Object
25 26 27 |
# File 'lib/hypem/track_favorites.rb', line 25 def prev_page TrackFavorites.new(@media_id,@page+1).get end |