spotify-api-sdk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,110 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # Meta Model.
8
+ class Meta < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The version of the Analyzer used to analyze this track.
13
+ # @return [String]
14
+ attr_accessor :analyzer_version
15
+
16
+ # The platform used to read the track's audio data.
17
+ # @return [String]
18
+ attr_accessor :platform
19
+
20
+ # A detailed status code for this track. If analysis data is missing, this
21
+ # code may explain why.
22
+ # @return [String]
23
+ attr_accessor :detailed_status
24
+
25
+ # The return code of the analyzer process. 0 if successful, 1 if any errors
26
+ # occurred.
27
+ # @return [Integer]
28
+ attr_accessor :status_code
29
+
30
+ # The Unix timestamp (in seconds) at which this track was analyzed.
31
+ # @return [Integer]
32
+ attr_accessor :timestamp
33
+
34
+ # The amount of time taken to analyze this track.
35
+ # @return [Float]
36
+ attr_accessor :analysis_time
37
+
38
+ # The method used to read the track's audio data.
39
+ # @return [String]
40
+ attr_accessor :input_process
41
+
42
+ # A mapping from model property names to API property names.
43
+ def self.names
44
+ @_hash = {} if @_hash.nil?
45
+ @_hash['analyzer_version'] = 'analyzer_version'
46
+ @_hash['platform'] = 'platform'
47
+ @_hash['detailed_status'] = 'detailed_status'
48
+ @_hash['status_code'] = 'status_code'
49
+ @_hash['timestamp'] = 'timestamp'
50
+ @_hash['analysis_time'] = 'analysis_time'
51
+ @_hash['input_process'] = 'input_process'
52
+ @_hash
53
+ end
54
+
55
+ # An array for optional fields
56
+ def self.optionals
57
+ %w[
58
+ analyzer_version
59
+ platform
60
+ detailed_status
61
+ status_code
62
+ timestamp
63
+ analysis_time
64
+ input_process
65
+ ]
66
+ end
67
+
68
+ # An array for nullable fields
69
+ def self.nullables
70
+ []
71
+ end
72
+
73
+ def initialize(analyzer_version = SKIP, platform = SKIP,
74
+ detailed_status = SKIP, status_code = SKIP, timestamp = SKIP,
75
+ analysis_time = SKIP, input_process = SKIP)
76
+ @analyzer_version = analyzer_version unless analyzer_version == SKIP
77
+ @platform = platform unless platform == SKIP
78
+ @detailed_status = detailed_status unless detailed_status == SKIP
79
+ @status_code = status_code unless status_code == SKIP
80
+ @timestamp = timestamp unless timestamp == SKIP
81
+ @analysis_time = analysis_time unless analysis_time == SKIP
82
+ @input_process = input_process unless input_process == SKIP
83
+ end
84
+
85
+ # Creates an instance of the object from a hash.
86
+ def self.from_hash(hash)
87
+ return nil unless hash
88
+
89
+ # Extract variables from the hash.
90
+ analyzer_version =
91
+ hash.key?('analyzer_version') ? hash['analyzer_version'] : SKIP
92
+ platform = hash.key?('platform') ? hash['platform'] : SKIP
93
+ detailed_status =
94
+ hash.key?('detailed_status') ? hash['detailed_status'] : SKIP
95
+ status_code = hash.key?('status_code') ? hash['status_code'] : SKIP
96
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
97
+ analysis_time = hash.key?('analysis_time') ? hash['analysis_time'] : SKIP
98
+ input_process = hash.key?('input_process') ? hash['input_process'] : SKIP
99
+
100
+ # Create object from extracted values.
101
+ Meta.new(analyzer_version,
102
+ platform,
103
+ detailed_status,
104
+ status_code,
105
+ timestamp,
106
+ analysis_time,
107
+ input_process)
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,30 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # Indicates the modality (major or minor) of a section, the type of scale from
8
+ # which its melodic content is derived. This field will contain a 0 for
9
+ # "minor", a 1 for "major", or a -1 for no result. Note that the major key
10
+ # (e.g. C major) could more likely be confused with the minor key at 3
11
+ # semitones lower (e.g. A minor) as both keys carry the same pitches.
12
+ class ModeEnum
13
+ MODE_ENUM = [
14
+ # TODO: Write general description for ENUM_MINUS1
15
+ ENUM_MINUS1 = -1,
16
+
17
+ # TODO: Write general description for ENUM_0
18
+ ENUM_0 = 0,
19
+
20
+ # TODO: Write general description for ENUM_1
21
+ ENUM_1 = 1
22
+ ].freeze
23
+
24
+ def self.validate(value)
25
+ return false if value.nil?
26
+
27
+ MODE_ENUM.include?(value)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,50 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # NarratorObject Model.
8
+ class NarratorObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The name of the Narrator.
13
+ # @return [String]
14
+ attr_accessor :name
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['name'] = 'name'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ name
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(name = SKIP)
36
+ @name = name unless name == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ name = hash.key?('name') ? hash['name'] : SKIP
45
+
46
+ # Create object from extracted values.
47
+ NarratorObject.new(name)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,45 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # OAuth 2 Authorization error codes
8
+ class OAuthProviderErrorEnum
9
+ O_AUTH_PROVIDER_ERROR_ENUM = [
10
+ # The request is missing a required parameter, includes an unsupported
11
+ # parameter value (other than grant type), repeats a parameter, includes
12
+ # multiple credentials, utilizes more than one mechanism for
13
+ # authenticating the client, or is otherwise malformed.
14
+ INVALID_REQUEST = 'invalid_request'.freeze,
15
+
16
+ # Client authentication failed (e.g., unknown client, no client
17
+ # authentication included, or unsupported authentication method).
18
+ INVALID_CLIENT = 'invalid_client'.freeze,
19
+
20
+ # The provided authorization grant (e.g., authorization code, resource
21
+ # owner credentials) or refresh token is invalid, expired, revoked, does
22
+ # not match the redirection URI used in the authorization request, or was
23
+ # issued to another client.
24
+ INVALID_GRANT = 'invalid_grant'.freeze,
25
+
26
+ # The authenticated client is not authorized to use this authorization
27
+ # grant type.
28
+ UNAUTHORIZED_CLIENT = 'unauthorized_client'.freeze,
29
+
30
+ # The authorization grant type is not supported by the authorization
31
+ # server.
32
+ UNSUPPORTED_GRANT_TYPE = 'unsupported_grant_type'.freeze,
33
+
34
+ # The requested scope is invalid, unknown, malformed, or exceeds the scope
35
+ # granted by the resource owner.
36
+ INVALID_SCOPE = 'invalid_scope'.freeze
37
+ ].freeze
38
+
39
+ def self.validate(value)
40
+ return false if value.nil?
41
+
42
+ O_AUTH_PROVIDER_ERROR_ENUM.include?(value)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,94 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # OAuth 2 scopes supported by the API
8
+ class OAuthScopeEnum
9
+ O_AUTH_SCOPE_ENUM = [
10
+ # Communicate with the Spotify app on your device.
11
+
12
+ APP_REMOTE_CONTROL = 'app-remote-control'.freeze,
13
+
14
+ # Access your private playlists.
15
+
16
+ PLAYLIST_READ_PRIVATE = 'playlist-read-private'.freeze,
17
+
18
+ # Access your collaborative playlists.
19
+
20
+ PLAYLIST_READ_COLLABORATIVE = 'playlist-read-collaborative'.freeze,
21
+
22
+ # Manage your public playlists.
23
+
24
+ PLAYLIST_MODIFY_PUBLIC = 'playlist-modify-public'.freeze,
25
+
26
+ # Manage your private playlists.
27
+
28
+ PLAYLIST_MODIFY_PRIVATE = 'playlist-modify-private'.freeze,
29
+
30
+ # Access your saved content.
31
+
32
+ USER_LIBRARY_READ = 'user-library-read'.freeze,
33
+
34
+ # Manage your saved content.
35
+
36
+ USER_LIBRARY_MODIFY = 'user-library-modify'.freeze,
37
+
38
+ # Access your subscription details.
39
+
40
+ USER_READ_PRIVATE = 'user-read-private'.freeze,
41
+
42
+ # Get your real email address.
43
+
44
+ USER_READ_EMAIL = 'user-read-email'.freeze,
45
+
46
+ # Access your followers and who you are following.
47
+
48
+ USER_FOLLOW_READ = 'user-follow-read'.freeze,
49
+
50
+ # Manage your saved content.
51
+
52
+ USER_FOLLOW_MODIFY = 'user-follow-modify'.freeze,
53
+
54
+ # Read your top artists and content.
55
+
56
+ USER_TOP_READ = 'user-top-read'.freeze,
57
+
58
+ # Read your position in content you have played.
59
+
60
+ USER_READ_PLAYBACK_POSITION = 'user-read-playback-position'.freeze,
61
+
62
+ # Read your currently playing content and Spotify Connect devices
63
+ # information.
64
+
65
+ USER_READ_PLAYBACK_STATE = 'user-read-playback-state'.freeze,
66
+
67
+ # Access your recently played items.
68
+
69
+ USER_READ_RECENTLY_PLAYED = 'user-read-recently-played'.freeze,
70
+
71
+ # Read your currently playing content.
72
+
73
+ USER_READ_CURRENTLY_PLAYING = 'user-read-currently-playing'.freeze,
74
+
75
+ # Control playback on your Spotify clients and Spotify Connect devices.
76
+
77
+ USER_MODIFY_PLAYBACK_STATE = 'user-modify-playback-state'.freeze,
78
+
79
+ # Upload images to Spotify on your behalf.
80
+
81
+ UGC_IMAGE_UPLOAD = 'ugc-image-upload'.freeze,
82
+
83
+ # Play content and control playback on your other devices.
84
+
85
+ STREAMING = 'streaming'.freeze
86
+ ].freeze
87
+
88
+ def self.validate(value)
89
+ return false if value.nil?
90
+
91
+ O_AUTH_SCOPE_ENUM.include?(value)
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,96 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # OAuth 2 Authorization endpoint response
8
+ class OAuthToken < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Access token
13
+ # @return [String]
14
+ attr_accessor :access_token
15
+
16
+ # Type of access token
17
+ # @return [String]
18
+ attr_accessor :token_type
19
+
20
+ # Time in seconds before the access token expires
21
+ # @return [Integer]
22
+ attr_accessor :expires_in
23
+
24
+ # List of scopes granted
25
+ # This is a space-delimited list of strings.
26
+ # @return [String]
27
+ attr_accessor :scope
28
+
29
+ # Time of token expiry as unix timestamp (UTC)
30
+ # @return [Integer]
31
+ attr_accessor :expiry
32
+
33
+ # Refresh token
34
+ # Used to get a new access token when it expires.
35
+ # @return [String]
36
+ attr_accessor :refresh_token
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['access_token'] = 'access_token'
42
+ @_hash['token_type'] = 'token_type'
43
+ @_hash['expires_in'] = 'expires_in'
44
+ @_hash['scope'] = 'scope'
45
+ @_hash['expiry'] = 'expiry'
46
+ @_hash['refresh_token'] = 'refresh_token'
47
+ @_hash
48
+ end
49
+
50
+ # An array for optional fields
51
+ def self.optionals
52
+ %w[
53
+ expires_in
54
+ scope
55
+ expiry
56
+ refresh_token
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ []
63
+ end
64
+
65
+ def initialize(access_token = nil, token_type = nil, expires_in = SKIP,
66
+ scope = SKIP, expiry = SKIP, refresh_token = SKIP)
67
+ @access_token = access_token
68
+ @token_type = token_type
69
+ @expires_in = expires_in unless expires_in == SKIP
70
+ @scope = scope unless scope == SKIP
71
+ @expiry = expiry unless expiry == SKIP
72
+ @refresh_token = refresh_token unless refresh_token == SKIP
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ access_token = hash.key?('access_token') ? hash['access_token'] : nil
81
+ token_type = hash.key?('token_type') ? hash['token_type'] : nil
82
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
83
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
84
+ expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
85
+ refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
86
+
87
+ # Create object from extracted values.
88
+ OAuthToken.new(access_token,
89
+ token_type,
90
+ expires_in,
91
+ scope,
92
+ expiry,
93
+ refresh_token)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,48 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PagedAlbums Model.
8
+ class PagedAlbums < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [PagingSimplifiedAlbumObject]
14
+ attr_accessor :albums
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['albums'] = 'albums'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(albums = nil)
34
+ @albums = albums
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ albums = PagingSimplifiedAlbumObject.from_hash(hash['albums']) if hash['albums']
43
+
44
+ # Create object from extracted values.
45
+ PagedAlbums.new(albums)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PagedCategories Model.
8
+ class PagedCategories < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Categories]
14
+ attr_accessor :categories
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['categories'] = 'categories'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(categories = nil)
34
+ @categories = categories
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ categories = Categories.from_hash(hash['categories']) if hash['categories']
43
+
44
+ # Create object from extracted values.
45
+ PagedCategories.new(categories)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,110 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PagingArtistDiscographyAlbumObject Model.
8
+ class PagingArtistDiscographyAlbumObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A link to the Web API endpoint returning the full result of the request
13
+ # @return [String]
14
+ attr_accessor :href
15
+
16
+ # The maximum number of items in the response (as set in the query or by
17
+ # default).
18
+ # @return [Integer]
19
+ attr_accessor :limit
20
+
21
+ # URL to the next page of items. ( `null` if none)
22
+ # @return [String]
23
+ attr_accessor :mnext
24
+
25
+ # The offset of the items returned (as set in the query or by default)
26
+ # @return [Integer]
27
+ attr_accessor :offset
28
+
29
+ # URL to the previous page of items. ( `null` if none)
30
+ # @return [String]
31
+ attr_accessor :previous
32
+
33
+ # The total number of items available to return.
34
+ # @return [Integer]
35
+ attr_accessor :total
36
+
37
+ # The total number of items available to return.
38
+ # @return [Array[ArtistDiscographyAlbumObject]]
39
+ attr_accessor :items
40
+
41
+ # A mapping from model property names to API property names.
42
+ def self.names
43
+ @_hash = {} if @_hash.nil?
44
+ @_hash['href'] = 'href'
45
+ @_hash['limit'] = 'limit'
46
+ @_hash['mnext'] = 'next'
47
+ @_hash['offset'] = 'offset'
48
+ @_hash['previous'] = 'previous'
49
+ @_hash['total'] = 'total'
50
+ @_hash['items'] = 'items'
51
+ @_hash
52
+ end
53
+
54
+ # An array for optional fields
55
+ def self.optionals
56
+ []
57
+ end
58
+
59
+ # An array for nullable fields
60
+ def self.nullables
61
+ %w[
62
+ mnext
63
+ previous
64
+ ]
65
+ end
66
+
67
+ def initialize(href = nil, limit = nil, mnext = nil, offset = nil,
68
+ previous = nil, total = nil, items = nil)
69
+ @href = href
70
+ @limit = limit
71
+ @mnext = mnext
72
+ @offset = offset
73
+ @previous = previous
74
+ @total = total
75
+ @items = items
76
+ end
77
+
78
+ # Creates an instance of the object from a hash.
79
+ def self.from_hash(hash)
80
+ return nil unless hash
81
+
82
+ # Extract variables from the hash.
83
+ href = hash.key?('href') ? hash['href'] : nil
84
+ limit = hash.key?('limit') ? hash['limit'] : nil
85
+ mnext = hash.key?('next') ? hash['next'] : nil
86
+ offset = hash.key?('offset') ? hash['offset'] : nil
87
+ previous = hash.key?('previous') ? hash['previous'] : nil
88
+ total = hash.key?('total') ? hash['total'] : nil
89
+ # Parameter is an array, so we need to iterate through it
90
+ items = nil
91
+ unless hash['items'].nil?
92
+ items = []
93
+ hash['items'].each do |structure|
94
+ items << (ArtistDiscographyAlbumObject.from_hash(structure) if structure)
95
+ end
96
+ end
97
+
98
+ items = nil unless hash.key?('items')
99
+
100
+ # Create object from extracted values.
101
+ PagingArtistDiscographyAlbumObject.new(href,
102
+ limit,
103
+ mnext,
104
+ offset,
105
+ previous,
106
+ total,
107
+ items)
108
+ end
109
+ end
110
+ end