spotify-apimatic-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +30 -0
  3. data/README.md +170 -0
  4. data/bin/console +15 -0
  5. data/lib/spotify_web_api/api_helper.rb +10 -0
  6. data/lib/spotify_web_api/client.rb +165 -0
  7. data/lib/spotify_web_api/configuration.rb +244 -0
  8. data/lib/spotify_web_api/controllers/albums_controller.rb +297 -0
  9. data/lib/spotify_web_api/controllers/artists_controller.rb +188 -0
  10. data/lib/spotify_web_api/controllers/audiobooks_controller.rb +258 -0
  11. data/lib/spotify_web_api/controllers/base_controller.rb +60 -0
  12. data/lib/spotify_web_api/controllers/categories_controller.rb +84 -0
  13. data/lib/spotify_web_api/controllers/chapters_controller.rb +82 -0
  14. data/lib/spotify_web_api/controllers/episodes_controller.rb +241 -0
  15. data/lib/spotify_web_api/controllers/genres_controller.rb +39 -0
  16. data/lib/spotify_web_api/controllers/markets_controller.rb +38 -0
  17. data/lib/spotify_web_api/controllers/o_auth_authorization_controller.rb +82 -0
  18. data/lib/spotify_web_api/controllers/player_controller.rb +525 -0
  19. data/lib/spotify_web_api/controllers/playlists_controller.rb +538 -0
  20. data/lib/spotify_web_api/controllers/search_controller.rb +61 -0
  21. data/lib/spotify_web_api/controllers/shows_controller.rb +263 -0
  22. data/lib/spotify_web_api/controllers/tracks_controller.rb +534 -0
  23. data/lib/spotify_web_api/controllers/users_controller.rb +402 -0
  24. data/lib/spotify_web_api/exceptions/api_exception.rb +21 -0
  25. data/lib/spotify_web_api/exceptions/bad_request_exception.rb +46 -0
  26. data/lib/spotify_web_api/exceptions/forbidden_exception.rb +46 -0
  27. data/lib/spotify_web_api/exceptions/not_found_exception.rb +46 -0
  28. data/lib/spotify_web_api/exceptions/o_auth_provider_exception.rb +64 -0
  29. data/lib/spotify_web_api/exceptions/too_many_requests_exception.rb +46 -0
  30. data/lib/spotify_web_api/exceptions/unauthorized_exception.rb +46 -0
  31. data/lib/spotify_web_api/http/api_response.rb +19 -0
  32. data/lib/spotify_web_api/http/auth/o_auth2.rb +164 -0
  33. data/lib/spotify_web_api/http/http_call_back.rb +10 -0
  34. data/lib/spotify_web_api/http/http_method_enum.rb +10 -0
  35. data/lib/spotify_web_api/http/http_request.rb +10 -0
  36. data/lib/spotify_web_api/http/http_response.rb +10 -0
  37. data/lib/spotify_web_api/http/proxy_settings.rb +22 -0
  38. data/lib/spotify_web_api/models/album_base.rb +189 -0
  39. data/lib/spotify_web_api/models/album_group_enum.rb +44 -0
  40. data/lib/spotify_web_api/models/album_object.rb +273 -0
  41. data/lib/spotify_web_api/models/album_restriction_object.rb +75 -0
  42. data/lib/spotify_web_api/models/album_type_enum.rb +40 -0
  43. data/lib/spotify_web_api/models/artist_discography_album_object.rb +216 -0
  44. data/lib/spotify_web_api/models/artist_object.rb +174 -0
  45. data/lib/spotify_web_api/models/audio_analysis_object.rb +171 -0
  46. data/lib/spotify_web_api/models/audio_features_object.rb +273 -0
  47. data/lib/spotify_web_api/models/audiobook_base.rb +270 -0
  48. data/lib/spotify_web_api/models/audiobook_object.rb +278 -0
  49. data/lib/spotify_web_api/models/author_object.rb +62 -0
  50. data/lib/spotify_web_api/models/base_model.rb +110 -0
  51. data/lib/spotify_web_api/models/categories.rb +125 -0
  52. data/lib/spotify_web_api/models/category_object.rb +95 -0
  53. data/lib/spotify_web_api/models/chapter_base.rb +265 -0
  54. data/lib/spotify_web_api/models/chapter_object.rb +273 -0
  55. data/lib/spotify_web_api/models/chapter_restriction_object.rb +71 -0
  56. data/lib/spotify_web_api/models/context_object.rb +102 -0
  57. data/lib/spotify_web_api/models/copyright_object.rb +82 -0
  58. data/lib/spotify_web_api/models/currently_playing_context_object.rb +168 -0
  59. data/lib/spotify_web_api/models/currently_playing_object.rb +138 -0
  60. data/lib/spotify_web_api/models/cursor_object.rb +71 -0
  61. data/lib/spotify_web_api/models/cursor_paged_artists.rb +60 -0
  62. data/lib/spotify_web_api/models/cursor_paging_object.rb +102 -0
  63. data/lib/spotify_web_api/models/cursor_paging_play_history_object.rb +120 -0
  64. data/lib/spotify_web_api/models/cursor_paging_simplified_artist_object.rb +120 -0
  65. data/lib/spotify_web_api/models/device_object.rb +153 -0
  66. data/lib/spotify_web_api/models/disallows_object.rb +171 -0
  67. data/lib/spotify_web_api/models/episode_base.rb +263 -0
  68. data/lib/spotify_web_api/models/episode_object.rb +368 -0
  69. data/lib/spotify_web_api/models/episode_restriction_object.rb +80 -0
  70. data/lib/spotify_web_api/models/error_object.rb +71 -0
  71. data/lib/spotify_web_api/models/explicit_content_settings_object.rb +74 -0
  72. data/lib/spotify_web_api/models/external_id_object.rb +94 -0
  73. data/lib/spotify_web_api/models/external_url_object.rb +73 -0
  74. data/lib/spotify_web_api/models/followers_object.rb +84 -0
  75. data/lib/spotify_web_api/models/image_object.rb +106 -0
  76. data/lib/spotify_web_api/models/include_external_enum.rb +29 -0
  77. data/lib/spotify_web_api/models/item_type1_enum.rb +26 -0
  78. data/lib/spotify_web_api/models/item_type2_enum.rb +36 -0
  79. data/lib/spotify_web_api/models/item_type3_enum.rb +36 -0
  80. data/lib/spotify_web_api/models/item_type_enum.rb +56 -0
  81. data/lib/spotify_web_api/models/linked_track_object.rb +113 -0
  82. data/lib/spotify_web_api/models/many_albums.rb +69 -0
  83. data/lib/spotify_web_api/models/many_artists.rb +69 -0
  84. data/lib/spotify_web_api/models/many_audio_features.rb +69 -0
  85. data/lib/spotify_web_api/models/many_audiobooks.rb +69 -0
  86. data/lib/spotify_web_api/models/many_chapters.rb +69 -0
  87. data/lib/spotify_web_api/models/many_devices.rb +69 -0
  88. data/lib/spotify_web_api/models/many_episodes.rb +69 -0
  89. data/lib/spotify_web_api/models/many_genres.rb +60 -0
  90. data/lib/spotify_web_api/models/many_simplified_shows.rb +69 -0
  91. data/lib/spotify_web_api/models/many_tracks.rb +69 -0
  92. data/lib/spotify_web_api/models/markets.rb +62 -0
  93. data/lib/spotify_web_api/models/me_albums_request.rb +67 -0
  94. data/lib/spotify_web_api/models/me_episodes_request.rb +64 -0
  95. data/lib/spotify_web_api/models/me_episodes_request1.rb +66 -0
  96. data/lib/spotify_web_api/models/me_following_request.rb +65 -0
  97. data/lib/spotify_web_api/models/me_following_request1.rb +67 -0
  98. data/lib/spotify_web_api/models/me_player_play_request.rb +103 -0
  99. data/lib/spotify_web_api/models/me_player_request.rb +75 -0
  100. data/lib/spotify_web_api/models/me_shows_request.rb +67 -0
  101. data/lib/spotify_web_api/models/me_tracks_request.rb +65 -0
  102. data/lib/spotify_web_api/models/me_tracks_request1.rb +67 -0
  103. data/lib/spotify_web_api/models/meta.rb +127 -0
  104. data/lib/spotify_web_api/models/mode_enum.rb +50 -0
  105. data/lib/spotify_web_api/models/narrator_object.rb +62 -0
  106. data/lib/spotify_web_api/models/o_auth_provider_error_enum.rb +62 -0
  107. data/lib/spotify_web_api/models/o_auth_scope_enum.rb +124 -0
  108. data/lib/spotify_web_api/models/o_auth_token.rb +96 -0
  109. data/lib/spotify_web_api/models/paged_albums.rb +60 -0
  110. data/lib/spotify_web_api/models/paged_categories.rb +60 -0
  111. data/lib/spotify_web_api/models/paging_artist_discography_album_object.rb +125 -0
  112. data/lib/spotify_web_api/models/paging_artist_object.rb +125 -0
  113. data/lib/spotify_web_api/models/paging_featured_playlist_object.rb +71 -0
  114. data/lib/spotify_web_api/models/paging_object.rb +107 -0
  115. data/lib/spotify_web_api/models/paging_playlist_object.rb +125 -0
  116. data/lib/spotify_web_api/models/paging_playlist_track_object.rb +125 -0
  117. data/lib/spotify_web_api/models/paging_saved_album_object.rb +125 -0
  118. data/lib/spotify_web_api/models/paging_saved_audiobook_object.rb +125 -0
  119. data/lib/spotify_web_api/models/paging_saved_episode_object.rb +125 -0
  120. data/lib/spotify_web_api/models/paging_saved_show_object.rb +125 -0
  121. data/lib/spotify_web_api/models/paging_saved_track_object.rb +125 -0
  122. data/lib/spotify_web_api/models/paging_simplified_album_object.rb +125 -0
  123. data/lib/spotify_web_api/models/paging_simplified_audiobook_object.rb +125 -0
  124. data/lib/spotify_web_api/models/paging_simplified_chapter_object.rb +125 -0
  125. data/lib/spotify_web_api/models/paging_simplified_episode_object.rb +125 -0
  126. data/lib/spotify_web_api/models/paging_simplified_show_object.rb +125 -0
  127. data/lib/spotify_web_api/models/paging_simplified_track_object.rb +125 -0
  128. data/lib/spotify_web_api/models/paging_track_object.rb +125 -0
  129. data/lib/spotify_web_api/models/play_history_object.rb +90 -0
  130. data/lib/spotify_web_api/models/playlist_object.rb +213 -0
  131. data/lib/spotify_web_api/models/playlist_owner_object.rb +124 -0
  132. data/lib/spotify_web_api/models/playlist_snapshot_id.rb +62 -0
  133. data/lib/spotify_web_api/models/playlist_track_object.rb +116 -0
  134. data/lib/spotify_web_api/models/playlist_tracks_ref_object.rb +72 -0
  135. data/lib/spotify_web_api/models/playlist_user_object.rb +122 -0
  136. data/lib/spotify_web_api/models/playlists_followers_request.rb +63 -0
  137. data/lib/spotify_web_api/models/playlists_request.rb +96 -0
  138. data/lib/spotify_web_api/models/playlists_tracks_request.rb +84 -0
  139. data/lib/spotify_web_api/models/playlists_tracks_request1.rb +112 -0
  140. data/lib/spotify_web_api/models/playlists_tracks_request2.rb +87 -0
  141. data/lib/spotify_web_api/models/private_user_object.rb +200 -0
  142. data/lib/spotify_web_api/models/public_user_object.rb +144 -0
  143. data/lib/spotify_web_api/models/queue_object.rb +86 -0
  144. data/lib/spotify_web_api/models/reason_enum.rb +43 -0
  145. data/lib/spotify_web_api/models/recommendation_seed_object.rb +120 -0
  146. data/lib/spotify_web_api/models/recommendations_object.rb +86 -0
  147. data/lib/spotify_web_api/models/release_date_precision_enum.rb +40 -0
  148. data/lib/spotify_web_api/models/resume_point_object.rb +84 -0
  149. data/lib/spotify_web_api/models/saved_album_object.rb +85 -0
  150. data/lib/spotify_web_api/models/saved_audiobook_object.rb +85 -0
  151. data/lib/spotify_web_api/models/saved_episode_object.rb +82 -0
  152. data/lib/spotify_web_api/models/saved_show_object.rb +85 -0
  153. data/lib/spotify_web_api/models/saved_track_object.rb +85 -0
  154. data/lib/spotify_web_api/models/search_items.rb +122 -0
  155. data/lib/spotify_web_api/models/section_object.rb +201 -0
  156. data/lib/spotify_web_api/models/segment_object.rb +184 -0
  157. data/lib/spotify_web_api/models/show_base.rb +327 -0
  158. data/lib/spotify_web_api/models/show_object.rb +243 -0
  159. data/lib/spotify_web_api/models/simplified_album_object.rb +284 -0
  160. data/lib/spotify_web_api/models/simplified_artist_object.rb +122 -0
  161. data/lib/spotify_web_api/models/simplified_playlist_object.rb +203 -0
  162. data/lib/spotify_web_api/models/simplified_track_object.rb +251 -0
  163. data/lib/spotify_web_api/models/time_interval_object.rb +81 -0
  164. data/lib/spotify_web_api/models/track.rb +367 -0
  165. data/lib/spotify_web_api/models/track1.rb +62 -0
  166. data/lib/spotify_web_api/models/track_object.rb +301 -0
  167. data/lib/spotify_web_api/models/track_restriction_object.rb +80 -0
  168. data/lib/spotify_web_api/models/type2_enum.rb +26 -0
  169. data/lib/spotify_web_api/models/type3_enum.rb +26 -0
  170. data/lib/spotify_web_api/models/type4_enum.rb +26 -0
  171. data/lib/spotify_web_api/models/type5_enum.rb +26 -0
  172. data/lib/spotify_web_api/models/type6_enum.rb +26 -0
  173. data/lib/spotify_web_api/models/type8_enum.rb +26 -0
  174. data/lib/spotify_web_api/models/type9_enum.rb +26 -0
  175. data/lib/spotify_web_api/models/type_enum.rb +26 -0
  176. data/lib/spotify_web_api/models/users_playlists_request.rb +101 -0
  177. data/lib/spotify_web_api/utilities/date_time_helper.rb +11 -0
  178. data/lib/spotify_web_api/utilities/file_wrapper.rb +28 -0
  179. data/lib/spotify_web_api/utilities/union_type_lookup.rb +73 -0
  180. data/lib/spotify_web_api.rb +200 -0
  181. metadata +264 -0
@@ -0,0 +1,368 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # EpisodeObject Model.
8
+ class EpisodeObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A URL to a 30 second preview (MP3 format) of the episode. `null` if not
13
+ # available.
14
+ # @return [String]
15
+ attr_accessor :audio_preview_url
16
+
17
+ # A description of the episode. HTML tags are stripped away from this field,
18
+ # use `html_description` field in case HTML tags are needed.
19
+ # @return [String]
20
+ attr_accessor :description
21
+
22
+ # A description of the episode. This field may contain HTML tags.
23
+ # @return [String]
24
+ attr_accessor :html_description
25
+
26
+ # The episode length in milliseconds.
27
+ # @return [Integer]
28
+ attr_accessor :duration_ms
29
+
30
+ # Whether or not the episode has explicit content (true = yes it does; false
31
+ # = no it does not OR unknown).
32
+ # @return [TrueClass | FalseClass]
33
+ attr_accessor :explicit
34
+
35
+ # External URLs for this episode.
36
+ # @return [ExternalUrlObject]
37
+ attr_accessor :external_urls
38
+
39
+ # A link to the Web API endpoint providing full details of the episode.
40
+ # @return [String]
41
+ attr_accessor :href
42
+
43
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
44
+ # episode.
45
+ # @return [String]
46
+ attr_accessor :id
47
+
48
+ # The cover art for the episode in various sizes, widest first.
49
+ # @return [Array[ImageObject]]
50
+ attr_accessor :images
51
+
52
+ # True if the episode is hosted outside of Spotify's CDN.
53
+ # @return [TrueClass | FalseClass]
54
+ attr_accessor :is_externally_hosted
55
+
56
+ # True if the episode is playable in the given market. Otherwise false.
57
+ # @return [TrueClass | FalseClass]
58
+ attr_accessor :is_playable
59
+
60
+ # The language used in the episode, identified by a [ISO
61
+ # 639](https://en.wikipedia.org/wiki/ISO_639) code. This field is deprecated
62
+ # and might be removed in the future. Please use the `languages` field
63
+ # instead.
64
+ # @return [String]
65
+ attr_accessor :language
66
+
67
+ # A list of the languages used in the episode, identified by their [ISO
68
+ # 639-1](https://en.wikipedia.org/wiki/ISO_639) code.
69
+ # @return [Array[String]]
70
+ attr_accessor :languages
71
+
72
+ # The name of the episode.
73
+ # @return [String]
74
+ attr_accessor :name
75
+
76
+ # The date the episode was first released, for example `"1981-12-15"`.
77
+ # Depending on the precision, it might be shown as `"1981"` or `"1981-12"`.
78
+ # @return [String]
79
+ attr_accessor :release_date
80
+
81
+ # The precision with which `release_date` value is known.
82
+ # @return [ReleaseDatePrecisionEnum]
83
+ attr_accessor :release_date_precision
84
+
85
+ # The user's most recent position in the episode. Set if the supplied access
86
+ # token is a user token and has the scope 'user-read-playback-position'.
87
+ # @return [ResumePointObject]
88
+ attr_accessor :resume_point
89
+
90
+ # The object type.
91
+ # @return [Type5Enum]
92
+ attr_accessor :type
93
+
94
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
95
+ # the episode.
96
+ # @return [String]
97
+ attr_accessor :uri
98
+
99
+ # Included in the response when a content restriction is applied.
100
+ # @return [EpisodeRestrictionObject]
101
+ attr_accessor :restrictions
102
+
103
+ # The show on which the episode belongs.
104
+ # @return [ShowBase]
105
+ attr_accessor :show
106
+
107
+ # A mapping from model property names to API property names.
108
+ def self.names
109
+ @_hash = {} if @_hash.nil?
110
+ @_hash['audio_preview_url'] = 'audio_preview_url'
111
+ @_hash['description'] = 'description'
112
+ @_hash['html_description'] = 'html_description'
113
+ @_hash['duration_ms'] = 'duration_ms'
114
+ @_hash['explicit'] = 'explicit'
115
+ @_hash['external_urls'] = 'external_urls'
116
+ @_hash['href'] = 'href'
117
+ @_hash['id'] = 'id'
118
+ @_hash['images'] = 'images'
119
+ @_hash['is_externally_hosted'] = 'is_externally_hosted'
120
+ @_hash['is_playable'] = 'is_playable'
121
+ @_hash['language'] = 'language'
122
+ @_hash['languages'] = 'languages'
123
+ @_hash['name'] = 'name'
124
+ @_hash['release_date'] = 'release_date'
125
+ @_hash['release_date_precision'] = 'release_date_precision'
126
+ @_hash['resume_point'] = 'resume_point'
127
+ @_hash['type'] = 'type'
128
+ @_hash['uri'] = 'uri'
129
+ @_hash['restrictions'] = 'restrictions'
130
+ @_hash['show'] = 'show'
131
+ @_hash
132
+ end
133
+
134
+ # An array for optional fields
135
+ def self.optionals
136
+ %w[
137
+ language
138
+ resume_point
139
+ restrictions
140
+ ]
141
+ end
142
+
143
+ # An array for nullable fields
144
+ def self.nullables
145
+ %w[
146
+ audio_preview_url
147
+ ]
148
+ end
149
+
150
+ def initialize(audio_preview_url = nil, description = nil,
151
+ html_description = nil, duration_ms = nil, explicit = nil,
152
+ external_urls = nil, href = nil, id = nil, images = nil,
153
+ is_externally_hosted = nil, is_playable = nil,
154
+ languages = nil, name = nil, release_date = nil,
155
+ release_date_precision = nil, type = nil, uri = nil,
156
+ show = nil, language = SKIP, resume_point = SKIP,
157
+ restrictions = SKIP)
158
+ @audio_preview_url = audio_preview_url
159
+ @description = description
160
+ @html_description = html_description
161
+ @duration_ms = duration_ms
162
+ @explicit = explicit
163
+ @external_urls = external_urls
164
+ @href = href
165
+ @id = id
166
+ @images = images
167
+ @is_externally_hosted = is_externally_hosted
168
+ @is_playable = is_playable
169
+ @language = language unless language == SKIP
170
+ @languages = languages
171
+ @name = name
172
+ @release_date = release_date
173
+ @release_date_precision = release_date_precision
174
+ @resume_point = resume_point unless resume_point == SKIP
175
+ @type = type
176
+ @uri = uri
177
+ @restrictions = restrictions unless restrictions == SKIP
178
+ @show = show
179
+ end
180
+
181
+ # Creates an instance of the object from a hash.
182
+ def self.from_hash(hash)
183
+ return nil unless hash
184
+
185
+ # Extract variables from the hash.
186
+ audio_preview_url =
187
+ hash.key?('audio_preview_url') ? hash['audio_preview_url'] : nil
188
+ description = hash.key?('description') ? hash['description'] : nil
189
+ html_description =
190
+ hash.key?('html_description') ? hash['html_description'] : nil
191
+ duration_ms = hash.key?('duration_ms') ? hash['duration_ms'] : nil
192
+ explicit = hash.key?('explicit') ? hash['explicit'] : nil
193
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
194
+ href = hash.key?('href') ? hash['href'] : nil
195
+ id = hash.key?('id') ? hash['id'] : nil
196
+ # Parameter is an array, so we need to iterate through it
197
+ images = nil
198
+ unless hash['images'].nil?
199
+ images = []
200
+ hash['images'].each do |structure|
201
+ images << (ImageObject.from_hash(structure) if structure)
202
+ end
203
+ end
204
+
205
+ images = nil unless hash.key?('images')
206
+ is_externally_hosted =
207
+ hash.key?('is_externally_hosted') ? hash['is_externally_hosted'] : nil
208
+ is_playable = hash.key?('is_playable') ? hash['is_playable'] : nil
209
+ languages = hash.key?('languages') ? hash['languages'] : nil
210
+ name = hash.key?('name') ? hash['name'] : nil
211
+ release_date = hash.key?('release_date') ? hash['release_date'] : nil
212
+ release_date_precision =
213
+ hash.key?('release_date_precision') ? hash['release_date_precision'] : nil
214
+ type = hash.key?('type') ? hash['type'] : nil
215
+ uri = hash.key?('uri') ? hash['uri'] : nil
216
+ show = ShowBase.from_hash(hash['show']) if hash['show']
217
+ language = hash.key?('language') ? hash['language'] : SKIP
218
+ resume_point = ResumePointObject.from_hash(hash['resume_point']) if hash['resume_point']
219
+ restrictions = EpisodeRestrictionObject.from_hash(hash['restrictions']) if
220
+ hash['restrictions']
221
+
222
+ # Create object from extracted values.
223
+ EpisodeObject.new(audio_preview_url,
224
+ description,
225
+ html_description,
226
+ duration_ms,
227
+ explicit,
228
+ external_urls,
229
+ href,
230
+ id,
231
+ images,
232
+ is_externally_hosted,
233
+ is_playable,
234
+ languages,
235
+ name,
236
+ release_date,
237
+ release_date_precision,
238
+ type,
239
+ uri,
240
+ show,
241
+ language,
242
+ resume_point,
243
+ restrictions)
244
+ end
245
+
246
+ # Validates an instance of the object from a given value.
247
+ # @param [EpisodeObject | Hash] The value against the validation is performed.
248
+ def self.validate(value)
249
+ if value.instance_of? self
250
+ return (
251
+ APIHelper.valid_type?(value.audio_preview_url,
252
+ ->(val) { val.instance_of? String }) and
253
+ APIHelper.valid_type?(value.description,
254
+ ->(val) { val.instance_of? String }) and
255
+ APIHelper.valid_type?(value.html_description,
256
+ ->(val) { val.instance_of? String }) and
257
+ APIHelper.valid_type?(value.duration_ms,
258
+ ->(val) { val.instance_of? Integer }) and
259
+ APIHelper.valid_type?(value.explicit,
260
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
261
+ APIHelper.valid_type?(value.external_urls,
262
+ ->(val) { ExternalUrlObject.validate(val) },
263
+ is_model_hash: true) and
264
+ APIHelper.valid_type?(value.href,
265
+ ->(val) { val.instance_of? String }) and
266
+ APIHelper.valid_type?(value.id,
267
+ ->(val) { val.instance_of? String }) and
268
+ APIHelper.valid_type?(value.images,
269
+ ->(val) { ImageObject.validate(val) },
270
+ is_model_hash: true,
271
+ is_inner_model_hash: true) and
272
+ APIHelper.valid_type?(value.is_externally_hosted,
273
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
274
+ APIHelper.valid_type?(value.is_playable,
275
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
276
+ APIHelper.valid_type?(value.languages,
277
+ ->(val) { val.instance_of? String }) and
278
+ APIHelper.valid_type?(value.name,
279
+ ->(val) { val.instance_of? String }) and
280
+ APIHelper.valid_type?(value.release_date,
281
+ ->(val) { val.instance_of? String }) and
282
+ APIHelper.valid_type?(value.release_date_precision,
283
+ ->(val) { ReleaseDatePrecisionEnum.validate(val) }) and
284
+ APIHelper.valid_type?(value.type,
285
+ ->(val) { Type5Enum.validate(val) }) and
286
+ APIHelper.valid_type?(value.uri,
287
+ ->(val) { val.instance_of? String }) and
288
+ APIHelper.valid_type?(value.show,
289
+ ->(val) { ShowBase.validate(val) },
290
+ is_model_hash: true)
291
+ )
292
+ end
293
+
294
+ return false unless value.instance_of? Hash
295
+
296
+ (
297
+ APIHelper.valid_type?(value['audio_preview_url'],
298
+ ->(val) { val.instance_of? String }) and
299
+ APIHelper.valid_type?(value['description'],
300
+ ->(val) { val.instance_of? String }) and
301
+ APIHelper.valid_type?(value['html_description'],
302
+ ->(val) { val.instance_of? String }) and
303
+ APIHelper.valid_type?(value['duration_ms'],
304
+ ->(val) { val.instance_of? Integer }) and
305
+ APIHelper.valid_type?(value['explicit'],
306
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
307
+ APIHelper.valid_type?(value['external_urls'],
308
+ ->(val) { ExternalUrlObject.validate(val) },
309
+ is_model_hash: true) and
310
+ APIHelper.valid_type?(value['href'],
311
+ ->(val) { val.instance_of? String }) and
312
+ APIHelper.valid_type?(value['id'],
313
+ ->(val) { val.instance_of? String }) and
314
+ APIHelper.valid_type?(value['images'],
315
+ ->(val) { ImageObject.validate(val) },
316
+ is_model_hash: true,
317
+ is_inner_model_hash: true) and
318
+ APIHelper.valid_type?(value['is_externally_hosted'],
319
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
320
+ APIHelper.valid_type?(value['is_playable'],
321
+ ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
322
+ APIHelper.valid_type?(value['languages'],
323
+ ->(val) { val.instance_of? String }) and
324
+ APIHelper.valid_type?(value['name'],
325
+ ->(val) { val.instance_of? String }) and
326
+ APIHelper.valid_type?(value['release_date'],
327
+ ->(val) { val.instance_of? String }) and
328
+ APIHelper.valid_type?(value['release_date_precision'],
329
+ ->(val) { ReleaseDatePrecisionEnum.validate(val) }) and
330
+ APIHelper.valid_type?(value['type'],
331
+ ->(val) { Type5Enum.validate(val) }) and
332
+ APIHelper.valid_type?(value['uri'],
333
+ ->(val) { val.instance_of? String }) and
334
+ APIHelper.valid_type?(value['show'],
335
+ ->(val) { ShowBase.validate(val) },
336
+ is_model_hash: true)
337
+ )
338
+ end
339
+
340
+ # Provides a human-readable string representation of the object.
341
+ def to_s
342
+ class_name = self.class.name.split('::').last
343
+ "<#{class_name} audio_preview_url: #{@audio_preview_url}, description: #{@description},"\
344
+ " html_description: #{@html_description}, duration_ms: #{@duration_ms}, explicit:"\
345
+ " #{@explicit}, external_urls: #{@external_urls}, href: #{@href}, id: #{@id}, images:"\
346
+ " #{@images}, is_externally_hosted: #{@is_externally_hosted}, is_playable: #{@is_playable},"\
347
+ " language: #{@language}, languages: #{@languages}, name: #{@name}, release_date:"\
348
+ " #{@release_date}, release_date_precision: #{@release_date_precision}, resume_point:"\
349
+ " #{@resume_point}, type: #{@type}, uri: #{@uri}, restrictions: #{@restrictions}, show:"\
350
+ " #{@show}>"
351
+ end
352
+
353
+ # Provides a debugging-friendly string with detailed object information.
354
+ def inspect
355
+ class_name = self.class.name.split('::').last
356
+ "<#{class_name} audio_preview_url: #{@audio_preview_url.inspect}, description:"\
357
+ " #{@description.inspect}, html_description: #{@html_description.inspect}, duration_ms:"\
358
+ " #{@duration_ms.inspect}, explicit: #{@explicit.inspect}, external_urls:"\
359
+ " #{@external_urls.inspect}, href: #{@href.inspect}, id: #{@id.inspect}, images:"\
360
+ " #{@images.inspect}, is_externally_hosted: #{@is_externally_hosted.inspect}, is_playable:"\
361
+ " #{@is_playable.inspect}, language: #{@language.inspect}, languages: #{@languages.inspect},"\
362
+ " name: #{@name.inspect}, release_date: #{@release_date.inspect}, release_date_precision:"\
363
+ " #{@release_date_precision.inspect}, resume_point: #{@resume_point.inspect}, type:"\
364
+ " #{@type.inspect}, uri: #{@uri.inspect}, restrictions: #{@restrictions.inspect}, show:"\
365
+ " #{@show.inspect}>"
366
+ end
367
+ end
368
+ end
@@ -0,0 +1,80 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # EpisodeRestrictionObject Model.
8
+ class EpisodeRestrictionObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The reason for the restriction. Supported values:
13
+ # - `market` - The content item is not available in the given market.
14
+ # - `product` - The content item is not available for the user's
15
+ # subscription type.
16
+ # - `explicit` - The content item is explicit and the user's account is set
17
+ # to not play explicit content.
18
+ # Additional reasons may be added in the future.
19
+ # **Note**: If you use this field, make sure that your application safely
20
+ # handles unknown values.
21
+ # @return [String]
22
+ attr_accessor :reason
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['reason'] = 'reason'
28
+ @_hash
29
+ end
30
+
31
+ # An array for optional fields
32
+ def self.optionals
33
+ %w[
34
+ reason
35
+ ]
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(reason = SKIP)
44
+ @reason = reason unless reason == SKIP
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ reason = hash.key?('reason') ? hash['reason'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ EpisodeRestrictionObject.new(reason)
56
+ end
57
+
58
+ # Validates an instance of the object from a given value.
59
+ # @param [EpisodeRestrictionObject | Hash] The value against the validation is performed.
60
+ def self.validate(value)
61
+ return true if value.instance_of? self
62
+
63
+ return false unless value.instance_of? Hash
64
+
65
+ true
66
+ end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} reason: #{@reason}>"
72
+ end
73
+
74
+ # Provides a debugging-friendly string with detailed object information.
75
+ def inspect
76
+ class_name = self.class.name.split('::').last
77
+ "<#{class_name} reason: #{@reason.inspect}>"
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,71 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # ErrorObject Model.
8
+ class ErrorObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The HTTP status code (also returned in the response header; see [Response
13
+ # Status
14
+ # Codes](/documentation/web-api/concepts/api-calls#response-status-codes)
15
+ # for more information).
16
+ # @return [Integer]
17
+ attr_accessor :status
18
+
19
+ # A short description of the cause of the error.
20
+ # @return [String]
21
+ attr_accessor :message
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ @_hash = {} if @_hash.nil?
26
+ @_hash['status'] = 'status'
27
+ @_hash['message'] = 'message'
28
+ @_hash
29
+ end
30
+
31
+ # An array for optional fields
32
+ def self.optionals
33
+ []
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(status = nil, message = nil)
42
+ @status = status
43
+ @message = message
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ status = hash.key?('status') ? hash['status'] : nil
52
+ message = hash.key?('message') ? hash['message'] : nil
53
+
54
+ # Create object from extracted values.
55
+ ErrorObject.new(status,
56
+ message)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} status: #{@status}, message: #{@message}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} status: #{@status.inspect}, message: #{@message.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,74 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # ExplicitContentSettingsObject Model.
8
+ class ExplicitContentSettingsObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # When `true`, indicates that explicit content should not be played.
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :filter_enabled
15
+
16
+ # When `true`, indicates that the explicit content setting is locked and
17
+ # can't be changed by the user.
18
+ # @return [TrueClass | FalseClass]
19
+ attr_accessor :filter_locked
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['filter_enabled'] = 'filter_enabled'
25
+ @_hash['filter_locked'] = 'filter_locked'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ filter_enabled
33
+ filter_locked
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(filter_enabled = SKIP, filter_locked = SKIP)
43
+ @filter_enabled = filter_enabled unless filter_enabled == SKIP
44
+ @filter_locked = filter_locked unless filter_locked == SKIP
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ filter_enabled =
53
+ hash.key?('filter_enabled') ? hash['filter_enabled'] : SKIP
54
+ filter_locked = hash.key?('filter_locked') ? hash['filter_locked'] : SKIP
55
+
56
+ # Create object from extracted values.
57
+ ExplicitContentSettingsObject.new(filter_enabled,
58
+ filter_locked)
59
+ end
60
+
61
+ # Provides a human-readable string representation of the object.
62
+ def to_s
63
+ class_name = self.class.name.split('::').last
64
+ "<#{class_name} filter_enabled: #{@filter_enabled}, filter_locked: #{@filter_locked}>"
65
+ end
66
+
67
+ # Provides a debugging-friendly string with detailed object information.
68
+ def inspect
69
+ class_name = self.class.name.split('::').last
70
+ "<#{class_name} filter_enabled: #{@filter_enabled.inspect}, filter_locked:"\
71
+ " #{@filter_locked.inspect}>"
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,94 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # ExternalIdObject Model.
8
+ class ExternalIdObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # [International Standard Recording
13
+ # Code](http://en.wikipedia.org/wiki/International_Standard_Recording_Code)
14
+ # @return [String]
15
+ attr_accessor :isrc
16
+
17
+ # [International Article
18
+ # Number](http://en.wikipedia.org/wiki/International_Article_Number_%28EAN%2
19
+ # 9)
20
+ # @return [String]
21
+ attr_accessor :ean
22
+
23
+ # [Universal Product
24
+ # Code](http://en.wikipedia.org/wiki/Universal_Product_Code)
25
+ # @return [String]
26
+ attr_accessor :upc
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['isrc'] = 'isrc'
32
+ @_hash['ean'] = 'ean'
33
+ @_hash['upc'] = 'upc'
34
+ @_hash
35
+ end
36
+
37
+ # An array for optional fields
38
+ def self.optionals
39
+ %w[
40
+ isrc
41
+ ean
42
+ upc
43
+ ]
44
+ end
45
+
46
+ # An array for nullable fields
47
+ def self.nullables
48
+ []
49
+ end
50
+
51
+ def initialize(isrc = SKIP, ean = SKIP, upc = SKIP)
52
+ @isrc = isrc unless isrc == SKIP
53
+ @ean = ean unless ean == SKIP
54
+ @upc = upc unless upc == SKIP
55
+ end
56
+
57
+ # Creates an instance of the object from a hash.
58
+ def self.from_hash(hash)
59
+ return nil unless hash
60
+
61
+ # Extract variables from the hash.
62
+ isrc = hash.key?('isrc') ? hash['isrc'] : SKIP
63
+ ean = hash.key?('ean') ? hash['ean'] : SKIP
64
+ upc = hash.key?('upc') ? hash['upc'] : SKIP
65
+
66
+ # Create object from extracted values.
67
+ ExternalIdObject.new(isrc,
68
+ ean,
69
+ upc)
70
+ end
71
+
72
+ # Validates an instance of the object from a given value.
73
+ # @param [ExternalIdObject | Hash] The value against the validation is performed.
74
+ def self.validate(value)
75
+ return true if value.instance_of? self
76
+
77
+ return false unless value.instance_of? Hash
78
+
79
+ true
80
+ end
81
+
82
+ # Provides a human-readable string representation of the object.
83
+ def to_s
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} isrc: #{@isrc}, ean: #{@ean}, upc: #{@upc}>"
86
+ end
87
+
88
+ # Provides a debugging-friendly string with detailed object information.
89
+ def inspect
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} isrc: #{@isrc.inspect}, ean: #{@ean.inspect}, upc: #{@upc.inspect}>"
92
+ end
93
+ end
94
+ end