Class: Spotify::Models::Track
- Inherits:
-
Object
- Object
- Spotify::Models::Track
- Defined in:
- lib/spotify/models/track.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#artists ⇒ Object
readonly
Returns the value of attribute artists.
-
#available_markets ⇒ Object
readonly
Returns the value of attribute available_markets.
-
#disc_number ⇒ Object
readonly
Returns the value of attribute disc_number.
-
#duration_ms ⇒ Object
readonly
Returns the value of attribute duration_ms.
-
#explicit ⇒ Object
readonly
Returns the value of attribute explicit.
-
#external_urls ⇒ Object
readonly
Returns the value of attribute external_urls.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_playable ⇒ Object
readonly
Returns the value of attribute is_playable.
-
#linked_from ⇒ Object
readonly
Returns the value of attribute linked_from.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#preview_url ⇒ Object
readonly
Returns the value of attribute preview_url.
-
#track_number ⇒ Object
readonly
Returns the value of attribute track_number.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Track
constructor
Sets the arguments to its variables.
Constructor Details
#initialize(args = {}) ⇒ Track
Sets the arguments to its variables.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/spotify/models/track.rb', line 18 def initialize(args = {}) args = Hash(args).with_indifferent_access # Arrays artist = Spotify::Models::Simplified::Artist artists = Array(args[:artists]).map { |a| artist.new(a) } # Objects external_urls = Spotify::Models::ExternalURL.new(args[:external_urls]) track_link = Spotify::Models::TrackLink.new(args[:linked_from]) @artists = artists @available_markets = args[:available_markets] @disc_number = args[:disc_number] @duration_ms = args[:duration_ms] @explicit = args[:explicit] @external_urls = external_urls @href = args[:href] @id = args[:id] @is_playable = args[:is_playable] @linked_from = track_link @name = args[:name] @preview_url = args[:preview_url] @track_number = args[:track_number] @type = args[:type] @uri = args[:uri] end |
Instance Attribute Details
#artists ⇒ Object (readonly)
Returns the value of attribute artists.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def artists @artists end |
#available_markets ⇒ Object (readonly)
Returns the value of attribute available_markets.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def available_markets @available_markets end |
#disc_number ⇒ Object (readonly)
Returns the value of attribute disc_number.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def disc_number @disc_number end |
#duration_ms ⇒ Object (readonly)
Returns the value of attribute duration_ms.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def duration_ms @duration_ms end |
#explicit ⇒ Object (readonly)
Returns the value of attribute explicit.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def explicit @explicit end |
#external_urls ⇒ Object (readonly)
Returns the value of attribute external_urls.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def external_urls @external_urls end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def href @href end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def id @id end |
#is_playable ⇒ Object (readonly)
Returns the value of attribute is_playable.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def is_playable @is_playable end |
#linked_from ⇒ Object (readonly)
Returns the value of attribute linked_from.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def linked_from @linked_from end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def name @name end |
#preview_url ⇒ Object (readonly)
Returns the value of attribute preview_url.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def preview_url @preview_url end |
#track_number ⇒ Object (readonly)
Returns the value of attribute track_number.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def track_number @track_number end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def type @type end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
7 8 9 |
# File 'lib/spotify/models/track.rb', line 7 def uri @uri end |