Class: Spotify::Models::User

Inherits:
Object
  • Object
show all
Defined in:
lib/spotify/models/user.rb

Direct Known Subclasses

Full::User, Simplified::User

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ User

Sets the arguments to its variables.

Parameters:

  • args (Hash) (defaults to: {})

    the arguments that will be placed on each variable.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/spotify/models/user.rb', line 17

def initialize(args = {})
  args = Hash(args).with_indifferent_access

  # Array
  images = Array(args[:images]).map { |i| Spotify::Models::Image.new(i) }

  # Objects
  external_urls = Spotify::Models::ExternalURL.new(args[:external_urls])
  follower      = Spotify::Models::Follower.new(args[:followers])

  @display_name  = args[:display_name]
  @external_urls = external_urls
  @followers     = follower
  @href          = args[:href]
  @id            = args[:id]
  @images        = images
  @type          = args[:type]
  @uri           = args[:uri]
end

Instance Attribute Details

#display_nameObject (readonly)

Returns the value of attribute display_name.



7
8
9
# File 'lib/spotify/models/user.rb', line 7

def display_name
  @display_name
end

#external_urlsObject (readonly)

Returns the value of attribute external_urls.



7
8
9
# File 'lib/spotify/models/user.rb', line 7

def external_urls
  @external_urls
end

#followersObject (readonly)

Returns the value of attribute followers.



7
8
9
# File 'lib/spotify/models/user.rb', line 7

def followers
  @followers
end

#hrefObject (readonly)

Returns the value of attribute href.



7
8
9
# File 'lib/spotify/models/user.rb', line 7

def href
  @href
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/spotify/models/user.rb', line 7

def id
  @id
end

#imagesObject (readonly)

Returns the value of attribute images.



7
8
9
# File 'lib/spotify/models/user.rb', line 7

def images
  @images
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/spotify/models/user.rb', line 7

def type
  @type
end

#uriObject (readonly)

Returns the value of attribute uri.



7
8
9
# File 'lib/spotify/models/user.rb', line 7

def uri
  @uri
end