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,97 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistsTracksRequest1 Model.
8
+ class PlaylistsTracksRequest1 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[String]]
14
+ attr_accessor :uris
15
+
16
+ # The position of the first item to be reordered.
17
+ # @return [Integer]
18
+ attr_accessor :range_start
19
+
20
+ # The position where the items should be inserted.<br/>To reorder the items
21
+ # to the end of the playlist, simply set _insert_before_ to the position
22
+ # after the last item.<br/>Examples:<br/>To reorder the first item to the
23
+ # last position in a playlist with 10 items, set _range_start_ to 0, and
24
+ # _insert_before_ to 10.<br/>To reorder the last item in a playlist with 10
25
+ # items to the start of the playlist, set _range_start_ to 9, and
26
+ # _insert_before_ to 0.
27
+ # @return [Integer]
28
+ attr_accessor :insert_before
29
+
30
+ # The amount of items to be reordered. Defaults to 1 if not set.<br/>The
31
+ # range of items to be reordered begins from the _range_start_ position, and
32
+ # includes the _range_length_ subsequent items.<br/>Example:<br/>To move the
33
+ # items at index 9-10 to the start of the playlist, _range_start_ is set to
34
+ # 9, and _range_length_ is set to 2.
35
+ # @return [Integer]
36
+ attr_accessor :range_length
37
+
38
+ # The playlist's snapshot ID against which you want to make the changes.
39
+ # @return [String]
40
+ attr_accessor :snapshot_id
41
+
42
+ # A mapping from model property names to API property names.
43
+ def self.names
44
+ @_hash = {} if @_hash.nil?
45
+ @_hash['uris'] = 'uris'
46
+ @_hash['range_start'] = 'range_start'
47
+ @_hash['insert_before'] = 'insert_before'
48
+ @_hash['range_length'] = 'range_length'
49
+ @_hash['snapshot_id'] = 'snapshot_id'
50
+ @_hash
51
+ end
52
+
53
+ # An array for optional fields
54
+ def self.optionals
55
+ %w[
56
+ uris
57
+ range_start
58
+ insert_before
59
+ range_length
60
+ snapshot_id
61
+ ]
62
+ end
63
+
64
+ # An array for nullable fields
65
+ def self.nullables
66
+ []
67
+ end
68
+
69
+ def initialize(uris = SKIP, range_start = SKIP, insert_before = SKIP,
70
+ range_length = SKIP, snapshot_id = SKIP)
71
+ @uris = uris unless uris == SKIP
72
+ @range_start = range_start unless range_start == SKIP
73
+ @insert_before = insert_before unless insert_before == SKIP
74
+ @range_length = range_length unless range_length == SKIP
75
+ @snapshot_id = snapshot_id unless snapshot_id == SKIP
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
+ uris = hash.key?('uris') ? hash['uris'] : SKIP
84
+ range_start = hash.key?('range_start') ? hash['range_start'] : SKIP
85
+ insert_before = hash.key?('insert_before') ? hash['insert_before'] : SKIP
86
+ range_length = hash.key?('range_length') ? hash['range_length'] : SKIP
87
+ snapshot_id = hash.key?('snapshot_id') ? hash['snapshot_id'] : SKIP
88
+
89
+ # Create object from extracted values.
90
+ PlaylistsTracksRequest1.new(uris,
91
+ range_start,
92
+ insert_before,
93
+ range_length,
94
+ snapshot_id)
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,75 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistsTracksRequest2 Model.
8
+ class PlaylistsTracksRequest2 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # An array of objects containing [Spotify
13
+ # URIs](/documentation/web-api/concepts/spotify-uris-ids) of the tracks or
14
+ # episodes to remove.
15
+ # For example: `{ "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh"
16
+ # },{ "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }`. A maximum of 100
17
+ # objects can be sent at once.
18
+ # @return [Array[Track1]]
19
+ attr_accessor :tracks
20
+
21
+ # The playlist's snapshot ID against which you want to make the changes.
22
+ # The API will validate that the specified items exist and in the specified
23
+ # positions and make the changes,
24
+ # even if more recent changes have been made to the playlist.
25
+ # @return [String]
26
+ attr_accessor :snapshot_id
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['tracks'] = 'tracks'
32
+ @_hash['snapshot_id'] = 'snapshot_id'
33
+ @_hash
34
+ end
35
+
36
+ # An array for optional fields
37
+ def self.optionals
38
+ %w[
39
+ snapshot_id
40
+ ]
41
+ end
42
+
43
+ # An array for nullable fields
44
+ def self.nullables
45
+ []
46
+ end
47
+
48
+ def initialize(tracks = nil, snapshot_id = SKIP)
49
+ @tracks = tracks
50
+ @snapshot_id = snapshot_id unless snapshot_id == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ # Parameter is an array, so we need to iterate through it
59
+ tracks = nil
60
+ unless hash['tracks'].nil?
61
+ tracks = []
62
+ hash['tracks'].each do |structure|
63
+ tracks << (Track1.from_hash(structure) if structure)
64
+ end
65
+ end
66
+
67
+ tracks = nil unless hash.key?('tracks')
68
+ snapshot_id = hash.key?('snapshot_id') ? hash['snapshot_id'] : SKIP
69
+
70
+ # Create object from extracted values.
71
+ PlaylistsTracksRequest2.new(tracks,
72
+ snapshot_id)
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,181 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PrivateUserObject Model.
8
+ class PrivateUserObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The country of the user, as set in the user's account profile. An [ISO
13
+ # 3166-1 alpha-2 country
14
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). _This field is
15
+ # only available when the current user has granted access to the
16
+ # [user-read-private](/documentation/web-api/concepts/scopes/#list-of-scopes
17
+ # ) scope._
18
+ # @return [String]
19
+ attr_accessor :country
20
+
21
+ # The name displayed on the user's profile. `null` if not available.
22
+ # @return [String]
23
+ attr_accessor :display_name
24
+
25
+ # The user's email address, as entered by the user when creating their
26
+ # account. _**Important!** This email address is unverified; there is no
27
+ # proof that it actually belongs to the user._ _This field is only available
28
+ # when the current user has granted access to the
29
+ # [user-read-email](/documentation/web-api/concepts/scopes/#list-of-scopes)
30
+ # scope._
31
+ # @return [String]
32
+ attr_accessor :email
33
+
34
+ # The user's explicit content settings. _This field is only available when
35
+ # the current user has granted access to the
36
+ # [user-read-private](/documentation/web-api/concepts/scopes/#list-of-scopes
37
+ # ) scope._
38
+ # @return [ExplicitContentSettingsObject]
39
+ attr_accessor :explicit_content
40
+
41
+ # Known external URLs for this user.
42
+ # @return [ExternalUrlObject]
43
+ attr_accessor :external_urls
44
+
45
+ # Information about the followers of the user.
46
+ # @return [FollowersObject]
47
+ attr_accessor :followers
48
+
49
+ # A link to the Web API endpoint for this user.
50
+ # @return [String]
51
+ attr_accessor :href
52
+
53
+ # The [Spotify user ID](/documentation/web-api/concepts/spotify-uris-ids)
54
+ # for the user.
55
+ # @return [String]
56
+ attr_accessor :id
57
+
58
+ # The user's profile image.
59
+ # @return [Array[ImageObject]]
60
+ attr_accessor :images
61
+
62
+ # The user's Spotify subscription level: "premium", "free", etc. (The
63
+ # subscription level "open" can be considered the same as "free".) _This
64
+ # field is only available when the current user has granted access to the
65
+ # [user-read-private](/documentation/web-api/concepts/scopes/#list-of-scopes
66
+ # ) scope._
67
+ # @return [String]
68
+ attr_accessor :product
69
+
70
+ # The object type: "user"
71
+ # @return [String]
72
+ attr_accessor :type
73
+
74
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
75
+ # the user.
76
+ # @return [String]
77
+ attr_accessor :uri
78
+
79
+ # A mapping from model property names to API property names.
80
+ def self.names
81
+ @_hash = {} if @_hash.nil?
82
+ @_hash['country'] = 'country'
83
+ @_hash['display_name'] = 'display_name'
84
+ @_hash['email'] = 'email'
85
+ @_hash['explicit_content'] = 'explicit_content'
86
+ @_hash['external_urls'] = 'external_urls'
87
+ @_hash['followers'] = 'followers'
88
+ @_hash['href'] = 'href'
89
+ @_hash['id'] = 'id'
90
+ @_hash['images'] = 'images'
91
+ @_hash['product'] = 'product'
92
+ @_hash['type'] = 'type'
93
+ @_hash['uri'] = 'uri'
94
+ @_hash
95
+ end
96
+
97
+ # An array for optional fields
98
+ def self.optionals
99
+ %w[
100
+ country
101
+ display_name
102
+ email
103
+ explicit_content
104
+ external_urls
105
+ followers
106
+ href
107
+ id
108
+ images
109
+ product
110
+ type
111
+ uri
112
+ ]
113
+ end
114
+
115
+ # An array for nullable fields
116
+ def self.nullables
117
+ []
118
+ end
119
+
120
+ def initialize(country = SKIP, display_name = SKIP, email = SKIP,
121
+ explicit_content = SKIP, external_urls = SKIP,
122
+ followers = SKIP, href = SKIP, id = SKIP, images = SKIP,
123
+ product = SKIP, type = SKIP, uri = SKIP)
124
+ @country = country unless country == SKIP
125
+ @display_name = display_name unless display_name == SKIP
126
+ @email = email unless email == SKIP
127
+ @explicit_content = explicit_content unless explicit_content == SKIP
128
+ @external_urls = external_urls unless external_urls == SKIP
129
+ @followers = followers unless followers == SKIP
130
+ @href = href unless href == SKIP
131
+ @id = id unless id == SKIP
132
+ @images = images unless images == SKIP
133
+ @product = product unless product == SKIP
134
+ @type = type unless type == SKIP
135
+ @uri = uri unless uri == SKIP
136
+ end
137
+
138
+ # Creates an instance of the object from a hash.
139
+ def self.from_hash(hash)
140
+ return nil unless hash
141
+
142
+ # Extract variables from the hash.
143
+ country = hash.key?('country') ? hash['country'] : SKIP
144
+ display_name = hash.key?('display_name') ? hash['display_name'] : SKIP
145
+ email = hash.key?('email') ? hash['email'] : SKIP
146
+ explicit_content = ExplicitContentSettingsObject.from_hash(hash['explicit_content']) if
147
+ hash['explicit_content']
148
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
149
+ followers = FollowersObject.from_hash(hash['followers']) if hash['followers']
150
+ href = hash.key?('href') ? hash['href'] : SKIP
151
+ id = hash.key?('id') ? hash['id'] : SKIP
152
+ # Parameter is an array, so we need to iterate through it
153
+ images = nil
154
+ unless hash['images'].nil?
155
+ images = []
156
+ hash['images'].each do |structure|
157
+ images << (ImageObject.from_hash(structure) if structure)
158
+ end
159
+ end
160
+
161
+ images = SKIP unless hash.key?('images')
162
+ product = hash.key?('product') ? hash['product'] : SKIP
163
+ type = hash.key?('type') ? hash['type'] : SKIP
164
+ uri = hash.key?('uri') ? hash['uri'] : SKIP
165
+
166
+ # Create object from extracted values.
167
+ PrivateUserObject.new(country,
168
+ display_name,
169
+ email,
170
+ explicit_content,
171
+ external_urls,
172
+ followers,
173
+ href,
174
+ id,
175
+ images,
176
+ product,
177
+ type,
178
+ uri)
179
+ end
180
+ end
181
+ end
@@ -0,0 +1,128 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PublicUserObject Model.
8
+ class PublicUserObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The name displayed on the user's profile. `null` if not available.
13
+ # @return [String]
14
+ attr_accessor :display_name
15
+
16
+ # Known public external URLs for this user.
17
+ # @return [ExternalUrlObject]
18
+ attr_accessor :external_urls
19
+
20
+ # Information about the followers of this user.
21
+ # @return [FollowersObject]
22
+ attr_accessor :followers
23
+
24
+ # A link to the Web API endpoint for this user.
25
+ # @return [String]
26
+ attr_accessor :href
27
+
28
+ # The [Spotify user ID](/documentation/web-api/concepts/spotify-uris-ids)
29
+ # for this user.
30
+ # @return [String]
31
+ attr_accessor :id
32
+
33
+ # The user's profile image.
34
+ # @return [Array[ImageObject]]
35
+ attr_accessor :images
36
+
37
+ # The object type.
38
+ # @return [Type4Enum]
39
+ attr_accessor :type
40
+
41
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
42
+ # this user.
43
+ # @return [String]
44
+ attr_accessor :uri
45
+
46
+ # A mapping from model property names to API property names.
47
+ def self.names
48
+ @_hash = {} if @_hash.nil?
49
+ @_hash['display_name'] = 'display_name'
50
+ @_hash['external_urls'] = 'external_urls'
51
+ @_hash['followers'] = 'followers'
52
+ @_hash['href'] = 'href'
53
+ @_hash['id'] = 'id'
54
+ @_hash['images'] = 'images'
55
+ @_hash['type'] = 'type'
56
+ @_hash['uri'] = 'uri'
57
+ @_hash
58
+ end
59
+
60
+ # An array for optional fields
61
+ def self.optionals
62
+ %w[
63
+ display_name
64
+ external_urls
65
+ followers
66
+ href
67
+ id
68
+ images
69
+ type
70
+ uri
71
+ ]
72
+ end
73
+
74
+ # An array for nullable fields
75
+ def self.nullables
76
+ %w[
77
+ display_name
78
+ ]
79
+ end
80
+
81
+ def initialize(display_name = SKIP, external_urls = SKIP, followers = SKIP,
82
+ href = SKIP, id = SKIP, images = SKIP, type = SKIP,
83
+ uri = SKIP)
84
+ @display_name = display_name unless display_name == SKIP
85
+ @external_urls = external_urls unless external_urls == SKIP
86
+ @followers = followers unless followers == SKIP
87
+ @href = href unless href == SKIP
88
+ @id = id unless id == SKIP
89
+ @images = images unless images == SKIP
90
+ @type = type unless type == SKIP
91
+ @uri = uri unless uri == SKIP
92
+ end
93
+
94
+ # Creates an instance of the object from a hash.
95
+ def self.from_hash(hash)
96
+ return nil unless hash
97
+
98
+ # Extract variables from the hash.
99
+ display_name = hash.key?('display_name') ? hash['display_name'] : SKIP
100
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
101
+ followers = FollowersObject.from_hash(hash['followers']) if hash['followers']
102
+ href = hash.key?('href') ? hash['href'] : SKIP
103
+ id = hash.key?('id') ? hash['id'] : SKIP
104
+ # Parameter is an array, so we need to iterate through it
105
+ images = nil
106
+ unless hash['images'].nil?
107
+ images = []
108
+ hash['images'].each do |structure|
109
+ images << (ImageObject.from_hash(structure) if structure)
110
+ end
111
+ end
112
+
113
+ images = SKIP unless hash.key?('images')
114
+ type = hash.key?('type') ? hash['type'] : SKIP
115
+ uri = hash.key?('uri') ? hash['uri'] : SKIP
116
+
117
+ # Create object from extracted values.
118
+ PublicUserObject.new(display_name,
119
+ external_urls,
120
+ followers,
121
+ href,
122
+ id,
123
+ images,
124
+ type,
125
+ uri)
126
+ end
127
+ end
128
+ 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
+ # QueueObject Model.
8
+ class QueueObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The currently playing track or episode. Can be `null`.
13
+ # @return [Object]
14
+ attr_accessor :currently_playing
15
+
16
+ # The tracks or episodes in the queue. Can be empty.
17
+ # @return [Array[Object]]
18
+ attr_accessor :queue
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['currently_playing'] = 'currently_playing'
24
+ @_hash['queue'] = 'queue'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ currently_playing
32
+ queue
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(currently_playing = SKIP, queue = SKIP)
42
+ @currently_playing = currently_playing unless currently_playing == SKIP
43
+ @queue = queue unless queue == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ currently_playing =
52
+ hash.key?('currently_playing') ? hash['currently_playing'] : SKIP
53
+ queue = hash.key?('queue') ? hash['queue'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ QueueObject.new(currently_playing,
57
+ queue)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,29 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # The reason for the restriction. Albums may be restricted if the content is
8
+ # not available in a given market, to the user's subscription type, or when
9
+ # the user's account is set to not play explicit content. Additional reasons
10
+ # may be added in the future.
11
+ class ReasonEnum
12
+ REASON_ENUM = [
13
+ # TODO: Write general description for MARKET
14
+ MARKET = 'market'.freeze,
15
+
16
+ # TODO: Write general description for PRODUCT
17
+ PRODUCT = 'product'.freeze,
18
+
19
+ # TODO: Write general description for EXPLICIT
20
+ EXPLICIT = 'explicit'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ REASON_ENUM.include?(value)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,104 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # RecommendationSeedObject Model.
8
+ class RecommendationSeedObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The number of tracks available after min\_\* and max\_\* filters have been
13
+ # applied.
14
+ # @return [Integer]
15
+ attr_accessor :after_filtering_size
16
+
17
+ # The number of tracks available after relinking for regional availability.
18
+ # @return [Integer]
19
+ attr_accessor :after_relinking_size
20
+
21
+ # A link to the full track or artist data for this seed. For tracks this
22
+ # will be a link to a Track Object. For artists a link to an Artist Object.
23
+ # For genre seeds, this value will be `null`.
24
+ # @return [String]
25
+ attr_accessor :href
26
+
27
+ # The id used to select this seed. This will be the same as the string used
28
+ # in the `seed_artists`, `seed_tracks` or `seed_genres` parameter.
29
+ # @return [String]
30
+ attr_accessor :id
31
+
32
+ # The number of recommended tracks available for this seed.
33
+ # @return [Integer]
34
+ attr_accessor :initial_pool_size
35
+
36
+ # The entity type of this seed. One of `artist`, `track` or `genre`.
37
+ # @return [String]
38
+ attr_accessor :type
39
+
40
+ # A mapping from model property names to API property names.
41
+ def self.names
42
+ @_hash = {} if @_hash.nil?
43
+ @_hash['after_filtering_size'] = 'afterFilteringSize'
44
+ @_hash['after_relinking_size'] = 'afterRelinkingSize'
45
+ @_hash['href'] = 'href'
46
+ @_hash['id'] = 'id'
47
+ @_hash['initial_pool_size'] = 'initialPoolSize'
48
+ @_hash['type'] = 'type'
49
+ @_hash
50
+ end
51
+
52
+ # An array for optional fields
53
+ def self.optionals
54
+ %w[
55
+ after_filtering_size
56
+ after_relinking_size
57
+ href
58
+ id
59
+ initial_pool_size
60
+ type
61
+ ]
62
+ end
63
+
64
+ # An array for nullable fields
65
+ def self.nullables
66
+ []
67
+ end
68
+
69
+ def initialize(after_filtering_size = SKIP, after_relinking_size = SKIP,
70
+ href = SKIP, id = SKIP, initial_pool_size = SKIP,
71
+ type = SKIP)
72
+ @after_filtering_size = after_filtering_size unless after_filtering_size == SKIP
73
+ @after_relinking_size = after_relinking_size unless after_relinking_size == SKIP
74
+ @href = href unless href == SKIP
75
+ @id = id unless id == SKIP
76
+ @initial_pool_size = initial_pool_size unless initial_pool_size == SKIP
77
+ @type = type unless type == SKIP
78
+ end
79
+
80
+ # Creates an instance of the object from a hash.
81
+ def self.from_hash(hash)
82
+ return nil unless hash
83
+
84
+ # Extract variables from the hash.
85
+ after_filtering_size =
86
+ hash.key?('afterFilteringSize') ? hash['afterFilteringSize'] : SKIP
87
+ after_relinking_size =
88
+ hash.key?('afterRelinkingSize') ? hash['afterRelinkingSize'] : SKIP
89
+ href = hash.key?('href') ? hash['href'] : SKIP
90
+ id = hash.key?('id') ? hash['id'] : SKIP
91
+ initial_pool_size =
92
+ hash.key?('initialPoolSize') ? hash['initialPoolSize'] : SKIP
93
+ type = hash.key?('type') ? hash['type'] : SKIP
94
+
95
+ # Create object from extracted values.
96
+ RecommendationSeedObject.new(after_filtering_size,
97
+ after_relinking_size,
98
+ href,
99
+ id,
100
+ initial_pool_size,
101
+ type)
102
+ end
103
+ end
104
+ end