Class: SpotifyWebApi::ShowBase

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

Overview

ShowBase Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_marketsArray[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.

Returns:

  • (Array[String])


16
17
18
# File 'lib/spotify_web_api/models/show_base.rb', line 16

def available_markets
  @available_markets
end

#copyrightsArray[CopyrightObject]

The copyright statements of the show.

Returns:



20
21
22
# File 'lib/spotify_web_api/models/show_base.rb', line 20

def copyrights
  @copyrights
end

#descriptionString

A description of the show. HTML tags are stripped away from this field, use ‘html_description` field in case HTML tags are needed.

Returns:

  • (String)


25
26
27
# File 'lib/spotify_web_api/models/show_base.rb', line 25

def description
  @description
end

#explicitTrueClass | FalseClass

Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown).

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/spotify_web_api/models/show_base.rb', line 34

def explicit
  @explicit
end

#external_urlsExternalUrlObject

External URLs for this show.

Returns:



38
39
40
# File 'lib/spotify_web_api/models/show_base.rb', line 38

def external_urls
  @external_urls
end

#hrefString

A link to the Web API endpoint providing full details of the show.

Returns:

  • (String)


42
43
44
# File 'lib/spotify_web_api/models/show_base.rb', line 42

def href
  @href
end

#html_descriptionString

A description of the show. This field may contain HTML tags.

Returns:

  • (String)


29
30
31
# File 'lib/spotify_web_api/models/show_base.rb', line 29

def html_description
  @html_description
end

#idString

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

Returns:

  • (String)


47
48
49
# File 'lib/spotify_web_api/models/show_base.rb', line 47

def id
  @id
end

#imagesArray[ImageObject]

The cover art for the show in various sizes, widest first.

Returns:



51
52
53
# File 'lib/spotify_web_api/models/show_base.rb', line 51

def images
  @images
end

#is_externally_hostedTrueClass | FalseClass

True if all of the shows episodes are hosted outside of Spotify’s CDN. This field might be ‘null` in some cases.

Returns:

  • (TrueClass | FalseClass)


56
57
58
# File 'lib/spotify_web_api/models/show_base.rb', line 56

def is_externally_hosted
  @is_externally_hosted
end

#languagesArray[String]

A list of the languages used in the show, identified by their [ISO 639](en.wikipedia.org/wiki/ISO_639) code.

Returns:

  • (Array[String])


61
62
63
# File 'lib/spotify_web_api/models/show_base.rb', line 61

def languages
  @languages
end

#media_typeString

The media type of the show.

Returns:

  • (String)


65
66
67
# File 'lib/spotify_web_api/models/show_base.rb', line 65

def media_type
  @media_type
end

#nameString

The name of the episode.

Returns:

  • (String)


69
70
71
# File 'lib/spotify_web_api/models/show_base.rb', line 69

def name
  @name
end

#publisherString

The publisher of the show.

Returns:

  • (String)


73
74
75
# File 'lib/spotify_web_api/models/show_base.rb', line 73

def publisher
  @publisher
end

#total_episodesInteger

The total number of episodes in the show.

Returns:

  • (Integer)


86
87
88
# File 'lib/spotify_web_api/models/show_base.rb', line 86

def total_episodes
  @total_episodes
end

#typeType7Enum

The object type.

Returns:



77
78
79
# File 'lib/spotify_web_api/models/show_base.rb', line 77

def type
  @type
end

#uriString

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

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

An array for nullable fields



117
118
119
# File 'lib/spotify_web_api/models/show_base.rb', line 117

def self.nullables
  []
end

.optionalsObject

An array for optional fields



112
113
114
# File 'lib/spotify_web_api/models/show_base.rb', line 112

def self.optionals
  []
end