Class: Soundcloud2000::Models::Track
- Inherits:
-
Object
- Object
- Soundcloud2000::Models::Track
- Defined in:
- lib/soundcloud2000/models/track.rb
Instance Method Summary collapse
- #comments ⇒ Object
- #duration ⇒ Object
- #id ⇒ Object
-
#initialize(hash) ⇒ Track
constructor
A new instance of Track.
- #length ⇒ Object
- #likes ⇒ Object
- #plays ⇒ Object
- #stream_url ⇒ Object
- #title ⇒ Object
- #url ⇒ Object
- #user ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(hash) ⇒ Track
Returns a new instance of Track.
7 8 9 |
# File 'lib/soundcloud2000/models/track.rb', line 7 def initialize(hash) @hash = hash end |
Instance Method Details
#comments ⇒ Object
47 48 49 |
# File 'lib/soundcloud2000/models/track.rb', line 47 def comments @hash['comments'] end |
#duration ⇒ Object
31 32 33 |
# File 'lib/soundcloud2000/models/track.rb', line 31 def duration @hash['duration'] end |
#id ⇒ Object
11 12 13 |
# File 'lib/soundcloud2000/models/track.rb', line 11 def id @hash['id'] end |
#length ⇒ Object
35 36 37 |
# File 'lib/soundcloud2000/models/track.rb', line 35 def length TimeHelper.duration(duration) end |
#likes ⇒ Object
43 44 45 |
# File 'lib/soundcloud2000/models/track.rb', line 43 def likes @hash['favoritings_count'] end |
#plays ⇒ Object
39 40 41 |
# File 'lib/soundcloud2000/models/track.rb', line 39 def plays @hash['playback_count'] end |
#stream_url ⇒ Object
51 52 53 |
# File 'lib/soundcloud2000/models/track.rb', line 51 def stream_url @hash['stream_url'] end |
#title ⇒ Object
15 16 17 |
# File 'lib/soundcloud2000/models/track.rb', line 15 def title @hash['title'] end |
#url ⇒ Object
19 20 21 |
# File 'lib/soundcloud2000/models/track.rb', line 19 def url @hash['permalink_url'] end |
#user ⇒ Object
23 24 25 |
# File 'lib/soundcloud2000/models/track.rb', line 23 def user @user ||= User.new(@hash['user']) end |
#username ⇒ Object
27 28 29 |
# File 'lib/soundcloud2000/models/track.rb', line 27 def username user.username end |