spotify-api-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 (178) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +30 -0
  3. data/README.md +107 -0
  4. data/lib/spotify_web_api/api_helper.rb +10 -0
  5. data/lib/spotify_web_api/client.rb +154 -0
  6. data/lib/spotify_web_api/configuration.rb +180 -0
  7. data/lib/spotify_web_api/controllers/albums_controller.rb +295 -0
  8. data/lib/spotify_web_api/controllers/artists_controller.rb +187 -0
  9. data/lib/spotify_web_api/controllers/audiobooks_controller.rb +258 -0
  10. data/lib/spotify_web_api/controllers/base_controller.rb +66 -0
  11. data/lib/spotify_web_api/controllers/categories_controller.rb +83 -0
  12. data/lib/spotify_web_api/controllers/chapters_controller.rb +82 -0
  13. data/lib/spotify_web_api/controllers/episodes_controller.rb +239 -0
  14. data/lib/spotify_web_api/controllers/genres_controller.rb +39 -0
  15. data/lib/spotify_web_api/controllers/markets_controller.rb +38 -0
  16. data/lib/spotify_web_api/controllers/o_auth_authorization_controller.rb +82 -0
  17. data/lib/spotify_web_api/controllers/player_controller.rb +509 -0
  18. data/lib/spotify_web_api/controllers/playlists_controller.rb +521 -0
  19. data/lib/spotify_web_api/controllers/search_controller.rb +60 -0
  20. data/lib/spotify_web_api/controllers/shows_controller.rb +261 -0
  21. data/lib/spotify_web_api/controllers/tracks_controller.rb +491 -0
  22. data/lib/spotify_web_api/controllers/users_controller.rb +396 -0
  23. data/lib/spotify_web_api/exceptions/api_exception.rb +10 -0
  24. data/lib/spotify_web_api/exceptions/bad_request_exception.rb +32 -0
  25. data/lib/spotify_web_api/exceptions/forbidden_exception.rb +32 -0
  26. data/lib/spotify_web_api/exceptions/not_found_exception.rb +32 -0
  27. data/lib/spotify_web_api/exceptions/o_auth_provider_exception.rb +48 -0
  28. data/lib/spotify_web_api/exceptions/too_many_requests_exception.rb +32 -0
  29. data/lib/spotify_web_api/exceptions/unauthorized_exception.rb +32 -0
  30. data/lib/spotify_web_api/http/api_response.rb +21 -0
  31. data/lib/spotify_web_api/http/auth/o_auth2.rb +146 -0
  32. data/lib/spotify_web_api/http/http_call_back.rb +10 -0
  33. data/lib/spotify_web_api/http/http_method_enum.rb +10 -0
  34. data/lib/spotify_web_api/http/http_request.rb +10 -0
  35. data/lib/spotify_web_api/http/http_response.rb +10 -0
  36. data/lib/spotify_web_api/models/album_base.rb +168 -0
  37. data/lib/spotify_web_api/models/album_group_enum.rb +29 -0
  38. data/lib/spotify_web_api/models/album_object.rb +247 -0
  39. data/lib/spotify_web_api/models/album_restriction_object.rb +53 -0
  40. data/lib/spotify_web_api/models/album_type_enum.rb +26 -0
  41. data/lib/spotify_web_api/models/artist_discography_album_object.rb +194 -0
  42. data/lib/spotify_web_api/models/artist_object.rb +147 -0
  43. data/lib/spotify_web_api/models/audio_analysis_object.rb +156 -0
  44. data/lib/spotify_web_api/models/audio_features_object.rb +249 -0
  45. data/lib/spotify_web_api/models/audiobook_base.rb +245 -0
  46. data/lib/spotify_web_api/models/audiobook_object.rb +253 -0
  47. data/lib/spotify_web_api/models/author_object.rb +50 -0
  48. data/lib/spotify_web_api/models/base_model.rb +62 -0
  49. data/lib/spotify_web_api/models/categories.rb +110 -0
  50. data/lib/spotify_web_api/models/category_object.rb +82 -0
  51. data/lib/spotify_web_api/models/chapter_base.rb +237 -0
  52. data/lib/spotify_web_api/models/chapter_object.rb +245 -0
  53. data/lib/spotify_web_api/models/chapter_restriction_object.rb +59 -0
  54. data/lib/spotify_web_api/models/context_object.rb +78 -0
  55. data/lib/spotify_web_api/models/copyright_object.rb +60 -0
  56. data/lib/spotify_web_api/models/currently_playing_context_object.rb +137 -0
  57. data/lib/spotify_web_api/models/currently_playing_object.rb +109 -0
  58. data/lib/spotify_web_api/models/cursor_object.rb +59 -0
  59. data/lib/spotify_web_api/models/cursor_paged_artists.rb +48 -0
  60. data/lib/spotify_web_api/models/cursor_paging_object.rb +88 -0
  61. data/lib/spotify_web_api/models/cursor_paging_play_history_object.rb +106 -0
  62. data/lib/spotify_web_api/models/cursor_paging_simplified_artist_object.rb +106 -0
  63. data/lib/spotify_web_api/models/device_object.rb +126 -0
  64. data/lib/spotify_web_api/models/disallows_object.rb +140 -0
  65. data/lib/spotify_web_api/models/episode_base.rb +237 -0
  66. data/lib/spotify_web_api/models/episode_object.rb +246 -0
  67. data/lib/spotify_web_api/models/episode_restriction_object.rb +58 -0
  68. data/lib/spotify_web_api/models/error_object.rb +59 -0
  69. data/lib/spotify_web_api/models/explicit_content_settings_object.rb +61 -0
  70. data/lib/spotify_web_api/models/external_id_object.rb +72 -0
  71. data/lib/spotify_web_api/models/external_url_object.rb +51 -0
  72. data/lib/spotify_web_api/models/followers_object.rb +62 -0
  73. data/lib/spotify_web_api/models/image_object.rb +67 -0
  74. data/lib/spotify_web_api/models/include_external_enum.rb +23 -0
  75. data/lib/spotify_web_api/models/item_type1_enum.rb +20 -0
  76. data/lib/spotify_web_api/models/item_type2_enum.rb +23 -0
  77. data/lib/spotify_web_api/models/item_type3_enum.rb +23 -0
  78. data/lib/spotify_web_api/models/item_type_enum.rb +38 -0
  79. data/lib/spotify_web_api/models/linked_track_object.rb +89 -0
  80. data/lib/spotify_web_api/models/many_albums.rb +57 -0
  81. data/lib/spotify_web_api/models/many_artists.rb +57 -0
  82. data/lib/spotify_web_api/models/many_audio_features.rb +57 -0
  83. data/lib/spotify_web_api/models/many_audiobooks.rb +57 -0
  84. data/lib/spotify_web_api/models/many_chapters.rb +57 -0
  85. data/lib/spotify_web_api/models/many_devices.rb +57 -0
  86. data/lib/spotify_web_api/models/many_episodes.rb +57 -0
  87. data/lib/spotify_web_api/models/many_genres.rb +48 -0
  88. data/lib/spotify_web_api/models/many_simplified_shows.rb +57 -0
  89. data/lib/spotify_web_api/models/many_tracks.rb +57 -0
  90. data/lib/spotify_web_api/models/markets.rb +50 -0
  91. data/lib/spotify_web_api/models/me_albums_request.rb +55 -0
  92. data/lib/spotify_web_api/models/me_episodes_request.rb +52 -0
  93. data/lib/spotify_web_api/models/me_episodes_request1.rb +54 -0
  94. data/lib/spotify_web_api/models/me_following_request.rb +53 -0
  95. data/lib/spotify_web_api/models/me_following_request1.rb +55 -0
  96. data/lib/spotify_web_api/models/me_player_play_request.rb +89 -0
  97. data/lib/spotify_web_api/models/me_player_request.rb +63 -0
  98. data/lib/spotify_web_api/models/me_shows_request.rb +55 -0
  99. data/lib/spotify_web_api/models/me_tracks_request.rb +53 -0
  100. data/lib/spotify_web_api/models/me_tracks_request1.rb +55 -0
  101. data/lib/spotify_web_api/models/meta.rb +110 -0
  102. data/lib/spotify_web_api/models/mode_enum.rb +30 -0
  103. data/lib/spotify_web_api/models/narrator_object.rb +50 -0
  104. data/lib/spotify_web_api/models/o_auth_provider_error_enum.rb +45 -0
  105. data/lib/spotify_web_api/models/o_auth_scope_enum.rb +94 -0
  106. data/lib/spotify_web_api/models/o_auth_token.rb +96 -0
  107. data/lib/spotify_web_api/models/paged_albums.rb +48 -0
  108. data/lib/spotify_web_api/models/paged_categories.rb +48 -0
  109. data/lib/spotify_web_api/models/paging_artist_discography_album_object.rb +110 -0
  110. data/lib/spotify_web_api/models/paging_artist_object.rb +110 -0
  111. data/lib/spotify_web_api/models/paging_featured_playlist_object.rb +59 -0
  112. data/lib/spotify_web_api/models/paging_object.rb +93 -0
  113. data/lib/spotify_web_api/models/paging_playlist_object.rb +110 -0
  114. data/lib/spotify_web_api/models/paging_playlist_track_object.rb +110 -0
  115. data/lib/spotify_web_api/models/paging_saved_album_object.rb +110 -0
  116. data/lib/spotify_web_api/models/paging_saved_audiobook_object.rb +110 -0
  117. data/lib/spotify_web_api/models/paging_saved_episode_object.rb +110 -0
  118. data/lib/spotify_web_api/models/paging_saved_show_object.rb +110 -0
  119. data/lib/spotify_web_api/models/paging_saved_track_object.rb +110 -0
  120. data/lib/spotify_web_api/models/paging_simplified_album_object.rb +110 -0
  121. data/lib/spotify_web_api/models/paging_simplified_audiobook_object.rb +110 -0
  122. data/lib/spotify_web_api/models/paging_simplified_chapter_object.rb +110 -0
  123. data/lib/spotify_web_api/models/paging_simplified_episode_object.rb +110 -0
  124. data/lib/spotify_web_api/models/paging_simplified_show_object.rb +110 -0
  125. data/lib/spotify_web_api/models/paging_simplified_track_object.rb +110 -0
  126. data/lib/spotify_web_api/models/paging_track_object.rb +110 -0
  127. data/lib/spotify_web_api/models/play_history_object.rb +77 -0
  128. data/lib/spotify_web_api/models/playlist_object.rb +193 -0
  129. data/lib/spotify_web_api/models/playlist_owner_object.rb +109 -0
  130. data/lib/spotify_web_api/models/playlist_snapshot_id.rb +50 -0
  131. data/lib/spotify_web_api/models/playlist_track_object.rb +90 -0
  132. data/lib/spotify_web_api/models/playlist_tracks_ref_object.rb +60 -0
  133. data/lib/spotify_web_api/models/playlist_user_object.rb +98 -0
  134. data/lib/spotify_web_api/models/playlists_followers_request.rb +51 -0
  135. data/lib/spotify_web_api/models/playlists_request.rb +82 -0
  136. data/lib/spotify_web_api/models/playlists_tracks_request.rb +72 -0
  137. data/lib/spotify_web_api/models/playlists_tracks_request1.rb +97 -0
  138. data/lib/spotify_web_api/models/playlists_tracks_request2.rb +75 -0
  139. data/lib/spotify_web_api/models/private_user_object.rb +181 -0
  140. data/lib/spotify_web_api/models/public_user_object.rb +128 -0
  141. data/lib/spotify_web_api/models/queue_object.rb +60 -0
  142. data/lib/spotify_web_api/models/reason_enum.rb +29 -0
  143. data/lib/spotify_web_api/models/recommendation_seed_object.rb +104 -0
  144. data/lib/spotify_web_api/models/recommendations_object.rb +74 -0
  145. data/lib/spotify_web_api/models/release_date_precision_enum.rb +26 -0
  146. data/lib/spotify_web_api/models/resume_point_object.rb +60 -0
  147. data/lib/spotify_web_api/models/saved_album_object.rb +73 -0
  148. data/lib/spotify_web_api/models/saved_audiobook_object.rb +73 -0
  149. data/lib/spotify_web_api/models/saved_episode_object.rb +70 -0
  150. data/lib/spotify_web_api/models/saved_show_object.rb +73 -0
  151. data/lib/spotify_web_api/models/saved_track_object.rb +73 -0
  152. data/lib/spotify_web_api/models/search_items.rb +107 -0
  153. data/lib/spotify_web_api/models/section_object.rb +180 -0
  154. data/lib/spotify_web_api/models/segment_object.rb +166 -0
  155. data/lib/spotify_web_api/models/show_base.rb +211 -0
  156. data/lib/spotify_web_api/models/show_object.rb +219 -0
  157. data/lib/spotify_web_api/models/simplified_album_object.rb +186 -0
  158. data/lib/spotify_web_api/models/simplified_artist_object.rb +98 -0
  159. data/lib/spotify_web_api/models/simplified_playlist_object.rb +184 -0
  160. data/lib/spotify_web_api/models/simplified_track_object.rb +227 -0
  161. data/lib/spotify_web_api/models/time_interval_object.rb +68 -0
  162. data/lib/spotify_web_api/models/track.rb +331 -0
  163. data/lib/spotify_web_api/models/track1.rb +50 -0
  164. data/lib/spotify_web_api/models/track_object.rb +265 -0
  165. data/lib/spotify_web_api/models/track_restriction_object.rb +58 -0
  166. data/lib/spotify_web_api/models/type2_enum.rb +20 -0
  167. data/lib/spotify_web_api/models/type3_enum.rb +20 -0
  168. data/lib/spotify_web_api/models/type4_enum.rb +20 -0
  169. data/lib/spotify_web_api/models/type6_enum.rb +20 -0
  170. data/lib/spotify_web_api/models/type7_enum.rb +20 -0
  171. data/lib/spotify_web_api/models/type8_enum.rb +20 -0
  172. data/lib/spotify_web_api/models/type9_enum.rb +20 -0
  173. data/lib/spotify_web_api/models/type_enum.rb +20 -0
  174. data/lib/spotify_web_api/models/users_playlists_request.rb +87 -0
  175. data/lib/spotify_web_api/utilities/date_time_helper.rb +11 -0
  176. data/lib/spotify_web_api/utilities/file_wrapper.rb +16 -0
  177. data/lib/spotify_web_api.rb +198 -0
  178. metadata +264 -0
@@ -0,0 +1,265 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # TrackObject Model.
8
+ class TrackObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The album on which the track appears. The album object includes a link in
13
+ # `href` to full information about the album.
14
+ # @return [SimplifiedAlbumObject]
15
+ attr_accessor :album
16
+
17
+ # The artists who performed the track. Each artist object includes a link in
18
+ # `href` to more detailed information about the artist.
19
+ # @return [Array[ArtistObject]]
20
+ attr_accessor :artists
21
+
22
+ # A list of the countries in which the track can be played, identified by
23
+ # their [ISO 3166-1
24
+ # alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
25
+ # @return [Array[String]]
26
+ attr_accessor :available_markets
27
+
28
+ # The disc number (usually `1` unless the album consists of more than one
29
+ # disc).
30
+ # @return [Integer]
31
+ attr_accessor :disc_number
32
+
33
+ # The track length in milliseconds.
34
+ # @return [Integer]
35
+ attr_accessor :duration_ms
36
+
37
+ # Whether or not the track has explicit lyrics ( `true` = yes it does;
38
+ # `false` = no it does not OR unknown).
39
+ # @return [TrueClass | FalseClass]
40
+ attr_accessor :explicit
41
+
42
+ # Known external IDs for the track.
43
+ # @return [ExternalIdObject]
44
+ attr_accessor :external_ids
45
+
46
+ # Known external URLs for this track.
47
+ # @return [ExternalUrlObject]
48
+ attr_accessor :external_urls
49
+
50
+ # A link to the Web API endpoint providing full details of the track.
51
+ # @return [String]
52
+ attr_accessor :href
53
+
54
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
55
+ # track.
56
+ # @return [String]
57
+ attr_accessor :id
58
+
59
+ # Part of the response when [Track
60
+ # Relinking](/documentation/web-api/concepts/track-relinking) is applied. If
61
+ # `true`, the track is playable in the given market. Otherwise `false`.
62
+ # @return [TrueClass | FalseClass]
63
+ attr_accessor :is_playable
64
+
65
+ # Part of the response when [Track
66
+ # Relinking](/documentation/web-api/concepts/track-relinking) is applied,
67
+ # and the requested track has been replaced with different track. The track
68
+ # in the `linked_from` object contains information about the originally
69
+ # requested track.
70
+ # @return [LinkedTrackObject]
71
+ attr_accessor :linked_from
72
+
73
+ # Included in the response when a content restriction is applied.
74
+ # @return [TrackRestrictionObject]
75
+ attr_accessor :restrictions
76
+
77
+ # The name of the track.
78
+ # @return [String]
79
+ attr_accessor :name
80
+
81
+ # The popularity of the track. The value will be between 0 and 100, with 100
82
+ # being the most popular.<br/>The popularity of a track is a value between 0
83
+ # and 100, with 100 being the most popular. The popularity is calculated by
84
+ # algorithm and is based, in the most part, on the total number of plays the
85
+ # track has had and how recent those plays are.<br/>Generally speaking,
86
+ # songs that are being played a lot now will have a higher popularity than
87
+ # songs that were played a lot in the past. Duplicate tracks (e.g. the same
88
+ # track from a single and an album) are rated independently. Artist and
89
+ # album popularity is derived mathematically from track popularity.
90
+ # _**Note**: the popularity value may lag actual popularity by a few days:
91
+ # the value is not updated in real time._
92
+ # @return [Integer]
93
+ attr_accessor :popularity
94
+
95
+ # A link to a 30 second preview (MP3 format) of the track. Can be `null`
96
+ # @return [String]
97
+ attr_accessor :preview_url
98
+
99
+ # The number of the track. If an album has several discs, the track number
100
+ # is the number on the specified disc.
101
+ # @return [Integer]
102
+ attr_accessor :track_number
103
+
104
+ # The object type: "track".
105
+ # @return [Type3Enum]
106
+ attr_accessor :type
107
+
108
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
109
+ # the track.
110
+ # @return [String]
111
+ attr_accessor :uri
112
+
113
+ # Whether or not the track is from a local file.
114
+ # @return [TrueClass | FalseClass]
115
+ attr_accessor :is_local
116
+
117
+ # A mapping from model property names to API property names.
118
+ def self.names
119
+ @_hash = {} if @_hash.nil?
120
+ @_hash['album'] = 'album'
121
+ @_hash['artists'] = 'artists'
122
+ @_hash['available_markets'] = 'available_markets'
123
+ @_hash['disc_number'] = 'disc_number'
124
+ @_hash['duration_ms'] = 'duration_ms'
125
+ @_hash['explicit'] = 'explicit'
126
+ @_hash['external_ids'] = 'external_ids'
127
+ @_hash['external_urls'] = 'external_urls'
128
+ @_hash['href'] = 'href'
129
+ @_hash['id'] = 'id'
130
+ @_hash['is_playable'] = 'is_playable'
131
+ @_hash['linked_from'] = 'linked_from'
132
+ @_hash['restrictions'] = 'restrictions'
133
+ @_hash['name'] = 'name'
134
+ @_hash['popularity'] = 'popularity'
135
+ @_hash['preview_url'] = 'preview_url'
136
+ @_hash['track_number'] = 'track_number'
137
+ @_hash['type'] = 'type'
138
+ @_hash['uri'] = 'uri'
139
+ @_hash['is_local'] = 'is_local'
140
+ @_hash
141
+ end
142
+
143
+ # An array for optional fields
144
+ def self.optionals
145
+ %w[
146
+ album
147
+ artists
148
+ available_markets
149
+ disc_number
150
+ duration_ms
151
+ explicit
152
+ external_ids
153
+ external_urls
154
+ href
155
+ id
156
+ is_playable
157
+ linked_from
158
+ restrictions
159
+ name
160
+ popularity
161
+ preview_url
162
+ track_number
163
+ type
164
+ uri
165
+ is_local
166
+ ]
167
+ end
168
+
169
+ # An array for nullable fields
170
+ def self.nullables
171
+ %w[
172
+ preview_url
173
+ ]
174
+ end
175
+
176
+ def initialize(album = SKIP, artists = SKIP, available_markets = SKIP,
177
+ disc_number = SKIP, duration_ms = SKIP, explicit = SKIP,
178
+ external_ids = SKIP, external_urls = SKIP, href = SKIP,
179
+ id = SKIP, is_playable = SKIP, linked_from = SKIP,
180
+ restrictions = SKIP, name = SKIP, popularity = SKIP,
181
+ preview_url = SKIP, track_number = SKIP, type = SKIP,
182
+ uri = SKIP, is_local = SKIP)
183
+ @album = album unless album == SKIP
184
+ @artists = artists unless artists == SKIP
185
+ @available_markets = available_markets unless available_markets == SKIP
186
+ @disc_number = disc_number unless disc_number == SKIP
187
+ @duration_ms = duration_ms unless duration_ms == SKIP
188
+ @explicit = explicit unless explicit == SKIP
189
+ @external_ids = external_ids unless external_ids == SKIP
190
+ @external_urls = external_urls unless external_urls == SKIP
191
+ @href = href unless href == SKIP
192
+ @id = id unless id == SKIP
193
+ @is_playable = is_playable unless is_playable == SKIP
194
+ @linked_from = linked_from unless linked_from == SKIP
195
+ @restrictions = restrictions unless restrictions == SKIP
196
+ @name = name unless name == SKIP
197
+ @popularity = popularity unless popularity == SKIP
198
+ @preview_url = preview_url unless preview_url == SKIP
199
+ @track_number = track_number unless track_number == SKIP
200
+ @type = type unless type == SKIP
201
+ @uri = uri unless uri == SKIP
202
+ @is_local = is_local unless is_local == SKIP
203
+ end
204
+
205
+ # Creates an instance of the object from a hash.
206
+ def self.from_hash(hash)
207
+ return nil unless hash
208
+
209
+ # Extract variables from the hash.
210
+ album = SimplifiedAlbumObject.from_hash(hash['album']) if hash['album']
211
+ # Parameter is an array, so we need to iterate through it
212
+ artists = nil
213
+ unless hash['artists'].nil?
214
+ artists = []
215
+ hash['artists'].each do |structure|
216
+ artists << (ArtistObject.from_hash(structure) if structure)
217
+ end
218
+ end
219
+
220
+ artists = SKIP unless hash.key?('artists')
221
+ available_markets =
222
+ hash.key?('available_markets') ? hash['available_markets'] : SKIP
223
+ disc_number = hash.key?('disc_number') ? hash['disc_number'] : SKIP
224
+ duration_ms = hash.key?('duration_ms') ? hash['duration_ms'] : SKIP
225
+ explicit = hash.key?('explicit') ? hash['explicit'] : SKIP
226
+ external_ids = ExternalIdObject.from_hash(hash['external_ids']) if hash['external_ids']
227
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
228
+ href = hash.key?('href') ? hash['href'] : SKIP
229
+ id = hash.key?('id') ? hash['id'] : SKIP
230
+ is_playable = hash.key?('is_playable') ? hash['is_playable'] : SKIP
231
+ linked_from = LinkedTrackObject.from_hash(hash['linked_from']) if hash['linked_from']
232
+ restrictions = TrackRestrictionObject.from_hash(hash['restrictions']) if
233
+ hash['restrictions']
234
+ name = hash.key?('name') ? hash['name'] : SKIP
235
+ popularity = hash.key?('popularity') ? hash['popularity'] : SKIP
236
+ preview_url = hash.key?('preview_url') ? hash['preview_url'] : SKIP
237
+ track_number = hash.key?('track_number') ? hash['track_number'] : SKIP
238
+ type = hash.key?('type') ? hash['type'] : SKIP
239
+ uri = hash.key?('uri') ? hash['uri'] : SKIP
240
+ is_local = hash.key?('is_local') ? hash['is_local'] : SKIP
241
+
242
+ # Create object from extracted values.
243
+ TrackObject.new(album,
244
+ artists,
245
+ available_markets,
246
+ disc_number,
247
+ duration_ms,
248
+ explicit,
249
+ external_ids,
250
+ external_urls,
251
+ href,
252
+ id,
253
+ is_playable,
254
+ linked_from,
255
+ restrictions,
256
+ name,
257
+ popularity,
258
+ preview_url,
259
+ track_number,
260
+ type,
261
+ uri,
262
+ is_local)
263
+ end
264
+ end
265
+ end
@@ -0,0 +1,58 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # TrackRestrictionObject Model.
8
+ class TrackRestrictionObject < 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
+ TrackRestrictionObject.new(reason)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,20 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The object type.
8
+ class Type2Enum
9
+ TYPE2_ENUM = [
10
+ # TODO: Write general description for ALBUM
11
+ ALBUM = 'album'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ TYPE2_ENUM.include?(value)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The object type: "track".
8
+ class Type3Enum
9
+ TYPE3_ENUM = [
10
+ # TODO: Write general description for TRACK
11
+ TRACK = 'track'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ TYPE3_ENUM.include?(value)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The object type.
8
+ class Type4Enum
9
+ TYPE4_ENUM = [
10
+ # TODO: Write general description for USER
11
+ USER = 'user'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ TYPE4_ENUM.include?(value)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The object type.
8
+ class Type6Enum
9
+ TYPE6_ENUM = [
10
+ # TODO: Write general description for AUDIO_FEATURES
11
+ AUDIO_FEATURES = 'audio_features'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ TYPE6_ENUM.include?(value)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The object type.
8
+ class Type7Enum
9
+ TYPE7_ENUM = [
10
+ # TODO: Write general description for SHOW
11
+ SHOW = 'show'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ TYPE7_ENUM.include?(value)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The object type.
8
+ class Type8Enum
9
+ TYPE8_ENUM = [
10
+ # TODO: Write general description for EPISODE
11
+ EPISODE = 'episode'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ TYPE8_ENUM.include?(value)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The object type.
8
+ class Type9Enum
9
+ TYPE9_ENUM = [
10
+ # TODO: Write general description for AUDIOBOOK
11
+ AUDIOBOOK = 'audiobook'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ TYPE9_ENUM.include?(value)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The object type.
8
+ class TypeEnum
9
+ TYPE_ENUM = [
10
+ # TODO: Write general description for ARTIST
11
+ ARTIST = 'artist'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ TYPE_ENUM.include?(value)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,87 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # UsersPlaylistsRequest Model.
8
+ class UsersPlaylistsRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The name for the new playlist, for example `"Your Coolest Playlist"`. This
13
+ # name does not need to be unique; a user may have several playlists with
14
+ # the same name.
15
+ # @return [String]
16
+ attr_accessor :name
17
+
18
+ # Defaults to `true`. If `true` the playlist will be public, if `false` it
19
+ # will be private. To be able to create private playlists, the user must
20
+ # have granted the `playlist-modify-private`
21
+ # [scope](/documentation/web-api/concepts/scopes/#list-of-scopes)
22
+ # @return [TrueClass | FalseClass]
23
+ attr_accessor :public
24
+
25
+ # Defaults to `false`. If `true` the playlist will be collaborative.
26
+ # _**Note**: to create a collaborative playlist you must also set `public`
27
+ # to `false`. To create collaborative playlists you must have granted
28
+ # `playlist-modify-private` and `playlist-modify-public`
29
+ # [scopes](/documentation/web-api/concepts/scopes/#list-of-scopes)._
30
+ # @return [TrueClass | FalseClass]
31
+ attr_accessor :collaborative
32
+
33
+ # value for playlist description as displayed in Spotify Clients and in the
34
+ # Web API.
35
+ # @return [String]
36
+ attr_accessor :description
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['name'] = 'name'
42
+ @_hash['public'] = 'public'
43
+ @_hash['collaborative'] = 'collaborative'
44
+ @_hash['description'] = 'description'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ public
52
+ collaborative
53
+ description
54
+ ]
55
+ end
56
+
57
+ # An array for nullable fields
58
+ def self.nullables
59
+ []
60
+ end
61
+
62
+ def initialize(name = nil, public = SKIP, collaborative = SKIP,
63
+ description = SKIP)
64
+ @name = name
65
+ @public = public unless public == SKIP
66
+ @collaborative = collaborative unless collaborative == SKIP
67
+ @description = description unless description == SKIP
68
+ end
69
+
70
+ # Creates an instance of the object from a hash.
71
+ def self.from_hash(hash)
72
+ return nil unless hash
73
+
74
+ # Extract variables from the hash.
75
+ name = hash.key?('name') ? hash['name'] : nil
76
+ public = hash.key?('public') ? hash['public'] : SKIP
77
+ collaborative = hash.key?('collaborative') ? hash['collaborative'] : SKIP
78
+ description = hash.key?('description') ? hash['description'] : SKIP
79
+
80
+ # Create object from extracted values.
81
+ UsersPlaylistsRequest.new(name,
82
+ public,
83
+ collaborative,
84
+ description)
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,11 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module SpotifyWebApi
8
+ # A utility that supports dateTime conversion to different formats
9
+ class DateTimeHelper < CoreLibrary::DateTimeHelper
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # A utility to allow users to set the content-type for files
8
+ class FileWrapper < CoreLibrary::FileWrapper
9
+ # The constructor.
10
+ # @param [File] file The file to be sent in the request.
11
+ # @param [string] content_type The content type of the provided file.
12
+ def initialize(file, content_type: 'application/octet-stream')
13
+ super
14
+ end
15
+ end
16
+ end