Class: SpotifyWebApi::ShowBase
- Defined in:
- lib/spotify_web_api/models/show_base.rb
Overview
ShowBase Model.
Instance Attribute Summary collapse
-
#available_markets ⇒ Array[String]
A list of the countries in which the show can be played, identified by their [ISO 3166-1 alpha-2](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
-
#copyrights ⇒ Array[CopyrightObject]
The copyright statements of the show.
-
#description ⇒ String
A description of the show.
-
#explicit ⇒ TrueClass | FalseClass
Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown).
-
#external_urls ⇒ ExternalUrlObject
External URLs for this show.
-
#href ⇒ String
A link to the Web API endpoint providing full details of the show.
-
#html_description ⇒ String
A description of the show.
-
#id ⇒ String
The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the show.
-
#images ⇒ Array[ImageObject]
The cover art for the show in various sizes, widest first.
-
#is_externally_hosted ⇒ TrueClass | FalseClass
True if all of the shows episodes are hosted outside of Spotify’s CDN.
-
#languages ⇒ Array[String]
A list of the languages used in the show, identified by their [ISO 639](en.wikipedia.org/wiki/ISO_639) code.
-
#media_type ⇒ String
The media type of the show.
-
#name ⇒ String
The name of the episode.
-
#publisher ⇒ String
The publisher of the show.
-
#total_episodes ⇒ Integer
The total number of episodes in the show.
-
#type ⇒ Type7Enum
The object type.
-
#uri ⇒ String
The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the show.
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(available_markets = nil, copyrights = nil, description = nil, html_description = nil, explicit = nil, external_urls = nil, href = nil, id = nil, images = nil, is_externally_hosted = nil, languages = nil, media_type = nil, name = nil, publisher = nil, type = nil, uri = nil, total_episodes = nil) ⇒ ShowBase
constructor
A new instance of ShowBase.
Methods inherited from BaseModel
Constructor Details
#initialize(available_markets = nil, copyrights = nil, description = nil, html_description = nil, explicit = nil, external_urls = nil, href = nil, id = nil, images = nil, is_externally_hosted = nil, languages = nil, media_type = nil, name = nil, publisher = nil, type = nil, uri = nil, total_episodes = nil) ⇒ ShowBase
Returns a new instance of ShowBase.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/spotify_web_api/models/show_base.rb', line 121 def initialize(available_markets = nil, copyrights = nil, description = nil, html_description = nil, explicit = nil, external_urls = nil, href = nil, id = nil, images = nil, is_externally_hosted = nil, languages = nil, media_type = nil, name = nil, publisher = nil, type = nil, uri = nil, total_episodes = nil) @available_markets = available_markets @copyrights = copyrights @description = description @html_description = html_description @explicit = explicit @external_urls = external_urls @href = href @id = id @images = images @is_externally_hosted = is_externally_hosted @languages = languages @media_type = media_type @name = name @publisher = publisher @type = type @uri = uri @total_episodes = total_episodes end |
Instance Attribute Details
#available_markets ⇒ Array[String]
A list of the countries in which the show can be played, identified by their [ISO 3166-1 alpha-2](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
16 17 18 |
# File 'lib/spotify_web_api/models/show_base.rb', line 16 def available_markets @available_markets end |
#copyrights ⇒ Array[CopyrightObject]
The copyright statements of the show.
20 21 22 |
# File 'lib/spotify_web_api/models/show_base.rb', line 20 def copyrights @copyrights end |
#description ⇒ String
A description of the show. HTML tags are stripped away from this field, use ‘html_description` field in case HTML tags are needed.
25 26 27 |
# File 'lib/spotify_web_api/models/show_base.rb', line 25 def description @description end |
#explicit ⇒ TrueClass | FalseClass
Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown).
34 35 36 |
# File 'lib/spotify_web_api/models/show_base.rb', line 34 def explicit @explicit end |
#external_urls ⇒ ExternalUrlObject
External URLs for this show.
38 39 40 |
# File 'lib/spotify_web_api/models/show_base.rb', line 38 def external_urls @external_urls end |
#href ⇒ String
A link to the Web API endpoint providing full details of the show.
42 43 44 |
# File 'lib/spotify_web_api/models/show_base.rb', line 42 def href @href end |
#html_description ⇒ String
A description of the show. This field may contain HTML tags.
29 30 31 |
# File 'lib/spotify_web_api/models/show_base.rb', line 29 def html_description @html_description end |
#id ⇒ String
The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the show.
47 48 49 |
# File 'lib/spotify_web_api/models/show_base.rb', line 47 def id @id end |
#images ⇒ Array[ImageObject]
The cover art for the show in various sizes, widest first.
51 52 53 |
# File 'lib/spotify_web_api/models/show_base.rb', line 51 def images @images end |
#is_externally_hosted ⇒ TrueClass | FalseClass
True if all of the shows episodes are hosted outside of Spotify’s CDN. This field might be ‘null` in some cases.
56 57 58 |
# File 'lib/spotify_web_api/models/show_base.rb', line 56 def is_externally_hosted @is_externally_hosted end |
#languages ⇒ Array[String]
A list of the languages used in the show, identified by their [ISO 639](en.wikipedia.org/wiki/ISO_639) code.
61 62 63 |
# File 'lib/spotify_web_api/models/show_base.rb', line 61 def languages @languages end |
#media_type ⇒ String
The media type of the show.
65 66 67 |
# File 'lib/spotify_web_api/models/show_base.rb', line 65 def media_type @media_type end |
#name ⇒ String
The name of the episode.
69 70 71 |
# File 'lib/spotify_web_api/models/show_base.rb', line 69 def name @name end |
#publisher ⇒ String
The publisher of the show.
73 74 75 |
# File 'lib/spotify_web_api/models/show_base.rb', line 73 def publisher @publisher end |
#total_episodes ⇒ Integer
The total number of episodes in the show.
86 87 88 |
# File 'lib/spotify_web_api/models/show_base.rb', line 86 def total_episodes @total_episodes end |
#type ⇒ Type7Enum
The object type.
77 78 79 |
# File 'lib/spotify_web_api/models/show_base.rb', line 77 def type @type end |
#uri ⇒ String
The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the show.
82 83 84 |
# File 'lib/spotify_web_api/models/show_base.rb', line 82 def uri @uri end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 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 |
# File 'lib/spotify_web_api/models/show_base.rb', line 147 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. 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') is_externally_hosted = hash.key?('is_externally_hosted') ? hash['is_externally_hosted'] : nil languages = hash.key?('languages') ? hash['languages'] : nil media_type = hash.key?('media_type') ? hash['media_type'] : nil name = hash.key?('name') ? hash['name'] : nil publisher = hash.key?('publisher') ? hash['publisher'] : nil type = hash.key?('type') ? hash['type'] : nil uri = hash.key?('uri') ? hash['uri'] : nil total_episodes = hash.key?('total_episodes') ? hash['total_episodes'] : nil # Create object from extracted values. ShowBase.new(available_markets, copyrights, description, html_description, explicit, external_urls, href, id, images, is_externally_hosted, languages, media_type, name, publisher, type, uri, total_episodes) end |
.names ⇒ Object
A mapping from model property names to API property names.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/spotify_web_api/models/show_base.rb', line 89 def self.names @_hash = {} if @_hash.nil? @_hash['available_markets'] = 'available_markets' @_hash['copyrights'] = 'copyrights' @_hash['description'] = 'description' @_hash['html_description'] = 'html_description' @_hash['explicit'] = 'explicit' @_hash['external_urls'] = 'external_urls' @_hash['href'] = 'href' @_hash['id'] = 'id' @_hash['images'] = 'images' @_hash['is_externally_hosted'] = 'is_externally_hosted' @_hash['languages'] = 'languages' @_hash['media_type'] = 'media_type' @_hash['name'] = 'name' @_hash['publisher'] = 'publisher' @_hash['type'] = 'type' @_hash['uri'] = 'uri' @_hash['total_episodes'] = 'total_episodes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
117 118 119 |
# File 'lib/spotify_web_api/models/show_base.rb', line 117 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
112 113 114 |
# File 'lib/spotify_web_api/models/show_base.rb', line 112 def self.optionals [] end |