Class: SpotifyWebApi::SimplifiedArtistObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/spotify_web_api/models/simplified_artist_object.rb

Overview

SimplifiedArtistObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(external_urls = SKIP, href = SKIP, id = SKIP, name = SKIP, type = SKIP, uri = SKIP) ⇒ SimplifiedArtistObject

Returns a new instance of SimplifiedArtistObject.



67
68
69
70
71
72
73
74
75
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 67

def initialize(external_urls = SKIP, href = SKIP, id = SKIP, name = SKIP,
               type = SKIP, uri = SKIP)
  @external_urls = external_urls unless external_urls == SKIP
  @href = href unless href == SKIP
  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @type = type unless type == SKIP
  @uri = uri unless uri == SKIP
end

Instance Attribute Details

#external_urlsExternalUrlObject

Known external URLs for this artist.

Returns:



14
15
16
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 14

def external_urls
  @external_urls
end

#hrefString

A link to the Web API endpoint providing full details of the artist.

Returns:

  • (String)


18
19
20
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 18

def href
  @href
end

#idString

The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the artist.

Returns:

  • (String)


23
24
25
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 23

def id
  @id
end

#nameString

The name of the artist.

Returns:

  • (String)


27
28
29
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 27

def name
  @name
end

#typeTypeEnum

The object type.

Returns:



31
32
33
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 31

def type
  @type
end

#uriString

The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the artist.

Returns:

  • (String)


36
37
38
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 36

def uri
  @uri
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 78

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
  name = hash.key?('name') ? hash['name'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  uri = hash.key?('uri') ? hash['uri'] : SKIP

  # Create object from extracted values.
  SimplifiedArtistObject.new(external_urls,
                             href,
                             id,
                             name,
                             type,
                             uri)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['external_urls'] = 'external_urls'
  @_hash['href'] = 'href'
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['type'] = 'type'
  @_hash['uri'] = 'uri'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
60
# File 'lib/spotify_web_api/models/simplified_artist_object.rb', line 51

def self.optionals
  %w[
    external_urls
    href
    id
    name
    type
    uri
  ]
end