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,237 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # ChapterBase Model.
8
+ class ChapterBase < 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 [Type8Enum]
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
+ # A mapping from model property names to API property names.
103
+ def self.names
104
+ @_hash = {} if @_hash.nil?
105
+ @_hash['audio_preview_url'] = 'audio_preview_url'
106
+ @_hash['available_markets'] = 'available_markets'
107
+ @_hash['chapter_number'] = 'chapter_number'
108
+ @_hash['description'] = 'description'
109
+ @_hash['html_description'] = 'html_description'
110
+ @_hash['duration_ms'] = 'duration_ms'
111
+ @_hash['explicit'] = 'explicit'
112
+ @_hash['external_urls'] = 'external_urls'
113
+ @_hash['href'] = 'href'
114
+ @_hash['id'] = 'id'
115
+ @_hash['images'] = 'images'
116
+ @_hash['is_playable'] = 'is_playable'
117
+ @_hash['languages'] = 'languages'
118
+ @_hash['name'] = 'name'
119
+ @_hash['release_date'] = 'release_date'
120
+ @_hash['release_date_precision'] = 'release_date_precision'
121
+ @_hash['resume_point'] = 'resume_point'
122
+ @_hash['type'] = 'type'
123
+ @_hash['uri'] = 'uri'
124
+ @_hash['restrictions'] = 'restrictions'
125
+ @_hash
126
+ end
127
+
128
+ # An array for optional fields
129
+ def self.optionals
130
+ %w[
131
+ available_markets
132
+ resume_point
133
+ restrictions
134
+ ]
135
+ end
136
+
137
+ # An array for nullable fields
138
+ def self.nullables
139
+ %w[
140
+ audio_preview_url
141
+ ]
142
+ end
143
+
144
+ def initialize(audio_preview_url = nil, chapter_number = nil,
145
+ description = nil, html_description = nil, duration_ms = nil,
146
+ explicit = nil, external_urls = nil, href = nil, id = nil,
147
+ images = nil, is_playable = nil, languages = nil, name = nil,
148
+ release_date = nil, release_date_precision = nil, type = nil,
149
+ uri = nil, available_markets = SKIP, resume_point = SKIP,
150
+ restrictions = SKIP)
151
+ @audio_preview_url = audio_preview_url
152
+ @available_markets = available_markets unless available_markets == SKIP
153
+ @chapter_number = chapter_number
154
+ @description = description
155
+ @html_description = html_description
156
+ @duration_ms = duration_ms
157
+ @explicit = explicit
158
+ @external_urls = external_urls
159
+ @href = href
160
+ @id = id
161
+ @images = images
162
+ @is_playable = is_playable
163
+ @languages = languages
164
+ @name = name
165
+ @release_date = release_date
166
+ @release_date_precision = release_date_precision
167
+ @resume_point = resume_point unless resume_point == SKIP
168
+ @type = type
169
+ @uri = uri
170
+ @restrictions = restrictions unless restrictions == SKIP
171
+ end
172
+
173
+ # Creates an instance of the object from a hash.
174
+ def self.from_hash(hash)
175
+ return nil unless hash
176
+
177
+ # Extract variables from the hash.
178
+ audio_preview_url =
179
+ hash.key?('audio_preview_url') ? hash['audio_preview_url'] : nil
180
+ chapter_number =
181
+ hash.key?('chapter_number') ? hash['chapter_number'] : nil
182
+ description = hash.key?('description') ? hash['description'] : nil
183
+ html_description =
184
+ hash.key?('html_description') ? hash['html_description'] : nil
185
+ duration_ms = hash.key?('duration_ms') ? hash['duration_ms'] : nil
186
+ explicit = hash.key?('explicit') ? hash['explicit'] : nil
187
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
188
+ href = hash.key?('href') ? hash['href'] : nil
189
+ id = hash.key?('id') ? hash['id'] : nil
190
+ # Parameter is an array, so we need to iterate through it
191
+ images = nil
192
+ unless hash['images'].nil?
193
+ images = []
194
+ hash['images'].each do |structure|
195
+ images << (ImageObject.from_hash(structure) if structure)
196
+ end
197
+ end
198
+
199
+ images = nil unless hash.key?('images')
200
+ is_playable = hash.key?('is_playable') ? hash['is_playable'] : nil
201
+ languages = hash.key?('languages') ? hash['languages'] : nil
202
+ name = hash.key?('name') ? hash['name'] : nil
203
+ release_date = hash.key?('release_date') ? hash['release_date'] : nil
204
+ release_date_precision =
205
+ hash.key?('release_date_precision') ? hash['release_date_precision'] : nil
206
+ type = hash.key?('type') ? hash['type'] : nil
207
+ uri = hash.key?('uri') ? hash['uri'] : nil
208
+ available_markets =
209
+ hash.key?('available_markets') ? hash['available_markets'] : SKIP
210
+ resume_point = ResumePointObject.from_hash(hash['resume_point']) if hash['resume_point']
211
+ restrictions = ChapterRestrictionObject.from_hash(hash['restrictions']) if
212
+ hash['restrictions']
213
+
214
+ # Create object from extracted values.
215
+ ChapterBase.new(audio_preview_url,
216
+ chapter_number,
217
+ description,
218
+ html_description,
219
+ duration_ms,
220
+ explicit,
221
+ external_urls,
222
+ href,
223
+ id,
224
+ images,
225
+ is_playable,
226
+ languages,
227
+ name,
228
+ release_date,
229
+ release_date_precision,
230
+ type,
231
+ uri,
232
+ available_markets,
233
+ resume_point,
234
+ restrictions)
235
+ end
236
+ end
237
+ end
@@ -0,0 +1,245 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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 [Type8Enum]
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
+ end
245
+ end
@@ -0,0 +1,59 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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
+ end
59
+ end
@@ -0,0 +1,78 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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
+ end
78
+ end
@@ -0,0 +1,60 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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
+ end
60
+ end