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,273 @@
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
+ # ChapterObject Model.
8
+ class ChapterObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A URL to a 30 second preview (MP3 format) of the chapter. `null` if not
13
+ # available.
14
+ # @return [String]
15
+ attr_accessor :audio_preview_url
16
+
17
+ # A list of the countries in which the chapter can be played, identified by
18
+ # their [ISO 3166-1
19
+ # alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
20
+ # @return [Array[String]]
21
+ attr_accessor :available_markets
22
+
23
+ # The number of the chapter
24
+ # @return [Integer]
25
+ attr_accessor :chapter_number
26
+
27
+ # A description of the chapter. HTML tags are stripped away from this field,
28
+ # use `html_description` field in case HTML tags are needed.
29
+ # @return [String]
30
+ attr_accessor :description
31
+
32
+ # A description of the chapter. This field may contain HTML tags.
33
+ # @return [String]
34
+ attr_accessor :html_description
35
+
36
+ # The chapter length in milliseconds.
37
+ # @return [Integer]
38
+ attr_accessor :duration_ms
39
+
40
+ # Whether or not the chapter has explicit content (true = yes it does; false
41
+ # = no it does not OR unknown).
42
+ # @return [TrueClass | FalseClass]
43
+ attr_accessor :explicit
44
+
45
+ # External URLs for this chapter.
46
+ # @return [ExternalUrlObject]
47
+ attr_accessor :external_urls
48
+
49
+ # A link to the Web API endpoint providing full details of the chapter.
50
+ # @return [String]
51
+ attr_accessor :href
52
+
53
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
54
+ # chapter.
55
+ # @return [String]
56
+ attr_accessor :id
57
+
58
+ # The cover art for the chapter in various sizes, widest first.
59
+ # @return [Array[ImageObject]]
60
+ attr_accessor :images
61
+
62
+ # True if the chapter is playable in the given market. Otherwise false.
63
+ # @return [TrueClass | FalseClass]
64
+ attr_accessor :is_playable
65
+
66
+ # A list of the languages used in the chapter, identified by their [ISO
67
+ # 639-1](https://en.wikipedia.org/wiki/ISO_639) code.
68
+ # @return [Array[String]]
69
+ attr_accessor :languages
70
+
71
+ # The name of the chapter.
72
+ # @return [String]
73
+ attr_accessor :name
74
+
75
+ # The date the chapter was first released, for example `"1981-12-15"`.
76
+ # Depending on the precision, it might be shown as `"1981"` or `"1981-12"`.
77
+ # @return [String]
78
+ attr_accessor :release_date
79
+
80
+ # The precision with which `release_date` value is known.
81
+ # @return [ReleaseDatePrecisionEnum]
82
+ attr_accessor :release_date_precision
83
+
84
+ # The user's most recent position in the chapter. Set if the supplied access
85
+ # token is a user token and has the scope 'user-read-playback-position'.
86
+ # @return [ResumePointObject]
87
+ attr_accessor :resume_point
88
+
89
+ # The object type.
90
+ # @return [Type5Enum]
91
+ attr_accessor :type
92
+
93
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
94
+ # the chapter.
95
+ # @return [String]
96
+ attr_accessor :uri
97
+
98
+ # Included in the response when a content restriction is applied.
99
+ # @return [ChapterRestrictionObject]
100
+ attr_accessor :restrictions
101
+
102
+ # The audiobook for which the chapter belongs.
103
+ # @return [AudiobookBase]
104
+ attr_accessor :audiobook
105
+
106
+ # A mapping from model property names to API property names.
107
+ def self.names
108
+ @_hash = {} if @_hash.nil?
109
+ @_hash['audio_preview_url'] = 'audio_preview_url'
110
+ @_hash['available_markets'] = 'available_markets'
111
+ @_hash['chapter_number'] = 'chapter_number'
112
+ @_hash['description'] = 'description'
113
+ @_hash['html_description'] = 'html_description'
114
+ @_hash['duration_ms'] = 'duration_ms'
115
+ @_hash['explicit'] = 'explicit'
116
+ @_hash['external_urls'] = 'external_urls'
117
+ @_hash['href'] = 'href'
118
+ @_hash['id'] = 'id'
119
+ @_hash['images'] = 'images'
120
+ @_hash['is_playable'] = 'is_playable'
121
+ @_hash['languages'] = 'languages'
122
+ @_hash['name'] = 'name'
123
+ @_hash['release_date'] = 'release_date'
124
+ @_hash['release_date_precision'] = 'release_date_precision'
125
+ @_hash['resume_point'] = 'resume_point'
126
+ @_hash['type'] = 'type'
127
+ @_hash['uri'] = 'uri'
128
+ @_hash['restrictions'] = 'restrictions'
129
+ @_hash['audiobook'] = 'audiobook'
130
+ @_hash
131
+ end
132
+
133
+ # An array for optional fields
134
+ def self.optionals
135
+ %w[
136
+ available_markets
137
+ resume_point
138
+ restrictions
139
+ ]
140
+ end
141
+
142
+ # An array for nullable fields
143
+ def self.nullables
144
+ %w[
145
+ audio_preview_url
146
+ ]
147
+ end
148
+
149
+ def initialize(audio_preview_url = nil, chapter_number = nil,
150
+ description = nil, html_description = nil, duration_ms = nil,
151
+ explicit = nil, external_urls = nil, href = nil, id = nil,
152
+ images = nil, is_playable = nil, languages = nil, name = nil,
153
+ release_date = nil, release_date_precision = nil, type = nil,
154
+ uri = nil, audiobook = nil, available_markets = SKIP,
155
+ resume_point = SKIP, restrictions = SKIP)
156
+ @audio_preview_url = audio_preview_url
157
+ @available_markets = available_markets unless available_markets == SKIP
158
+ @chapter_number = chapter_number
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_playable = is_playable
168
+ @languages = languages
169
+ @name = name
170
+ @release_date = release_date
171
+ @release_date_precision = release_date_precision
172
+ @resume_point = resume_point unless resume_point == SKIP
173
+ @type = type
174
+ @uri = uri
175
+ @restrictions = restrictions unless restrictions == SKIP
176
+ @audiobook = audiobook
177
+ end
178
+
179
+ # Creates an instance of the object from a hash.
180
+ def self.from_hash(hash)
181
+ return nil unless hash
182
+
183
+ # Extract variables from the hash.
184
+ audio_preview_url =
185
+ hash.key?('audio_preview_url') ? hash['audio_preview_url'] : nil
186
+ chapter_number =
187
+ hash.key?('chapter_number') ? hash['chapter_number'] : 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_playable = hash.key?('is_playable') ? hash['is_playable'] : nil
207
+ languages = hash.key?('languages') ? hash['languages'] : nil
208
+ name = hash.key?('name') ? hash['name'] : nil
209
+ release_date = hash.key?('release_date') ? hash['release_date'] : nil
210
+ release_date_precision =
211
+ hash.key?('release_date_precision') ? hash['release_date_precision'] : nil
212
+ type = hash.key?('type') ? hash['type'] : nil
213
+ uri = hash.key?('uri') ? hash['uri'] : nil
214
+ audiobook = AudiobookBase.from_hash(hash['audiobook']) if hash['audiobook']
215
+ available_markets =
216
+ hash.key?('available_markets') ? hash['available_markets'] : SKIP
217
+ resume_point = ResumePointObject.from_hash(hash['resume_point']) if hash['resume_point']
218
+ restrictions = ChapterRestrictionObject.from_hash(hash['restrictions']) if
219
+ hash['restrictions']
220
+
221
+ # Create object from extracted values.
222
+ ChapterObject.new(audio_preview_url,
223
+ chapter_number,
224
+ description,
225
+ html_description,
226
+ duration_ms,
227
+ explicit,
228
+ external_urls,
229
+ href,
230
+ id,
231
+ images,
232
+ is_playable,
233
+ languages,
234
+ name,
235
+ release_date,
236
+ release_date_precision,
237
+ type,
238
+ uri,
239
+ audiobook,
240
+ available_markets,
241
+ resume_point,
242
+ restrictions)
243
+ end
244
+
245
+ # Provides a human-readable string representation of the object.
246
+ def to_s
247
+ class_name = self.class.name.split('::').last
248
+ "<#{class_name} audio_preview_url: #{@audio_preview_url}, available_markets:"\
249
+ " #{@available_markets}, chapter_number: #{@chapter_number}, description: #{@description},"\
250
+ " html_description: #{@html_description}, duration_ms: #{@duration_ms}, explicit:"\
251
+ " #{@explicit}, external_urls: #{@external_urls}, href: #{@href}, id: #{@id}, images:"\
252
+ " #{@images}, is_playable: #{@is_playable}, languages: #{@languages}, name: #{@name},"\
253
+ " release_date: #{@release_date}, release_date_precision: #{@release_date_precision},"\
254
+ " resume_point: #{@resume_point}, type: #{@type}, uri: #{@uri}, restrictions:"\
255
+ " #{@restrictions}, audiobook: #{@audiobook}>"
256
+ end
257
+
258
+ # Provides a debugging-friendly string with detailed object information.
259
+ def inspect
260
+ class_name = self.class.name.split('::').last
261
+ "<#{class_name} audio_preview_url: #{@audio_preview_url.inspect}, available_markets:"\
262
+ " #{@available_markets.inspect}, chapter_number: #{@chapter_number.inspect}, description:"\
263
+ " #{@description.inspect}, html_description: #{@html_description.inspect}, duration_ms:"\
264
+ " #{@duration_ms.inspect}, explicit: #{@explicit.inspect}, external_urls:"\
265
+ " #{@external_urls.inspect}, href: #{@href.inspect}, id: #{@id.inspect}, images:"\
266
+ " #{@images.inspect}, is_playable: #{@is_playable.inspect}, languages:"\
267
+ " #{@languages.inspect}, name: #{@name.inspect}, release_date: #{@release_date.inspect},"\
268
+ " release_date_precision: #{@release_date_precision.inspect}, resume_point:"\
269
+ " #{@resume_point.inspect}, type: #{@type.inspect}, uri: #{@uri.inspect}, restrictions:"\
270
+ " #{@restrictions.inspect}, audiobook: #{@audiobook.inspect}>"
271
+ end
272
+ end
273
+ 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
+ # ChapterRestrictionObject Model.
8
+ class ChapterRestrictionObject < 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
+ # - `payment_required` - Payment is required to play the content item.
19
+ # Additional reasons may be added in the future.
20
+ # **Note**: If you use this field, make sure that your application safely
21
+ # handles unknown values.
22
+ # @return [String]
23
+ attr_accessor :reason
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['reason'] = 'reason'
29
+ @_hash
30
+ end
31
+
32
+ # An array for optional fields
33
+ def self.optionals
34
+ %w[
35
+ reason
36
+ ]
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(reason = SKIP)
45
+ @reason = reason unless reason == SKIP
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ reason = hash.key?('reason') ? hash['reason'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ ChapterRestrictionObject.new(reason)
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} reason: #{@reason}>"
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} reason: #{@reason.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,102 @@
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
+ # ContextObject Model.
8
+ class ContextObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The object type, e.g. "artist", "playlist", "album", "show".
13
+ # @return [String]
14
+ attr_accessor :type
15
+
16
+ # A link to the Web API endpoint providing full details of the track.
17
+ # @return [String]
18
+ attr_accessor :href
19
+
20
+ # External URLs for this context.
21
+ # @return [ExternalUrlObject]
22
+ attr_accessor :external_urls
23
+
24
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
25
+ # the context.
26
+ # @return [String]
27
+ attr_accessor :uri
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['type'] = 'type'
33
+ @_hash['href'] = 'href'
34
+ @_hash['external_urls'] = 'external_urls'
35
+ @_hash['uri'] = 'uri'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ %w[
42
+ type
43
+ href
44
+ external_urls
45
+ uri
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(type = SKIP, href = SKIP, external_urls = SKIP, uri = SKIP)
55
+ @type = type unless type == SKIP
56
+ @href = href unless href == SKIP
57
+ @external_urls = external_urls unless external_urls == SKIP
58
+ @uri = uri unless uri == SKIP
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ type = hash.key?('type') ? hash['type'] : SKIP
67
+ href = hash.key?('href') ? hash['href'] : SKIP
68
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
69
+ uri = hash.key?('uri') ? hash['uri'] : SKIP
70
+
71
+ # Create object from extracted values.
72
+ ContextObject.new(type,
73
+ href,
74
+ external_urls,
75
+ uri)
76
+ end
77
+
78
+ # Validates an instance of the object from a given value.
79
+ # @param [ContextObject | Hash] The value against the validation is performed.
80
+ def self.validate(value)
81
+ return true if value.instance_of? self
82
+
83
+ return false unless value.instance_of? Hash
84
+
85
+ true
86
+ end
87
+
88
+ # Provides a human-readable string representation of the object.
89
+ def to_s
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} type: #{@type}, href: #{@href}, external_urls: #{@external_urls}, uri:"\
92
+ " #{@uri}>"
93
+ end
94
+
95
+ # Provides a debugging-friendly string with detailed object information.
96
+ def inspect
97
+ class_name = self.class.name.split('::').last
98
+ "<#{class_name} type: #{@type.inspect}, href: #{@href.inspect}, external_urls:"\
99
+ " #{@external_urls.inspect}, uri: #{@uri.inspect}>"
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,82 @@
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
+ # CopyrightObject Model.
8
+ class CopyrightObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The copyright text for this content.
13
+ # @return [String]
14
+ attr_accessor :text
15
+
16
+ # The type of copyright: `C` = the copyright, `P` = the sound recording
17
+ # (performance) copyright.
18
+ # @return [String]
19
+ attr_accessor :type
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['text'] = 'text'
25
+ @_hash['type'] = 'type'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ text
33
+ type
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(text = SKIP, type = SKIP)
43
+ @text = text unless text == SKIP
44
+ @type = type unless type == 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
+ text = hash.key?('text') ? hash['text'] : SKIP
53
+ type = hash.key?('type') ? hash['type'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ CopyrightObject.new(text,
57
+ type)
58
+ end
59
+
60
+ # Validates an instance of the object from a given value.
61
+ # @param [CopyrightObject | Hash] The value against the validation is performed.
62
+ def self.validate(value)
63
+ return true if value.instance_of? self
64
+
65
+ return false unless value.instance_of? Hash
66
+
67
+ true
68
+ end
69
+
70
+ # Provides a human-readable string representation of the object.
71
+ def to_s
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} text: #{@text}, type: #{@type}>"
74
+ end
75
+
76
+ # Provides a debugging-friendly string with detailed object information.
77
+ def inspect
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} text: #{@text.inspect}, type: #{@type.inspect}>"
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,168 @@
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
+ # CurrentlyPlayingContextObject Model.
8
+ class CurrentlyPlayingContextObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The device that is currently active.
13
+ # @return [DeviceObject]
14
+ attr_accessor :device
15
+
16
+ # off, track, context
17
+ # @return [String]
18
+ attr_accessor :repeat_state
19
+
20
+ # If shuffle is on or off.
21
+ # @return [TrueClass | FalseClass]
22
+ attr_accessor :shuffle_state
23
+
24
+ # A Context Object. Can be `null`.
25
+ # @return [ContextObject]
26
+ attr_accessor :context
27
+
28
+ # Unix Millisecond Timestamp when data was fetched.
29
+ # @return [Integer]
30
+ attr_accessor :timestamp
31
+
32
+ # Progress into the currently playing track or episode. Can be `null`.
33
+ # @return [Integer]
34
+ attr_accessor :progress_ms
35
+
36
+ # If something is currently playing, return `true`.
37
+ # @return [TrueClass | FalseClass]
38
+ attr_accessor :is_playing
39
+
40
+ # The currently playing track or episode. Can be `null`.
41
+ # @return [Object]
42
+ attr_accessor :item
43
+
44
+ # The object type of the currently playing item. Can be one of `track`,
45
+ # `episode`, `ad` or `unknown`.
46
+ # @return [String]
47
+ attr_accessor :currently_playing_type
48
+
49
+ # Allows to update the user interface based on which playback actions are
50
+ # available within the current context.
51
+ # @return [DisallowsObject]
52
+ attr_accessor :actions
53
+
54
+ # A mapping from model property names to API property names.
55
+ def self.names
56
+ @_hash = {} if @_hash.nil?
57
+ @_hash['device'] = 'device'
58
+ @_hash['repeat_state'] = 'repeat_state'
59
+ @_hash['shuffle_state'] = 'shuffle_state'
60
+ @_hash['context'] = 'context'
61
+ @_hash['timestamp'] = 'timestamp'
62
+ @_hash['progress_ms'] = 'progress_ms'
63
+ @_hash['is_playing'] = 'is_playing'
64
+ @_hash['item'] = 'item'
65
+ @_hash['currently_playing_type'] = 'currently_playing_type'
66
+ @_hash['actions'] = 'actions'
67
+ @_hash
68
+ end
69
+
70
+ # An array for optional fields
71
+ def self.optionals
72
+ %w[
73
+ device
74
+ repeat_state
75
+ shuffle_state
76
+ context
77
+ timestamp
78
+ progress_ms
79
+ is_playing
80
+ item
81
+ currently_playing_type
82
+ actions
83
+ ]
84
+ end
85
+
86
+ # An array for nullable fields
87
+ def self.nullables
88
+ []
89
+ end
90
+
91
+ def initialize(device = SKIP, repeat_state = SKIP, shuffle_state = SKIP,
92
+ context = SKIP, timestamp = SKIP, progress_ms = SKIP,
93
+ is_playing = SKIP, item = SKIP,
94
+ currently_playing_type = SKIP, actions = SKIP)
95
+ @device = device unless device == SKIP
96
+ @repeat_state = repeat_state unless repeat_state == SKIP
97
+ @shuffle_state = shuffle_state unless shuffle_state == SKIP
98
+ @context = context unless context == SKIP
99
+ @timestamp = timestamp unless timestamp == SKIP
100
+ @progress_ms = progress_ms unless progress_ms == SKIP
101
+ @is_playing = is_playing unless is_playing == SKIP
102
+ @item = item unless item == SKIP
103
+ @currently_playing_type = currently_playing_type unless currently_playing_type == SKIP
104
+ @actions = actions unless actions == SKIP
105
+ end
106
+
107
+ # Creates an instance of the object from a hash.
108
+ def self.from_hash(hash)
109
+ return nil unless hash
110
+
111
+ # Extract variables from the hash.
112
+ device = DeviceObject.from_hash(hash['device']) if hash['device']
113
+ repeat_state = hash.key?('repeat_state') ? hash['repeat_state'] : SKIP
114
+ shuffle_state = hash.key?('shuffle_state') ? hash['shuffle_state'] : SKIP
115
+ context = ContextObject.from_hash(hash['context']) if hash['context']
116
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
117
+ progress_ms = hash.key?('progress_ms') ? hash['progress_ms'] : SKIP
118
+ is_playing = hash.key?('is_playing') ? hash['is_playing'] : SKIP
119
+ item = hash.key?('item') ? APIHelper.deserialize_union_type(
120
+ UnionTypeLookUp.get(:CurrentlyPlayingContextObjectItem), hash['item']
121
+ ) : SKIP
122
+ currently_playing_type =
123
+ hash.key?('currently_playing_type') ? hash['currently_playing_type'] : SKIP
124
+ actions = DisallowsObject.from_hash(hash['actions']) if hash['actions']
125
+
126
+ # Create object from extracted values.
127
+ CurrentlyPlayingContextObject.new(device,
128
+ repeat_state,
129
+ shuffle_state,
130
+ context,
131
+ timestamp,
132
+ progress_ms,
133
+ is_playing,
134
+ item,
135
+ currently_playing_type,
136
+ actions)
137
+ end
138
+
139
+ # Validates an instance of the object from a given value.
140
+ # @param [CurrentlyPlayingContextObject | Hash] The value against the validation is performed.
141
+ def self.validate(value)
142
+ return true if value.instance_of? self
143
+
144
+ return false unless value.instance_of? Hash
145
+
146
+ true
147
+ end
148
+
149
+ # Provides a human-readable string representation of the object.
150
+ def to_s
151
+ class_name = self.class.name.split('::').last
152
+ "<#{class_name} device: #{@device}, repeat_state: #{@repeat_state}, shuffle_state:"\
153
+ " #{@shuffle_state}, context: #{@context}, timestamp: #{@timestamp}, progress_ms:"\
154
+ " #{@progress_ms}, is_playing: #{@is_playing}, item: #{@item}, currently_playing_type:"\
155
+ " #{@currently_playing_type}, actions: #{@actions}>"
156
+ end
157
+
158
+ # Provides a debugging-friendly string with detailed object information.
159
+ def inspect
160
+ class_name = self.class.name.split('::').last
161
+ "<#{class_name} device: #{@device.inspect}, repeat_state: #{@repeat_state.inspect},"\
162
+ " shuffle_state: #{@shuffle_state.inspect}, context: #{@context.inspect}, timestamp:"\
163
+ " #{@timestamp.inspect}, progress_ms: #{@progress_ms.inspect}, is_playing:"\
164
+ " #{@is_playing.inspect}, item: #{@item.inspect}, currently_playing_type:"\
165
+ " #{@currently_playing_type.inspect}, actions: #{@actions.inspect}>"
166
+ end
167
+ end
168
+ end