Class: AppleMusic::Album::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/apple_music/album/attributes.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(props = {}) ⇒ Attributes

Returns a new instance of Attributes.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/apple_music/album/attributes.rb', line 12

def initialize(props = {})
  @album_name = props['albumName'] # required
  @artist_name = props['artistName'] # required
  @artwork = Artwork.new(props['artwork']) if props['artwork']
  @content_rating = props['contentRating']
  @copyright = props['copyright']
  @editorial_notes = EditorialNotes.new(props['editorialNotes']) if props['editorialNotes']
  @genre_names = props['genreNames'] # required
  @is_complete = props['isComplete'] # required
  @is_single = props['isSingle'] # required
  @name = props['name'] # required
  @play_params = PlayParameters.new(props['playParams']) if props['playParams']
  @record_label = props['recordLabel'] # required
  @release_date = begin # required
                    Date.parse(props['releaseDate'])
                  rescue ArgumentError
                    Date.parse("#{props['releaseDate']}/01/01")
                  end
  @track_count = props['trackCount'] # required
  @url = props['url'] # required
  @is_mastered_for_itunes = props['isMasteredForItunes'] # required
  @upc = props['upc']
end

Instance Attribute Details

#album_nameObject (readonly)

Returns the value of attribute album_name.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def album_name
  @album_name
end

#artist_nameObject (readonly)

Returns the value of attribute artist_name.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def artist_name
  @artist_name
end

#artworkObject (readonly)

Returns the value of attribute artwork.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def artwork
  @artwork
end

#content_ratingObject (readonly)

Returns the value of attribute content_rating.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def content_rating
  @content_rating
end

Returns the value of attribute copyright.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def copyright
  @copyright
end

#editorial_notesObject (readonly)

Returns the value of attribute editorial_notes.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def editorial_notes
  @editorial_notes
end

#genre_namesObject (readonly)

Returns the value of attribute genre_names.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def genre_names
  @genre_names
end

#is_completeObject (readonly)

Returns the value of attribute is_complete.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def is_complete
  @is_complete
end

#is_mastered_for_itunesObject (readonly)

Returns the value of attribute is_mastered_for_itunes.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def is_mastered_for_itunes
  @is_mastered_for_itunes
end

#is_singleObject (readonly)

Returns the value of attribute is_single.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def is_single
  @is_single
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def name
  @name
end

#play_paramsObject (readonly)

Returns the value of attribute play_params.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def play_params
  @play_params
end

#record_labelObject (readonly)

Returns the value of attribute record_label.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def record_label
  @record_label
end

#release_dateObject (readonly)

Returns the value of attribute release_date.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def release_date
  @release_date
end

#track_countObject (readonly)

Returns the value of attribute track_count.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def track_count
  @track_count
end

#upcObject (readonly)

Returns the value of attribute upc.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def upc
  @upc
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/apple_music/album/attributes.rb', line 7

def url
  @url
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/apple_music/album/attributes.rb', line 36

def complete?
  is_complete
end

#mastered_for_itunes?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/apple_music/album/attributes.rb', line 44

def mastered_for_itunes?
  is_mastered_for_itunes
end

#single?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/apple_music/album/attributes.rb', line 40

def single?
  is_single
end