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,219 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # ShowObject Model.
8
+ class ShowObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A list of the countries in which the show can be played, identified by
13
+ # their [ISO 3166-1
14
+ # alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
15
+ # @return [Array[String]]
16
+ attr_accessor :available_markets
17
+
18
+ # The copyright statements of the show.
19
+ # @return [Array[CopyrightObject]]
20
+ attr_accessor :copyrights
21
+
22
+ # A description of the show. HTML tags are stripped away from this field,
23
+ # use `html_description` field in case HTML tags are needed.
24
+ # @return [String]
25
+ attr_accessor :description
26
+
27
+ # A description of the show. This field may contain HTML tags.
28
+ # @return [String]
29
+ attr_accessor :html_description
30
+
31
+ # Whether or not the show has explicit content (true = yes it does; false =
32
+ # no it does not OR unknown).
33
+ # @return [TrueClass | FalseClass]
34
+ attr_accessor :explicit
35
+
36
+ # External URLs for this show.
37
+ # @return [ExternalUrlObject]
38
+ attr_accessor :external_urls
39
+
40
+ # A link to the Web API endpoint providing full details of the show.
41
+ # @return [String]
42
+ attr_accessor :href
43
+
44
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
45
+ # show.
46
+ # @return [String]
47
+ attr_accessor :id
48
+
49
+ # The cover art for the show in various sizes, widest first.
50
+ # @return [Array[ImageObject]]
51
+ attr_accessor :images
52
+
53
+ # True if all of the shows episodes are hosted outside of Spotify's CDN.
54
+ # This field might be `null` in some cases.
55
+ # @return [TrueClass | FalseClass]
56
+ attr_accessor :is_externally_hosted
57
+
58
+ # A list of the languages used in the show, identified by their [ISO
59
+ # 639](https://en.wikipedia.org/wiki/ISO_639) code.
60
+ # @return [Array[String]]
61
+ attr_accessor :languages
62
+
63
+ # The media type of the show.
64
+ # @return [String]
65
+ attr_accessor :media_type
66
+
67
+ # The name of the episode.
68
+ # @return [String]
69
+ attr_accessor :name
70
+
71
+ # The publisher of the show.
72
+ # @return [String]
73
+ attr_accessor :publisher
74
+
75
+ # The object type.
76
+ # @return [Type7Enum]
77
+ attr_accessor :type
78
+
79
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
80
+ # the show.
81
+ # @return [String]
82
+ attr_accessor :uri
83
+
84
+ # The total number of episodes in the show.
85
+ # @return [Integer]
86
+ attr_accessor :total_episodes
87
+
88
+ # The episodes of the show.
89
+ # @return [PagingSimplifiedEpisodeObject]
90
+ attr_accessor :episodes
91
+
92
+ # A mapping from model property names to API property names.
93
+ def self.names
94
+ @_hash = {} if @_hash.nil?
95
+ @_hash['available_markets'] = 'available_markets'
96
+ @_hash['copyrights'] = 'copyrights'
97
+ @_hash['description'] = 'description'
98
+ @_hash['html_description'] = 'html_description'
99
+ @_hash['explicit'] = 'explicit'
100
+ @_hash['external_urls'] = 'external_urls'
101
+ @_hash['href'] = 'href'
102
+ @_hash['id'] = 'id'
103
+ @_hash['images'] = 'images'
104
+ @_hash['is_externally_hosted'] = 'is_externally_hosted'
105
+ @_hash['languages'] = 'languages'
106
+ @_hash['media_type'] = 'media_type'
107
+ @_hash['name'] = 'name'
108
+ @_hash['publisher'] = 'publisher'
109
+ @_hash['type'] = 'type'
110
+ @_hash['uri'] = 'uri'
111
+ @_hash['total_episodes'] = 'total_episodes'
112
+ @_hash['episodes'] = 'episodes'
113
+ @_hash
114
+ end
115
+
116
+ # An array for optional fields
117
+ def self.optionals
118
+ []
119
+ end
120
+
121
+ # An array for nullable fields
122
+ def self.nullables
123
+ []
124
+ end
125
+
126
+ def initialize(available_markets = nil, copyrights = nil, description = nil,
127
+ html_description = nil, explicit = nil, external_urls = nil,
128
+ href = nil, id = nil, images = nil,
129
+ is_externally_hosted = nil, languages = nil,
130
+ media_type = nil, name = nil, publisher = nil, type = nil,
131
+ uri = nil, total_episodes = nil, episodes = nil)
132
+ @available_markets = available_markets
133
+ @copyrights = copyrights
134
+ @description = description
135
+ @html_description = html_description
136
+ @explicit = explicit
137
+ @external_urls = external_urls
138
+ @href = href
139
+ @id = id
140
+ @images = images
141
+ @is_externally_hosted = is_externally_hosted
142
+ @languages = languages
143
+ @media_type = media_type
144
+ @name = name
145
+ @publisher = publisher
146
+ @type = type
147
+ @uri = uri
148
+ @total_episodes = total_episodes
149
+ @episodes = episodes
150
+ end
151
+
152
+ # Creates an instance of the object from a hash.
153
+ def self.from_hash(hash)
154
+ return nil unless hash
155
+
156
+ # Extract variables from the hash.
157
+ available_markets =
158
+ hash.key?('available_markets') ? hash['available_markets'] : nil
159
+ # Parameter is an array, so we need to iterate through it
160
+ copyrights = nil
161
+ unless hash['copyrights'].nil?
162
+ copyrights = []
163
+ hash['copyrights'].each do |structure|
164
+ copyrights << (CopyrightObject.from_hash(structure) if structure)
165
+ end
166
+ end
167
+
168
+ copyrights = nil unless hash.key?('copyrights')
169
+ description = hash.key?('description') ? hash['description'] : nil
170
+ html_description =
171
+ hash.key?('html_description') ? hash['html_description'] : nil
172
+ explicit = hash.key?('explicit') ? hash['explicit'] : nil
173
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
174
+ href = hash.key?('href') ? hash['href'] : nil
175
+ id = hash.key?('id') ? hash['id'] : nil
176
+ # Parameter is an array, so we need to iterate through it
177
+ images = nil
178
+ unless hash['images'].nil?
179
+ images = []
180
+ hash['images'].each do |structure|
181
+ images << (ImageObject.from_hash(structure) if structure)
182
+ end
183
+ end
184
+
185
+ images = nil unless hash.key?('images')
186
+ is_externally_hosted =
187
+ hash.key?('is_externally_hosted') ? hash['is_externally_hosted'] : nil
188
+ languages = hash.key?('languages') ? hash['languages'] : nil
189
+ media_type = hash.key?('media_type') ? hash['media_type'] : nil
190
+ name = hash.key?('name') ? hash['name'] : nil
191
+ publisher = hash.key?('publisher') ? hash['publisher'] : nil
192
+ type = hash.key?('type') ? hash['type'] : nil
193
+ uri = hash.key?('uri') ? hash['uri'] : nil
194
+ total_episodes =
195
+ hash.key?('total_episodes') ? hash['total_episodes'] : nil
196
+ episodes = PagingSimplifiedEpisodeObject.from_hash(hash['episodes']) if hash['episodes']
197
+
198
+ # Create object from extracted values.
199
+ ShowObject.new(available_markets,
200
+ copyrights,
201
+ description,
202
+ html_description,
203
+ explicit,
204
+ external_urls,
205
+ href,
206
+ id,
207
+ images,
208
+ is_externally_hosted,
209
+ languages,
210
+ media_type,
211
+ name,
212
+ publisher,
213
+ type,
214
+ uri,
215
+ total_episodes,
216
+ episodes)
217
+ end
218
+ end
219
+ end
@@ -0,0 +1,186 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # SimplifiedAlbumObject Model.
8
+ class SimplifiedAlbumObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The type of the album.
13
+ # @return [AlbumTypeEnum]
14
+ attr_accessor :album_type
15
+
16
+ # The number of tracks in the album.
17
+ # @return [Integer]
18
+ attr_accessor :total_tracks
19
+
20
+ # The markets in which the album is available: [ISO 3166-1 alpha-2 country
21
+ # codes](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). _**NOTE**: an
22
+ # album is considered available in a market when at least 1 of its tracks is
23
+ # available in that market._
24
+ # @return [Array[String]]
25
+ attr_accessor :available_markets
26
+
27
+ # Known external URLs for this album.
28
+ # @return [ExternalUrlObject]
29
+ attr_accessor :external_urls
30
+
31
+ # A link to the Web API endpoint providing full details of the album.
32
+ # @return [String]
33
+ attr_accessor :href
34
+
35
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
36
+ # album.
37
+ # @return [String]
38
+ attr_accessor :id
39
+
40
+ # The cover art for the album in various sizes, widest first.
41
+ # @return [Array[ImageObject]]
42
+ attr_accessor :images
43
+
44
+ # The name of the album. In case of an album takedown, the value may be an
45
+ # empty string.
46
+ # @return [String]
47
+ attr_accessor :name
48
+
49
+ # The date the album was first released.
50
+ # @return [String]
51
+ attr_accessor :release_date
52
+
53
+ # The precision with which `release_date` value is known.
54
+ # @return [ReleaseDatePrecisionEnum]
55
+ attr_accessor :release_date_precision
56
+
57
+ # Included in the response when a content restriction is applied.
58
+ # @return [AlbumRestrictionObject]
59
+ attr_accessor :restrictions
60
+
61
+ # The object type.
62
+ # @return [Type2Enum]
63
+ attr_accessor :type
64
+
65
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
66
+ # the album.
67
+ # @return [String]
68
+ attr_accessor :uri
69
+
70
+ # The artists of the album. Each artist object includes a link in `href` to
71
+ # more detailed information about the artist.
72
+ # @return [Array[SimplifiedArtistObject]]
73
+ attr_accessor :artists
74
+
75
+ # A mapping from model property names to API property names.
76
+ def self.names
77
+ @_hash = {} if @_hash.nil?
78
+ @_hash['album_type'] = 'album_type'
79
+ @_hash['total_tracks'] = 'total_tracks'
80
+ @_hash['available_markets'] = 'available_markets'
81
+ @_hash['external_urls'] = 'external_urls'
82
+ @_hash['href'] = 'href'
83
+ @_hash['id'] = 'id'
84
+ @_hash['images'] = 'images'
85
+ @_hash['name'] = 'name'
86
+ @_hash['release_date'] = 'release_date'
87
+ @_hash['release_date_precision'] = 'release_date_precision'
88
+ @_hash['restrictions'] = 'restrictions'
89
+ @_hash['type'] = 'type'
90
+ @_hash['uri'] = 'uri'
91
+ @_hash['artists'] = 'artists'
92
+ @_hash
93
+ end
94
+
95
+ # An array for optional fields
96
+ def self.optionals
97
+ %w[
98
+ restrictions
99
+ ]
100
+ end
101
+
102
+ # An array for nullable fields
103
+ def self.nullables
104
+ []
105
+ end
106
+
107
+ def initialize(album_type = nil, total_tracks = nil,
108
+ available_markets = nil, external_urls = nil, href = nil,
109
+ id = nil, images = nil, name = nil, release_date = nil,
110
+ release_date_precision = nil, type = nil, uri = nil,
111
+ artists = nil, restrictions = SKIP)
112
+ @album_type = album_type
113
+ @total_tracks = total_tracks
114
+ @available_markets = available_markets
115
+ @external_urls = external_urls
116
+ @href = href
117
+ @id = id
118
+ @images = images
119
+ @name = name
120
+ @release_date = release_date
121
+ @release_date_precision = release_date_precision
122
+ @restrictions = restrictions unless restrictions == SKIP
123
+ @type = type
124
+ @uri = uri
125
+ @artists = artists
126
+ end
127
+
128
+ # Creates an instance of the object from a hash.
129
+ def self.from_hash(hash)
130
+ return nil unless hash
131
+
132
+ # Extract variables from the hash.
133
+ album_type = hash.key?('album_type') ? hash['album_type'] : nil
134
+ total_tracks = hash.key?('total_tracks') ? hash['total_tracks'] : nil
135
+ available_markets =
136
+ hash.key?('available_markets') ? hash['available_markets'] : nil
137
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
138
+ href = hash.key?('href') ? hash['href'] : nil
139
+ id = hash.key?('id') ? hash['id'] : nil
140
+ # Parameter is an array, so we need to iterate through it
141
+ images = nil
142
+ unless hash['images'].nil?
143
+ images = []
144
+ hash['images'].each do |structure|
145
+ images << (ImageObject.from_hash(structure) if structure)
146
+ end
147
+ end
148
+
149
+ images = nil unless hash.key?('images')
150
+ name = hash.key?('name') ? hash['name'] : nil
151
+ release_date = hash.key?('release_date') ? hash['release_date'] : nil
152
+ release_date_precision =
153
+ hash.key?('release_date_precision') ? hash['release_date_precision'] : nil
154
+ type = hash.key?('type') ? hash['type'] : nil
155
+ uri = hash.key?('uri') ? hash['uri'] : nil
156
+ # Parameter is an array, so we need to iterate through it
157
+ artists = nil
158
+ unless hash['artists'].nil?
159
+ artists = []
160
+ hash['artists'].each do |structure|
161
+ artists << (SimplifiedArtistObject.from_hash(structure) if structure)
162
+ end
163
+ end
164
+
165
+ artists = nil unless hash.key?('artists')
166
+ restrictions = AlbumRestrictionObject.from_hash(hash['restrictions']) if
167
+ hash['restrictions']
168
+
169
+ # Create object from extracted values.
170
+ SimplifiedAlbumObject.new(album_type,
171
+ total_tracks,
172
+ available_markets,
173
+ external_urls,
174
+ href,
175
+ id,
176
+ images,
177
+ name,
178
+ release_date,
179
+ release_date_precision,
180
+ type,
181
+ uri,
182
+ artists,
183
+ restrictions)
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,98 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # SimplifiedArtistObject Model.
8
+ class SimplifiedArtistObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Known external URLs for this artist.
13
+ # @return [ExternalUrlObject]
14
+ attr_accessor :external_urls
15
+
16
+ # A link to the Web API endpoint providing full details of the artist.
17
+ # @return [String]
18
+ attr_accessor :href
19
+
20
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
21
+ # artist.
22
+ # @return [String]
23
+ attr_accessor :id
24
+
25
+ # The name of the artist.
26
+ # @return [String]
27
+ attr_accessor :name
28
+
29
+ # The object type.
30
+ # @return [TypeEnum]
31
+ attr_accessor :type
32
+
33
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
34
+ # the artist.
35
+ # @return [String]
36
+ attr_accessor :uri
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['external_urls'] = 'external_urls'
42
+ @_hash['href'] = 'href'
43
+ @_hash['id'] = 'id'
44
+ @_hash['name'] = 'name'
45
+ @_hash['type'] = 'type'
46
+ @_hash['uri'] = 'uri'
47
+ @_hash
48
+ end
49
+
50
+ # An array for optional fields
51
+ def self.optionals
52
+ %w[
53
+ external_urls
54
+ href
55
+ id
56
+ name
57
+ type
58
+ uri
59
+ ]
60
+ end
61
+
62
+ # An array for nullable fields
63
+ def self.nullables
64
+ []
65
+ end
66
+
67
+ def initialize(external_urls = SKIP, href = SKIP, id = SKIP, name = SKIP,
68
+ type = SKIP, uri = SKIP)
69
+ @external_urls = external_urls unless external_urls == SKIP
70
+ @href = href unless href == SKIP
71
+ @id = id unless id == SKIP
72
+ @name = name unless name == SKIP
73
+ @type = type unless type == SKIP
74
+ @uri = uri unless uri == SKIP
75
+ end
76
+
77
+ # Creates an instance of the object from a hash.
78
+ def self.from_hash(hash)
79
+ return nil unless hash
80
+
81
+ # Extract variables from the hash.
82
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
83
+ href = hash.key?('href') ? hash['href'] : SKIP
84
+ id = hash.key?('id') ? hash['id'] : SKIP
85
+ name = hash.key?('name') ? hash['name'] : SKIP
86
+ type = hash.key?('type') ? hash['type'] : SKIP
87
+ uri = hash.key?('uri') ? hash['uri'] : SKIP
88
+
89
+ # Create object from extracted values.
90
+ SimplifiedArtistObject.new(external_urls,
91
+ href,
92
+ id,
93
+ name,
94
+ type,
95
+ uri)
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,184 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # SimplifiedPlaylistObject Model.
8
+ class SimplifiedPlaylistObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # `true` if the owner allows other users to modify the playlist.
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :collaborative
15
+
16
+ # The playlist description. _Only returned for modified, verified playlists,
17
+ # otherwise_ `null`.
18
+ # @return [String]
19
+ attr_accessor :description
20
+
21
+ # Known external URLs for this playlist.
22
+ # @return [ExternalUrlObject]
23
+ attr_accessor :external_urls
24
+
25
+ # A link to the Web API endpoint providing full details of the playlist.
26
+ # @return [String]
27
+ attr_accessor :href
28
+
29
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
30
+ # playlist.
31
+ # @return [String]
32
+ attr_accessor :id
33
+
34
+ # Images for the playlist. The array may be empty or contain up to three
35
+ # images. The images are returned by size in descending order. See [Working
36
+ # with Playlists](/documentation/web-api/concepts/playlists). _**Note**: If
37
+ # returned, the source URL for the image (`url`) is temporary and will
38
+ # expire in less than a day._
39
+ # @return [Array[ImageObject]]
40
+ attr_accessor :images
41
+
42
+ # The name of the playlist.
43
+ # @return [String]
44
+ attr_accessor :name
45
+
46
+ # The user who owns the playlist
47
+ # @return [PlaylistOwnerObject]
48
+ attr_accessor :owner
49
+
50
+ # The playlist's public/private status: `true` the playlist is public,
51
+ # `false` the playlist is private, `null` the playlist status is not
52
+ # relevant. For more about public/private status, see [Working with
53
+ # Playlists](/documentation/web-api/concepts/playlists)
54
+ # @return [TrueClass | FalseClass]
55
+ attr_accessor :public
56
+
57
+ # The version identifier for the current playlist. Can be supplied in other
58
+ # requests to target a specific playlist version
59
+ # @return [String]
60
+ attr_accessor :snapshot_id
61
+
62
+ # A collection containing a link ( `href` ) to the Web API endpoint where
63
+ # full details of the playlist's tracks can be retrieved, along with the
64
+ # `total` number of tracks in the playlist. Note, a track object may be
65
+ # `null`. This can happen if a track is no longer available.
66
+ # @return [PlaylistTracksRefObject]
67
+ attr_accessor :tracks
68
+
69
+ # The object type: "playlist"
70
+ # @return [String]
71
+ attr_accessor :type
72
+
73
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
74
+ # the playlist.
75
+ # @return [String]
76
+ attr_accessor :uri
77
+
78
+ # A mapping from model property names to API property names.
79
+ def self.names
80
+ @_hash = {} if @_hash.nil?
81
+ @_hash['collaborative'] = 'collaborative'
82
+ @_hash['description'] = 'description'
83
+ @_hash['external_urls'] = 'external_urls'
84
+ @_hash['href'] = 'href'
85
+ @_hash['id'] = 'id'
86
+ @_hash['images'] = 'images'
87
+ @_hash['name'] = 'name'
88
+ @_hash['owner'] = 'owner'
89
+ @_hash['public'] = 'public'
90
+ @_hash['snapshot_id'] = 'snapshot_id'
91
+ @_hash['tracks'] = 'tracks'
92
+ @_hash['type'] = 'type'
93
+ @_hash['uri'] = 'uri'
94
+ @_hash
95
+ end
96
+
97
+ # An array for optional fields
98
+ def self.optionals
99
+ %w[
100
+ collaborative
101
+ description
102
+ external_urls
103
+ href
104
+ id
105
+ images
106
+ name
107
+ owner
108
+ public
109
+ snapshot_id
110
+ tracks
111
+ type
112
+ uri
113
+ ]
114
+ end
115
+
116
+ # An array for nullable fields
117
+ def self.nullables
118
+ []
119
+ end
120
+
121
+ def initialize(collaborative = SKIP, description = SKIP,
122
+ external_urls = SKIP, href = SKIP, id = SKIP, images = SKIP,
123
+ name = SKIP, owner = SKIP, public = SKIP, snapshot_id = SKIP,
124
+ tracks = SKIP, type = SKIP, uri = SKIP)
125
+ @collaborative = collaborative unless collaborative == SKIP
126
+ @description = description unless description == SKIP
127
+ @external_urls = external_urls unless external_urls == SKIP
128
+ @href = href unless href == SKIP
129
+ @id = id unless id == SKIP
130
+ @images = images unless images == SKIP
131
+ @name = name unless name == SKIP
132
+ @owner = owner unless owner == SKIP
133
+ @public = public unless public == SKIP
134
+ @snapshot_id = snapshot_id unless snapshot_id == SKIP
135
+ @tracks = tracks unless tracks == SKIP
136
+ @type = type unless type == SKIP
137
+ @uri = uri unless uri == SKIP
138
+ end
139
+
140
+ # Creates an instance of the object from a hash.
141
+ def self.from_hash(hash)
142
+ return nil unless hash
143
+
144
+ # Extract variables from the hash.
145
+ collaborative = hash.key?('collaborative') ? hash['collaborative'] : SKIP
146
+ description = hash.key?('description') ? hash['description'] : SKIP
147
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
148
+ href = hash.key?('href') ? hash['href'] : SKIP
149
+ id = hash.key?('id') ? hash['id'] : SKIP
150
+ # Parameter is an array, so we need to iterate through it
151
+ images = nil
152
+ unless hash['images'].nil?
153
+ images = []
154
+ hash['images'].each do |structure|
155
+ images << (ImageObject.from_hash(structure) if structure)
156
+ end
157
+ end
158
+
159
+ images = SKIP unless hash.key?('images')
160
+ name = hash.key?('name') ? hash['name'] : SKIP
161
+ owner = PlaylistOwnerObject.from_hash(hash['owner']) if hash['owner']
162
+ public = hash.key?('public') ? hash['public'] : SKIP
163
+ snapshot_id = hash.key?('snapshot_id') ? hash['snapshot_id'] : SKIP
164
+ tracks = PlaylistTracksRefObject.from_hash(hash['tracks']) if hash['tracks']
165
+ type = hash.key?('type') ? hash['type'] : SKIP
166
+ uri = hash.key?('uri') ? hash['uri'] : SKIP
167
+
168
+ # Create object from extracted values.
169
+ SimplifiedPlaylistObject.new(collaborative,
170
+ description,
171
+ external_urls,
172
+ href,
173
+ id,
174
+ images,
175
+ name,
176
+ owner,
177
+ public,
178
+ snapshot_id,
179
+ tracks,
180
+ type,
181
+ uri)
182
+ end
183
+ end
184
+ end