Class: SpotifyWebApi::LinkedTrackObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::LinkedTrackObject
- Defined in:
- lib/spotify_web_api/models/linked_track_object.rb
Overview
LinkedTrackObject Model.
Instance Attribute Summary collapse
-
#external_urls ⇒ ExternalUrlObject
Known external URLs for this track.
-
#href ⇒ String
A link to the Web API endpoint providing full details of the track.
-
#id ⇒ String
The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the track.
-
#type ⇒ String
The object type: “track”.
-
#uri ⇒ String
The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the track.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(external_urls = SKIP, href = SKIP, id = SKIP, type = SKIP, uri = SKIP) ⇒ LinkedTrackObject
constructor
A new instance of LinkedTrackObject.
Methods inherited from BaseModel
Constructor Details
#initialize(external_urls = SKIP, href = SKIP, id = SKIP, type = SKIP, uri = SKIP) ⇒ LinkedTrackObject
Returns a new instance of LinkedTrackObject.
61 62 63 64 65 66 67 68 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 61 def initialize(external_urls = SKIP, href = SKIP, id = SKIP, type = SKIP, uri = SKIP) @external_urls = external_urls unless external_urls == SKIP @href = href unless href == SKIP @id = id unless id == SKIP @type = type unless type == SKIP @uri = uri unless uri == SKIP end |
Instance Attribute Details
#external_urls ⇒ ExternalUrlObject
Known external URLs for this track.
14 15 16 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 14 def external_urls @external_urls end |
#href ⇒ String
A link to the Web API endpoint providing full details of the track.
18 19 20 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 18 def href @href end |
#id ⇒ String
The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the track.
23 24 25 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 23 def id @id end |
#type ⇒ String
The object type: “track”.
27 28 29 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 27 def type @type end |
#uri ⇒ String
The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the track.
32 33 34 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 32 def uri @uri end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls'] href = hash.key?('href') ? hash['href'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP type = hash.key?('type') ? hash['type'] : SKIP uri = hash.key?('uri') ? hash['uri'] : SKIP # Create object from extracted values. LinkedTrackObject.new(external_urls, href, id, type, uri) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['external_urls'] = 'external_urls' @_hash['href'] = 'href' @_hash['id'] = 'id' @_hash['type'] = 'type' @_hash['uri'] = 'uri' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 57 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 53 54 |
# File 'lib/spotify_web_api/models/linked_track_object.rb', line 46 def self.optionals %w[ external_urls href id type uri ] end |