Class: SpotifyWebApi::PlaylistOwnerObject

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

Overview

PlaylistOwnerObject 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, followers = SKIP, href = SKIP, id = SKIP, type = SKIP, uri = SKIP, display_name = SKIP) ⇒ PlaylistOwnerObject

Returns a new instance of PlaylistOwnerObject.



75
76
77
78
79
80
81
82
83
84
# File 'lib/spotify_web_api/models/playlist_owner_object.rb', line 75

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

Instance Attribute Details

#display_nameString

The name displayed on the user’s profile. ‘null` if not available.

Returns:

  • (String)


40
41
42
# File 'lib/spotify_web_api/models/playlist_owner_object.rb', line 40

def display_name
  @display_name
end

#external_urlsExternalUrlObject

Known public external URLs for this user.

Returns:



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

def external_urls
  @external_urls
end

#followersFollowersObject

Information about the followers of this user.

Returns:



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

def followers
  @followers
end

#hrefString

A link to the Web API endpoint for this user.

Returns:

  • (String)


22
23
24
# File 'lib/spotify_web_api/models/playlist_owner_object.rb', line 22

def href
  @href
end

#idString

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

Returns:

  • (String)


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

def id
  @id
end

#typeType4Enum

The object type.

Returns:



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

def type
  @type
end

#uriString

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

Returns:

  • (String)


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

def uri
  @uri
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/spotify_web_api/models/playlist_owner_object.rb', line 87

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']
  followers = FollowersObject.from_hash(hash['followers']) if hash['followers']
  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
  display_name = hash.key?('display_name') ? hash['display_name'] : SKIP

  # Create object from extracted values.
  PlaylistOwnerObject.new(external_urls,
                          followers,
                          href,
                          id,
                          type,
                          uri,
                          display_name)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/spotify_web_api/models/playlist_owner_object.rb', line 43

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

.nullablesObject

An array for nullable fields



69
70
71
72
73
# File 'lib/spotify_web_api/models/playlist_owner_object.rb', line 69

def self.nullables
  %w[
    display_name
  ]
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/spotify_web_api/models/playlist_owner_object.rb', line 56

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