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,137 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # CurrentlyPlayingContextObject Model.
8
+ class CurrentlyPlayingContextObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The device that is currently active.
13
+ # @return [DeviceObject]
14
+ attr_accessor :device
15
+
16
+ # off, track, context
17
+ # @return [String]
18
+ attr_accessor :repeat_state
19
+
20
+ # If shuffle is on or off.
21
+ # @return [TrueClass | FalseClass]
22
+ attr_accessor :shuffle_state
23
+
24
+ # A Context Object. Can be `null`.
25
+ # @return [ContextObject]
26
+ attr_accessor :context
27
+
28
+ # Unix Millisecond Timestamp when data was fetched.
29
+ # @return [Integer]
30
+ attr_accessor :timestamp
31
+
32
+ # Progress into the currently playing track or episode. Can be `null`.
33
+ # @return [Integer]
34
+ attr_accessor :progress_ms
35
+
36
+ # If something is currently playing, return `true`.
37
+ # @return [TrueClass | FalseClass]
38
+ attr_accessor :is_playing
39
+
40
+ # The currently playing track or episode. Can be `null`.
41
+ # @return [Object]
42
+ attr_accessor :item
43
+
44
+ # The object type of the currently playing item. Can be one of `track`,
45
+ # `episode`, `ad` or `unknown`.
46
+ # @return [String]
47
+ attr_accessor :currently_playing_type
48
+
49
+ # Allows to update the user interface based on which playback actions are
50
+ # available within the current context.
51
+ # @return [DisallowsObject]
52
+ attr_accessor :actions
53
+
54
+ # A mapping from model property names to API property names.
55
+ def self.names
56
+ @_hash = {} if @_hash.nil?
57
+ @_hash['device'] = 'device'
58
+ @_hash['repeat_state'] = 'repeat_state'
59
+ @_hash['shuffle_state'] = 'shuffle_state'
60
+ @_hash['context'] = 'context'
61
+ @_hash['timestamp'] = 'timestamp'
62
+ @_hash['progress_ms'] = 'progress_ms'
63
+ @_hash['is_playing'] = 'is_playing'
64
+ @_hash['item'] = 'item'
65
+ @_hash['currently_playing_type'] = 'currently_playing_type'
66
+ @_hash['actions'] = 'actions'
67
+ @_hash
68
+ end
69
+
70
+ # An array for optional fields
71
+ def self.optionals
72
+ %w[
73
+ device
74
+ repeat_state
75
+ shuffle_state
76
+ context
77
+ timestamp
78
+ progress_ms
79
+ is_playing
80
+ item
81
+ currently_playing_type
82
+ actions
83
+ ]
84
+ end
85
+
86
+ # An array for nullable fields
87
+ def self.nullables
88
+ []
89
+ end
90
+
91
+ def initialize(device = SKIP, repeat_state = SKIP, shuffle_state = SKIP,
92
+ context = SKIP, timestamp = SKIP, progress_ms = SKIP,
93
+ is_playing = SKIP, item = SKIP,
94
+ currently_playing_type = SKIP, actions = SKIP)
95
+ @device = device unless device == SKIP
96
+ @repeat_state = repeat_state unless repeat_state == SKIP
97
+ @shuffle_state = shuffle_state unless shuffle_state == SKIP
98
+ @context = context unless context == SKIP
99
+ @timestamp = timestamp unless timestamp == SKIP
100
+ @progress_ms = progress_ms unless progress_ms == SKIP
101
+ @is_playing = is_playing unless is_playing == SKIP
102
+ @item = item unless item == SKIP
103
+ @currently_playing_type = currently_playing_type unless currently_playing_type == SKIP
104
+ @actions = actions unless actions == SKIP
105
+ end
106
+
107
+ # Creates an instance of the object from a hash.
108
+ def self.from_hash(hash)
109
+ return nil unless hash
110
+
111
+ # Extract variables from the hash.
112
+ device = DeviceObject.from_hash(hash['device']) if hash['device']
113
+ repeat_state = hash.key?('repeat_state') ? hash['repeat_state'] : SKIP
114
+ shuffle_state = hash.key?('shuffle_state') ? hash['shuffle_state'] : SKIP
115
+ context = ContextObject.from_hash(hash['context']) if hash['context']
116
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
117
+ progress_ms = hash.key?('progress_ms') ? hash['progress_ms'] : SKIP
118
+ is_playing = hash.key?('is_playing') ? hash['is_playing'] : SKIP
119
+ item = hash.key?('item') ? hash['item'] : SKIP
120
+ currently_playing_type =
121
+ hash.key?('currently_playing_type') ? hash['currently_playing_type'] : SKIP
122
+ actions = DisallowsObject.from_hash(hash['actions']) if hash['actions']
123
+
124
+ # Create object from extracted values.
125
+ CurrentlyPlayingContextObject.new(device,
126
+ repeat_state,
127
+ shuffle_state,
128
+ context,
129
+ timestamp,
130
+ progress_ms,
131
+ is_playing,
132
+ item,
133
+ currently_playing_type,
134
+ actions)
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,109 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # CurrentlyPlayingObject Model.
8
+ class CurrentlyPlayingObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A Context Object. Can be `null`.
13
+ # @return [ContextObject]
14
+ attr_accessor :context
15
+
16
+ # Unix Millisecond Timestamp when data was fetched
17
+ # @return [Integer]
18
+ attr_accessor :timestamp
19
+
20
+ # Progress into the currently playing track or episode. Can be `null`.
21
+ # @return [Integer]
22
+ attr_accessor :progress_ms
23
+
24
+ # If something is currently playing, return `true`.
25
+ # @return [TrueClass | FalseClass]
26
+ attr_accessor :is_playing
27
+
28
+ # The currently playing track or episode. Can be `null`.
29
+ # @return [Object]
30
+ attr_accessor :item
31
+
32
+ # The object type of the currently playing item. Can be one of `track`,
33
+ # `episode`, `ad` or `unknown`.
34
+ # @return [String]
35
+ attr_accessor :currently_playing_type
36
+
37
+ # Allows to update the user interface based on which playback actions are
38
+ # available within the current context.
39
+ # @return [DisallowsObject]
40
+ attr_accessor :actions
41
+
42
+ # A mapping from model property names to API property names.
43
+ def self.names
44
+ @_hash = {} if @_hash.nil?
45
+ @_hash['context'] = 'context'
46
+ @_hash['timestamp'] = 'timestamp'
47
+ @_hash['progress_ms'] = 'progress_ms'
48
+ @_hash['is_playing'] = 'is_playing'
49
+ @_hash['item'] = 'item'
50
+ @_hash['currently_playing_type'] = 'currently_playing_type'
51
+ @_hash['actions'] = 'actions'
52
+ @_hash
53
+ end
54
+
55
+ # An array for optional fields
56
+ def self.optionals
57
+ %w[
58
+ context
59
+ timestamp
60
+ progress_ms
61
+ is_playing
62
+ item
63
+ currently_playing_type
64
+ actions
65
+ ]
66
+ end
67
+
68
+ # An array for nullable fields
69
+ def self.nullables
70
+ []
71
+ end
72
+
73
+ def initialize(context = SKIP, timestamp = SKIP, progress_ms = SKIP,
74
+ is_playing = SKIP, item = SKIP,
75
+ currently_playing_type = SKIP, actions = SKIP)
76
+ @context = context unless context == SKIP
77
+ @timestamp = timestamp unless timestamp == SKIP
78
+ @progress_ms = progress_ms unless progress_ms == SKIP
79
+ @is_playing = is_playing unless is_playing == SKIP
80
+ @item = item unless item == SKIP
81
+ @currently_playing_type = currently_playing_type unless currently_playing_type == SKIP
82
+ @actions = actions unless actions == 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
+ context = ContextObject.from_hash(hash['context']) if hash['context']
91
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
92
+ progress_ms = hash.key?('progress_ms') ? hash['progress_ms'] : SKIP
93
+ is_playing = hash.key?('is_playing') ? hash['is_playing'] : SKIP
94
+ item = hash.key?('item') ? hash['item'] : SKIP
95
+ currently_playing_type =
96
+ hash.key?('currently_playing_type') ? hash['currently_playing_type'] : SKIP
97
+ actions = DisallowsObject.from_hash(hash['actions']) if hash['actions']
98
+
99
+ # Create object from extracted values.
100
+ CurrentlyPlayingObject.new(context,
101
+ timestamp,
102
+ progress_ms,
103
+ is_playing,
104
+ item,
105
+ currently_playing_type,
106
+ actions)
107
+ end
108
+ end
109
+ 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
+ # CursorObject Model.
8
+ class CursorObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The cursor to use as key to find the next page of items.
13
+ # @return [String]
14
+ attr_accessor :after
15
+
16
+ # The cursor to use as key to find the previous page of items.
17
+ # @return [String]
18
+ attr_accessor :before
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['after'] = 'after'
24
+ @_hash['before'] = 'before'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ after
32
+ before
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(after = SKIP, before = SKIP)
42
+ @after = after unless after == SKIP
43
+ @before = before unless before == 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
+ after = hash.key?('after') ? hash['after'] : SKIP
52
+ before = hash.key?('before') ? hash['before'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ CursorObject.new(after,
56
+ before)
57
+ end
58
+ end
59
+ 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
+ # CursorPagedArtists Model.
8
+ class CursorPagedArtists < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [CursorPagingSimplifiedArtistObject]
14
+ attr_accessor :artists
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['artists'] = 'artists'
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(artists = nil)
34
+ @artists = artists
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
+ artists = CursorPagingSimplifiedArtistObject.from_hash(hash['artists']) if hash['artists']
43
+
44
+ # Create object from extracted values.
45
+ CursorPagedArtists.new(artists)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,88 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # CursorPagingObject Model.
8
+ class CursorPagingObject < 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 cursors used to find the next set of items.
26
+ # @return [CursorObject]
27
+ attr_accessor :cursors
28
+
29
+ # The total number of items available to return.
30
+ # @return [Integer]
31
+ attr_accessor :total
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['href'] = 'href'
37
+ @_hash['limit'] = 'limit'
38
+ @_hash['mnext'] = 'next'
39
+ @_hash['cursors'] = 'cursors'
40
+ @_hash['total'] = 'total'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ %w[
47
+ href
48
+ limit
49
+ mnext
50
+ cursors
51
+ total
52
+ ]
53
+ end
54
+
55
+ # An array for nullable fields
56
+ def self.nullables
57
+ []
58
+ end
59
+
60
+ def initialize(href = SKIP, limit = SKIP, mnext = SKIP, cursors = SKIP,
61
+ total = SKIP)
62
+ @href = href unless href == SKIP
63
+ @limit = limit unless limit == SKIP
64
+ @mnext = mnext unless mnext == SKIP
65
+ @cursors = cursors unless cursors == SKIP
66
+ @total = total unless total == SKIP
67
+ end
68
+
69
+ # Creates an instance of the object from a hash.
70
+ def self.from_hash(hash)
71
+ return nil unless hash
72
+
73
+ # Extract variables from the hash.
74
+ href = hash.key?('href') ? hash['href'] : SKIP
75
+ limit = hash.key?('limit') ? hash['limit'] : SKIP
76
+ mnext = hash.key?('next') ? hash['next'] : SKIP
77
+ cursors = CursorObject.from_hash(hash['cursors']) if hash['cursors']
78
+ total = hash.key?('total') ? hash['total'] : SKIP
79
+
80
+ # Create object from extracted values.
81
+ CursorPagingObject.new(href,
82
+ limit,
83
+ mnext,
84
+ cursors,
85
+ total)
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,106 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # CursorPagingPlayHistoryObject Model.
8
+ class CursorPagingPlayHistoryObject < 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 cursors used to find the next set of items.
26
+ # @return [CursorObject]
27
+ attr_accessor :cursors
28
+
29
+ # The total number of items available to return.
30
+ # @return [Integer]
31
+ attr_accessor :total
32
+
33
+ # The total number of items available to return.
34
+ # @return [Array[PlayHistoryObject]]
35
+ attr_accessor :items
36
+
37
+ # A mapping from model property names to API property names.
38
+ def self.names
39
+ @_hash = {} if @_hash.nil?
40
+ @_hash['href'] = 'href'
41
+ @_hash['limit'] = 'limit'
42
+ @_hash['mnext'] = 'next'
43
+ @_hash['cursors'] = 'cursors'
44
+ @_hash['total'] = 'total'
45
+ @_hash['items'] = 'items'
46
+ @_hash
47
+ end
48
+
49
+ # An array for optional fields
50
+ def self.optionals
51
+ %w[
52
+ href
53
+ limit
54
+ mnext
55
+ cursors
56
+ total
57
+ items
58
+ ]
59
+ end
60
+
61
+ # An array for nullable fields
62
+ def self.nullables
63
+ []
64
+ end
65
+
66
+ def initialize(href = SKIP, limit = SKIP, mnext = SKIP, cursors = SKIP,
67
+ total = SKIP, items = SKIP)
68
+ @href = href unless href == SKIP
69
+ @limit = limit unless limit == SKIP
70
+ @mnext = mnext unless mnext == SKIP
71
+ @cursors = cursors unless cursors == SKIP
72
+ @total = total unless total == SKIP
73
+ @items = items unless items == SKIP
74
+ end
75
+
76
+ # Creates an instance of the object from a hash.
77
+ def self.from_hash(hash)
78
+ return nil unless hash
79
+
80
+ # Extract variables from the hash.
81
+ href = hash.key?('href') ? hash['href'] : SKIP
82
+ limit = hash.key?('limit') ? hash['limit'] : SKIP
83
+ mnext = hash.key?('next') ? hash['next'] : SKIP
84
+ cursors = CursorObject.from_hash(hash['cursors']) if hash['cursors']
85
+ total = hash.key?('total') ? hash['total'] : SKIP
86
+ # Parameter is an array, so we need to iterate through it
87
+ items = nil
88
+ unless hash['items'].nil?
89
+ items = []
90
+ hash['items'].each do |structure|
91
+ items << (PlayHistoryObject.from_hash(structure) if structure)
92
+ end
93
+ end
94
+
95
+ items = SKIP unless hash.key?('items')
96
+
97
+ # Create object from extracted values.
98
+ CursorPagingPlayHistoryObject.new(href,
99
+ limit,
100
+ mnext,
101
+ cursors,
102
+ total,
103
+ items)
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,106 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # CursorPagingSimplifiedArtistObject Model.
8
+ class CursorPagingSimplifiedArtistObject < 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 cursors used to find the next set of items.
26
+ # @return [CursorObject]
27
+ attr_accessor :cursors
28
+
29
+ # The total number of items available to return.
30
+ # @return [Integer]
31
+ attr_accessor :total
32
+
33
+ # The total number of items available to return.
34
+ # @return [Array[ArtistObject]]
35
+ attr_accessor :items
36
+
37
+ # A mapping from model property names to API property names.
38
+ def self.names
39
+ @_hash = {} if @_hash.nil?
40
+ @_hash['href'] = 'href'
41
+ @_hash['limit'] = 'limit'
42
+ @_hash['mnext'] = 'next'
43
+ @_hash['cursors'] = 'cursors'
44
+ @_hash['total'] = 'total'
45
+ @_hash['items'] = 'items'
46
+ @_hash
47
+ end
48
+
49
+ # An array for optional fields
50
+ def self.optionals
51
+ %w[
52
+ href
53
+ limit
54
+ mnext
55
+ cursors
56
+ total
57
+ items
58
+ ]
59
+ end
60
+
61
+ # An array for nullable fields
62
+ def self.nullables
63
+ []
64
+ end
65
+
66
+ def initialize(href = SKIP, limit = SKIP, mnext = SKIP, cursors = SKIP,
67
+ total = SKIP, items = SKIP)
68
+ @href = href unless href == SKIP
69
+ @limit = limit unless limit == SKIP
70
+ @mnext = mnext unless mnext == SKIP
71
+ @cursors = cursors unless cursors == SKIP
72
+ @total = total unless total == SKIP
73
+ @items = items unless items == SKIP
74
+ end
75
+
76
+ # Creates an instance of the object from a hash.
77
+ def self.from_hash(hash)
78
+ return nil unless hash
79
+
80
+ # Extract variables from the hash.
81
+ href = hash.key?('href') ? hash['href'] : SKIP
82
+ limit = hash.key?('limit') ? hash['limit'] : SKIP
83
+ mnext = hash.key?('next') ? hash['next'] : SKIP
84
+ cursors = CursorObject.from_hash(hash['cursors']) if hash['cursors']
85
+ total = hash.key?('total') ? hash['total'] : SKIP
86
+ # Parameter is an array, so we need to iterate through it
87
+ items = nil
88
+ unless hash['items'].nil?
89
+ items = []
90
+ hash['items'].each do |structure|
91
+ items << (ArtistObject.from_hash(structure) if structure)
92
+ end
93
+ end
94
+
95
+ items = SKIP unless hash.key?('items')
96
+
97
+ # Create object from extracted values.
98
+ CursorPagingSimplifiedArtistObject.new(href,
99
+ limit,
100
+ mnext,
101
+ cursors,
102
+ total,
103
+ items)
104
+ end
105
+ end
106
+ end