spotify-apimatic-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +30 -0
  3. data/README.md +170 -0
  4. data/bin/console +15 -0
  5. data/lib/spotify_web_api/api_helper.rb +10 -0
  6. data/lib/spotify_web_api/client.rb +165 -0
  7. data/lib/spotify_web_api/configuration.rb +244 -0
  8. data/lib/spotify_web_api/controllers/albums_controller.rb +297 -0
  9. data/lib/spotify_web_api/controllers/artists_controller.rb +188 -0
  10. data/lib/spotify_web_api/controllers/audiobooks_controller.rb +258 -0
  11. data/lib/spotify_web_api/controllers/base_controller.rb +60 -0
  12. data/lib/spotify_web_api/controllers/categories_controller.rb +84 -0
  13. data/lib/spotify_web_api/controllers/chapters_controller.rb +82 -0
  14. data/lib/spotify_web_api/controllers/episodes_controller.rb +241 -0
  15. data/lib/spotify_web_api/controllers/genres_controller.rb +39 -0
  16. data/lib/spotify_web_api/controllers/markets_controller.rb +38 -0
  17. data/lib/spotify_web_api/controllers/o_auth_authorization_controller.rb +82 -0
  18. data/lib/spotify_web_api/controllers/player_controller.rb +525 -0
  19. data/lib/spotify_web_api/controllers/playlists_controller.rb +538 -0
  20. data/lib/spotify_web_api/controllers/search_controller.rb +61 -0
  21. data/lib/spotify_web_api/controllers/shows_controller.rb +263 -0
  22. data/lib/spotify_web_api/controllers/tracks_controller.rb +534 -0
  23. data/lib/spotify_web_api/controllers/users_controller.rb +402 -0
  24. data/lib/spotify_web_api/exceptions/api_exception.rb +21 -0
  25. data/lib/spotify_web_api/exceptions/bad_request_exception.rb +46 -0
  26. data/lib/spotify_web_api/exceptions/forbidden_exception.rb +46 -0
  27. data/lib/spotify_web_api/exceptions/not_found_exception.rb +46 -0
  28. data/lib/spotify_web_api/exceptions/o_auth_provider_exception.rb +64 -0
  29. data/lib/spotify_web_api/exceptions/too_many_requests_exception.rb +46 -0
  30. data/lib/spotify_web_api/exceptions/unauthorized_exception.rb +46 -0
  31. data/lib/spotify_web_api/http/api_response.rb +19 -0
  32. data/lib/spotify_web_api/http/auth/o_auth2.rb +164 -0
  33. data/lib/spotify_web_api/http/http_call_back.rb +10 -0
  34. data/lib/spotify_web_api/http/http_method_enum.rb +10 -0
  35. data/lib/spotify_web_api/http/http_request.rb +10 -0
  36. data/lib/spotify_web_api/http/http_response.rb +10 -0
  37. data/lib/spotify_web_api/http/proxy_settings.rb +22 -0
  38. data/lib/spotify_web_api/models/album_base.rb +189 -0
  39. data/lib/spotify_web_api/models/album_group_enum.rb +44 -0
  40. data/lib/spotify_web_api/models/album_object.rb +273 -0
  41. data/lib/spotify_web_api/models/album_restriction_object.rb +75 -0
  42. data/lib/spotify_web_api/models/album_type_enum.rb +40 -0
  43. data/lib/spotify_web_api/models/artist_discography_album_object.rb +216 -0
  44. data/lib/spotify_web_api/models/artist_object.rb +174 -0
  45. data/lib/spotify_web_api/models/audio_analysis_object.rb +171 -0
  46. data/lib/spotify_web_api/models/audio_features_object.rb +273 -0
  47. data/lib/spotify_web_api/models/audiobook_base.rb +270 -0
  48. data/lib/spotify_web_api/models/audiobook_object.rb +278 -0
  49. data/lib/spotify_web_api/models/author_object.rb +62 -0
  50. data/lib/spotify_web_api/models/base_model.rb +110 -0
  51. data/lib/spotify_web_api/models/categories.rb +125 -0
  52. data/lib/spotify_web_api/models/category_object.rb +95 -0
  53. data/lib/spotify_web_api/models/chapter_base.rb +265 -0
  54. data/lib/spotify_web_api/models/chapter_object.rb +273 -0
  55. data/lib/spotify_web_api/models/chapter_restriction_object.rb +71 -0
  56. data/lib/spotify_web_api/models/context_object.rb +102 -0
  57. data/lib/spotify_web_api/models/copyright_object.rb +82 -0
  58. data/lib/spotify_web_api/models/currently_playing_context_object.rb +168 -0
  59. data/lib/spotify_web_api/models/currently_playing_object.rb +138 -0
  60. data/lib/spotify_web_api/models/cursor_object.rb +71 -0
  61. data/lib/spotify_web_api/models/cursor_paged_artists.rb +60 -0
  62. data/lib/spotify_web_api/models/cursor_paging_object.rb +102 -0
  63. data/lib/spotify_web_api/models/cursor_paging_play_history_object.rb +120 -0
  64. data/lib/spotify_web_api/models/cursor_paging_simplified_artist_object.rb +120 -0
  65. data/lib/spotify_web_api/models/device_object.rb +153 -0
  66. data/lib/spotify_web_api/models/disallows_object.rb +171 -0
  67. data/lib/spotify_web_api/models/episode_base.rb +263 -0
  68. data/lib/spotify_web_api/models/episode_object.rb +368 -0
  69. data/lib/spotify_web_api/models/episode_restriction_object.rb +80 -0
  70. data/lib/spotify_web_api/models/error_object.rb +71 -0
  71. data/lib/spotify_web_api/models/explicit_content_settings_object.rb +74 -0
  72. data/lib/spotify_web_api/models/external_id_object.rb +94 -0
  73. data/lib/spotify_web_api/models/external_url_object.rb +73 -0
  74. data/lib/spotify_web_api/models/followers_object.rb +84 -0
  75. data/lib/spotify_web_api/models/image_object.rb +106 -0
  76. data/lib/spotify_web_api/models/include_external_enum.rb +29 -0
  77. data/lib/spotify_web_api/models/item_type1_enum.rb +26 -0
  78. data/lib/spotify_web_api/models/item_type2_enum.rb +36 -0
  79. data/lib/spotify_web_api/models/item_type3_enum.rb +36 -0
  80. data/lib/spotify_web_api/models/item_type_enum.rb +56 -0
  81. data/lib/spotify_web_api/models/linked_track_object.rb +113 -0
  82. data/lib/spotify_web_api/models/many_albums.rb +69 -0
  83. data/lib/spotify_web_api/models/many_artists.rb +69 -0
  84. data/lib/spotify_web_api/models/many_audio_features.rb +69 -0
  85. data/lib/spotify_web_api/models/many_audiobooks.rb +69 -0
  86. data/lib/spotify_web_api/models/many_chapters.rb +69 -0
  87. data/lib/spotify_web_api/models/many_devices.rb +69 -0
  88. data/lib/spotify_web_api/models/many_episodes.rb +69 -0
  89. data/lib/spotify_web_api/models/many_genres.rb +60 -0
  90. data/lib/spotify_web_api/models/many_simplified_shows.rb +69 -0
  91. data/lib/spotify_web_api/models/many_tracks.rb +69 -0
  92. data/lib/spotify_web_api/models/markets.rb +62 -0
  93. data/lib/spotify_web_api/models/me_albums_request.rb +67 -0
  94. data/lib/spotify_web_api/models/me_episodes_request.rb +64 -0
  95. data/lib/spotify_web_api/models/me_episodes_request1.rb +66 -0
  96. data/lib/spotify_web_api/models/me_following_request.rb +65 -0
  97. data/lib/spotify_web_api/models/me_following_request1.rb +67 -0
  98. data/lib/spotify_web_api/models/me_player_play_request.rb +103 -0
  99. data/lib/spotify_web_api/models/me_player_request.rb +75 -0
  100. data/lib/spotify_web_api/models/me_shows_request.rb +67 -0
  101. data/lib/spotify_web_api/models/me_tracks_request.rb +65 -0
  102. data/lib/spotify_web_api/models/me_tracks_request1.rb +67 -0
  103. data/lib/spotify_web_api/models/meta.rb +127 -0
  104. data/lib/spotify_web_api/models/mode_enum.rb +50 -0
  105. data/lib/spotify_web_api/models/narrator_object.rb +62 -0
  106. data/lib/spotify_web_api/models/o_auth_provider_error_enum.rb +62 -0
  107. data/lib/spotify_web_api/models/o_auth_scope_enum.rb +124 -0
  108. data/lib/spotify_web_api/models/o_auth_token.rb +96 -0
  109. data/lib/spotify_web_api/models/paged_albums.rb +60 -0
  110. data/lib/spotify_web_api/models/paged_categories.rb +60 -0
  111. data/lib/spotify_web_api/models/paging_artist_discography_album_object.rb +125 -0
  112. data/lib/spotify_web_api/models/paging_artist_object.rb +125 -0
  113. data/lib/spotify_web_api/models/paging_featured_playlist_object.rb +71 -0
  114. data/lib/spotify_web_api/models/paging_object.rb +107 -0
  115. data/lib/spotify_web_api/models/paging_playlist_object.rb +125 -0
  116. data/lib/spotify_web_api/models/paging_playlist_track_object.rb +125 -0
  117. data/lib/spotify_web_api/models/paging_saved_album_object.rb +125 -0
  118. data/lib/spotify_web_api/models/paging_saved_audiobook_object.rb +125 -0
  119. data/lib/spotify_web_api/models/paging_saved_episode_object.rb +125 -0
  120. data/lib/spotify_web_api/models/paging_saved_show_object.rb +125 -0
  121. data/lib/spotify_web_api/models/paging_saved_track_object.rb +125 -0
  122. data/lib/spotify_web_api/models/paging_simplified_album_object.rb +125 -0
  123. data/lib/spotify_web_api/models/paging_simplified_audiobook_object.rb +125 -0
  124. data/lib/spotify_web_api/models/paging_simplified_chapter_object.rb +125 -0
  125. data/lib/spotify_web_api/models/paging_simplified_episode_object.rb +125 -0
  126. data/lib/spotify_web_api/models/paging_simplified_show_object.rb +125 -0
  127. data/lib/spotify_web_api/models/paging_simplified_track_object.rb +125 -0
  128. data/lib/spotify_web_api/models/paging_track_object.rb +125 -0
  129. data/lib/spotify_web_api/models/play_history_object.rb +90 -0
  130. data/lib/spotify_web_api/models/playlist_object.rb +213 -0
  131. data/lib/spotify_web_api/models/playlist_owner_object.rb +124 -0
  132. data/lib/spotify_web_api/models/playlist_snapshot_id.rb +62 -0
  133. data/lib/spotify_web_api/models/playlist_track_object.rb +116 -0
  134. data/lib/spotify_web_api/models/playlist_tracks_ref_object.rb +72 -0
  135. data/lib/spotify_web_api/models/playlist_user_object.rb +122 -0
  136. data/lib/spotify_web_api/models/playlists_followers_request.rb +63 -0
  137. data/lib/spotify_web_api/models/playlists_request.rb +96 -0
  138. data/lib/spotify_web_api/models/playlists_tracks_request.rb +84 -0
  139. data/lib/spotify_web_api/models/playlists_tracks_request1.rb +112 -0
  140. data/lib/spotify_web_api/models/playlists_tracks_request2.rb +87 -0
  141. data/lib/spotify_web_api/models/private_user_object.rb +200 -0
  142. data/lib/spotify_web_api/models/public_user_object.rb +144 -0
  143. data/lib/spotify_web_api/models/queue_object.rb +86 -0
  144. data/lib/spotify_web_api/models/reason_enum.rb +43 -0
  145. data/lib/spotify_web_api/models/recommendation_seed_object.rb +120 -0
  146. data/lib/spotify_web_api/models/recommendations_object.rb +86 -0
  147. data/lib/spotify_web_api/models/release_date_precision_enum.rb +40 -0
  148. data/lib/spotify_web_api/models/resume_point_object.rb +84 -0
  149. data/lib/spotify_web_api/models/saved_album_object.rb +85 -0
  150. data/lib/spotify_web_api/models/saved_audiobook_object.rb +85 -0
  151. data/lib/spotify_web_api/models/saved_episode_object.rb +82 -0
  152. data/lib/spotify_web_api/models/saved_show_object.rb +85 -0
  153. data/lib/spotify_web_api/models/saved_track_object.rb +85 -0
  154. data/lib/spotify_web_api/models/search_items.rb +122 -0
  155. data/lib/spotify_web_api/models/section_object.rb +201 -0
  156. data/lib/spotify_web_api/models/segment_object.rb +184 -0
  157. data/lib/spotify_web_api/models/show_base.rb +327 -0
  158. data/lib/spotify_web_api/models/show_object.rb +243 -0
  159. data/lib/spotify_web_api/models/simplified_album_object.rb +284 -0
  160. data/lib/spotify_web_api/models/simplified_artist_object.rb +122 -0
  161. data/lib/spotify_web_api/models/simplified_playlist_object.rb +203 -0
  162. data/lib/spotify_web_api/models/simplified_track_object.rb +251 -0
  163. data/lib/spotify_web_api/models/time_interval_object.rb +81 -0
  164. data/lib/spotify_web_api/models/track.rb +367 -0
  165. data/lib/spotify_web_api/models/track1.rb +62 -0
  166. data/lib/spotify_web_api/models/track_object.rb +301 -0
  167. data/lib/spotify_web_api/models/track_restriction_object.rb +80 -0
  168. data/lib/spotify_web_api/models/type2_enum.rb +26 -0
  169. data/lib/spotify_web_api/models/type3_enum.rb +26 -0
  170. data/lib/spotify_web_api/models/type4_enum.rb +26 -0
  171. data/lib/spotify_web_api/models/type5_enum.rb +26 -0
  172. data/lib/spotify_web_api/models/type6_enum.rb +26 -0
  173. data/lib/spotify_web_api/models/type8_enum.rb +26 -0
  174. data/lib/spotify_web_api/models/type9_enum.rb +26 -0
  175. data/lib/spotify_web_api/models/type_enum.rb +26 -0
  176. data/lib/spotify_web_api/models/users_playlists_request.rb +101 -0
  177. data/lib/spotify_web_api/utilities/date_time_helper.rb +11 -0
  178. data/lib/spotify_web_api/utilities/file_wrapper.rb +28 -0
  179. data/lib/spotify_web_api/utilities/union_type_lookup.rb +73 -0
  180. data/lib/spotify_web_api.rb +200 -0
  181. metadata +264 -0
@@ -0,0 +1,138 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # 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') ? APIHelper.deserialize_union_type(
95
+ UnionTypeLookUp.get(:CurrentlyPlayingObjectItem), hash['item']
96
+ ) : SKIP
97
+ currently_playing_type =
98
+ hash.key?('currently_playing_type') ? hash['currently_playing_type'] : SKIP
99
+ actions = DisallowsObject.from_hash(hash['actions']) if hash['actions']
100
+
101
+ # Create object from extracted values.
102
+ CurrentlyPlayingObject.new(context,
103
+ timestamp,
104
+ progress_ms,
105
+ is_playing,
106
+ item,
107
+ currently_playing_type,
108
+ actions)
109
+ end
110
+
111
+ # Validates an instance of the object from a given value.
112
+ # @param [CurrentlyPlayingObject | Hash] The value against the validation is performed.
113
+ def self.validate(value)
114
+ return true if value.instance_of? self
115
+
116
+ return false unless value.instance_of? Hash
117
+
118
+ true
119
+ end
120
+
121
+ # Provides a human-readable string representation of the object.
122
+ def to_s
123
+ class_name = self.class.name.split('::').last
124
+ "<#{class_name} context: #{@context}, timestamp: #{@timestamp}, progress_ms:"\
125
+ " #{@progress_ms}, is_playing: #{@is_playing}, item: #{@item}, currently_playing_type:"\
126
+ " #{@currently_playing_type}, actions: #{@actions}>"
127
+ end
128
+
129
+ # Provides a debugging-friendly string with detailed object information.
130
+ def inspect
131
+ class_name = self.class.name.split('::').last
132
+ "<#{class_name} context: #{@context.inspect}, timestamp: #{@timestamp.inspect},"\
133
+ " progress_ms: #{@progress_ms.inspect}, is_playing: #{@is_playing.inspect}, item:"\
134
+ " #{@item.inspect}, currently_playing_type: #{@currently_playing_type.inspect}, actions:"\
135
+ " #{@actions.inspect}>"
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,71 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # 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
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} after: #{@after}, before: #{@before}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} after: #{@after.inspect}, before: #{@before.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,60 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # 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
+
48
+ # Provides a human-readable string representation of the object.
49
+ def to_s
50
+ class_name = self.class.name.split('::').last
51
+ "<#{class_name} artists: #{@artists}>"
52
+ end
53
+
54
+ # Provides a debugging-friendly string with detailed object information.
55
+ def inspect
56
+ class_name = self.class.name.split('::').last
57
+ "<#{class_name} artists: #{@artists.inspect}>"
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,102 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # 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
+
88
+ # Provides a human-readable string representation of the object.
89
+ def to_s
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} href: #{@href}, limit: #{@limit}, mnext: #{@mnext}, cursors: #{@cursors},"\
92
+ " total: #{@total}>"
93
+ end
94
+
95
+ # Provides a debugging-friendly string with detailed object information.
96
+ def inspect
97
+ class_name = self.class.name.split('::').last
98
+ "<#{class_name} href: #{@href.inspect}, limit: #{@limit.inspect}, mnext: #{@mnext.inspect},"\
99
+ " cursors: #{@cursors.inspect}, total: #{@total.inspect}>"
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,120 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # 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
+
106
+ # Provides a human-readable string representation of the object.
107
+ def to_s
108
+ class_name = self.class.name.split('::').last
109
+ "<#{class_name} href: #{@href}, limit: #{@limit}, mnext: #{@mnext}, cursors: #{@cursors},"\
110
+ " total: #{@total}, items: #{@items}>"
111
+ end
112
+
113
+ # Provides a debugging-friendly string with detailed object information.
114
+ def inspect
115
+ class_name = self.class.name.split('::').last
116
+ "<#{class_name} href: #{@href.inspect}, limit: #{@limit.inspect}, mnext: #{@mnext.inspect},"\
117
+ " cursors: #{@cursors.inspect}, total: #{@total.inspect}, items: #{@items.inspect}>"
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,120 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # 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
+
106
+ # Provides a human-readable string representation of the object.
107
+ def to_s
108
+ class_name = self.class.name.split('::').last
109
+ "<#{class_name} href: #{@href}, limit: #{@limit}, mnext: #{@mnext}, cursors: #{@cursors},"\
110
+ " total: #{@total}, items: #{@items}>"
111
+ end
112
+
113
+ # Provides a debugging-friendly string with detailed object information.
114
+ def inspect
115
+ class_name = self.class.name.split('::').last
116
+ "<#{class_name} href: #{@href.inspect}, limit: #{@limit.inspect}, mnext: #{@mnext.inspect},"\
117
+ " cursors: #{@cursors.inspect}, total: #{@total.inspect}, items: #{@items.inspect}>"
118
+ end
119
+ end
120
+ end