Class: SpotifyWebApi::AudiobookObject
- Defined in:
- lib/spotify_web_api/models/audiobook_object.rb
Overview
AudiobookObject Model.
Instance Attribute Summary collapse
-
#authors ⇒ Array[AuthorObject]
The author(s) for the audiobook.
-
#available_markets ⇒ Array[String]
A list of the countries in which the audiobook can be played, identified by their [ISO 3166-1 alpha-2](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
-
#chapters ⇒ PagingSimplifiedChapterObject
The chapters of the audiobook.
-
#copyrights ⇒ Array[CopyrightObject]
The copyright statements of the audiobook.
-
#description ⇒ String
A description of the audiobook.
-
#edition ⇒ String
The edition of the audiobook.
-
#explicit ⇒ TrueClass | FalseClass
Whether or not the audiobook has explicit content (true = yes it does; false = no it does not OR unknown).
-
#external_urls ⇒ ExternalUrlObject
External URLs for this audiobook.
-
#href ⇒ String
A link to the Web API endpoint providing full details of the audiobook.
-
#html_description ⇒ String
A description of the audiobook.
-
#id ⇒ String
The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the audiobook.
-
#images ⇒ Array[ImageObject]
The cover art for the audiobook in various sizes, widest first.
-
#languages ⇒ Array[String]
A list of the languages used in the audiobook, identified by their [ISO 639](en.wikipedia.org/wiki/ISO_639) code.
-
#media_type ⇒ String
The media type of the audiobook.
-
#name ⇒ String
The name of the audiobook.
-
#narrators ⇒ Array[NarratorObject]
The narrator(s) for the audiobook.
-
#publisher ⇒ String
The publisher of the audiobook.
-
#total_chapters ⇒ Integer
The number of chapters in this audiobook.
-
#type ⇒ Type9Enum
The object type.
-
#uri ⇒ String
The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the audiobook.
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(authors = nil, available_markets = nil, copyrights = nil, description = nil, html_description = nil, explicit = nil, external_urls = nil, href = nil, id = nil, images = nil, languages = nil, media_type = nil, name = nil, narrators = nil, publisher = nil, type = nil, uri = nil, total_chapters = nil, chapters = nil, edition = SKIP) ⇒ AudiobookObject
constructor
A new instance of AudiobookObject.
Methods inherited from BaseModel
Constructor Details
#initialize(authors = nil, available_markets = nil, copyrights = nil, description = nil, html_description = nil, explicit = nil, external_urls = nil, href = nil, id = nil, images = nil, languages = nil, media_type = nil, name = nil, narrators = nil, publisher = nil, type = nil, uri = nil, total_chapters = nil, chapters = nil, edition = SKIP) ⇒ AudiobookObject
Returns a new instance of AudiobookObject.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 137 def initialize( = nil, available_markets = nil, copyrights = nil, description = nil, html_description = nil, explicit = nil, external_urls = nil, href = nil, id = nil, images = nil, languages = nil, media_type = nil, name = nil, narrators = nil, publisher = nil, type = nil, uri = nil, total_chapters = nil, chapters = nil, edition = SKIP) @authors = @available_markets = available_markets @copyrights = copyrights @description = description @html_description = html_description @edition = edition unless edition == SKIP @explicit = explicit @external_urls = external_urls @href = href @id = id @images = images @languages = languages @media_type = media_type @name = name @narrators = narrators @publisher = publisher @type = type @uri = uri @total_chapters = total_chapters @chapters = chapters end |
Instance Attribute Details
#authors ⇒ Array[AuthorObject]
The author(s) for the audiobook.
14 15 16 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 14 def @authors end |
#available_markets ⇒ Array[String]
A list of the countries in which the audiobook can be played, identified by their [ISO 3166-1 alpha-2](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
20 21 22 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 20 def available_markets @available_markets end |
#chapters ⇒ PagingSimplifiedChapterObject
The chapters of the audiobook.
97 98 99 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 97 def chapters @chapters end |
#copyrights ⇒ Array[CopyrightObject]
The copyright statements of the audiobook.
24 25 26 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 24 def copyrights @copyrights end |
#description ⇒ String
A description of the audiobook. HTML tags are stripped away from this field, use ‘html_description` field in case HTML tags are needed.
29 30 31 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 29 def description @description end |
#edition ⇒ String
The edition of the audiobook.
37 38 39 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 37 def edition @edition end |
#explicit ⇒ TrueClass | FalseClass
Whether or not the audiobook has explicit content (true = yes it does; false = no it does not OR unknown).
42 43 44 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 42 def explicit @explicit end |
#external_urls ⇒ ExternalUrlObject
External URLs for this audiobook.
46 47 48 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 46 def external_urls @external_urls end |
#href ⇒ String
A link to the Web API endpoint providing full details of the audiobook.
50 51 52 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 50 def href @href end |
#html_description ⇒ String
A description of the audiobook. This field may contain HTML tags.
33 34 35 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 33 def html_description @html_description end |
#id ⇒ String
The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the audiobook.
55 56 57 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 55 def id @id end |
#images ⇒ Array[ImageObject]
The cover art for the audiobook in various sizes, widest first.
59 60 61 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 59 def images @images end |
#languages ⇒ Array[String]
A list of the languages used in the audiobook, identified by their [ISO 639](en.wikipedia.org/wiki/ISO_639) code.
64 65 66 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 64 def languages @languages end |
#media_type ⇒ String
The media type of the audiobook.
68 69 70 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 68 def media_type @media_type end |
#name ⇒ String
The name of the audiobook.
72 73 74 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 72 def name @name end |
#narrators ⇒ Array[NarratorObject]
The narrator(s) for the audiobook.
76 77 78 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 76 def narrators @narrators end |
#publisher ⇒ String
The publisher of the audiobook.
80 81 82 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 80 def publisher @publisher end |
#total_chapters ⇒ Integer
The number of chapters in this audiobook.
93 94 95 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 93 def total_chapters @total_chapters end |
#type ⇒ Type9Enum
The object type.
84 85 86 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 84 def type @type end |
#uri ⇒ String
The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the audiobook.
89 90 91 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 89 def uri @uri end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 166 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it = nil unless hash['authors'].nil? = [] hash['authors'].each do |structure| << (AuthorObject.from_hash(structure) if structure) end end = nil unless hash.key?('authors') available_markets = hash.key?('available_markets') ? hash['available_markets'] : nil # Parameter is an array, so we need to iterate through it copyrights = nil unless hash['copyrights'].nil? copyrights = [] hash['copyrights'].each do |structure| copyrights << (CopyrightObject.from_hash(structure) if structure) end end copyrights = nil unless hash.key?('copyrights') description = hash.key?('description') ? hash['description'] : nil html_description = hash.key?('html_description') ? hash['html_description'] : nil explicit = hash.key?('explicit') ? hash['explicit'] : nil external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls'] href = hash.key?('href') ? hash['href'] : nil id = hash.key?('id') ? hash['id'] : nil # Parameter is an array, so we need to iterate through it images = nil unless hash['images'].nil? images = [] hash['images'].each do |structure| images << (ImageObject.from_hash(structure) if structure) end end images = nil unless hash.key?('images') languages = hash.key?('languages') ? hash['languages'] : nil media_type = hash.key?('media_type') ? hash['media_type'] : nil name = hash.key?('name') ? hash['name'] : nil # Parameter is an array, so we need to iterate through it narrators = nil unless hash['narrators'].nil? narrators = [] hash['narrators'].each do |structure| narrators << (NarratorObject.from_hash(structure) if structure) end end narrators = nil unless hash.key?('narrators') publisher = hash.key?('publisher') ? hash['publisher'] : nil type = hash.key?('type') ? hash['type'] : nil uri = hash.key?('uri') ? hash['uri'] : nil total_chapters = hash.key?('total_chapters') ? hash['total_chapters'] : nil chapters = PagingSimplifiedChapterObject.from_hash(hash['chapters']) if hash['chapters'] edition = hash.key?('edition') ? hash['edition'] : SKIP # Create object from extracted values. AudiobookObject.new(, available_markets, copyrights, description, html_description, explicit, external_urls, href, id, images, languages, media_type, name, narrators, publisher, type, uri, total_chapters, chapters, edition) end |
.names ⇒ Object
A mapping from model property names to API property names.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 100 def self.names @_hash = {} if @_hash.nil? @_hash['authors'] = 'authors' @_hash['available_markets'] = 'available_markets' @_hash['copyrights'] = 'copyrights' @_hash['description'] = 'description' @_hash['html_description'] = 'html_description' @_hash['edition'] = 'edition' @_hash['explicit'] = 'explicit' @_hash['external_urls'] = 'external_urls' @_hash['href'] = 'href' @_hash['id'] = 'id' @_hash['images'] = 'images' @_hash['languages'] = 'languages' @_hash['media_type'] = 'media_type' @_hash['name'] = 'name' @_hash['narrators'] = 'narrators' @_hash['publisher'] = 'publisher' @_hash['type'] = 'type' @_hash['uri'] = 'uri' @_hash['total_chapters'] = 'total_chapters' @_hash['chapters'] = 'chapters' @_hash end |
.nullables ⇒ Object
An array for nullable fields
133 134 135 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 133 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
126 127 128 129 130 |
# File 'lib/spotify_web_api/models/audiobook_object.rb', line 126 def self.optionals %w[ edition ] end |