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,126 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # DeviceObject Model.
8
+ class DeviceObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The device ID. This ID is unique and persistent to some extent. However,
13
+ # this is not guaranteed and any cached `device_id` should periodically be
14
+ # cleared out and refetched as necessary.
15
+ # @return [String]
16
+ attr_accessor :id
17
+
18
+ # If this device is the currently active device.
19
+ # @return [TrueClass | FalseClass]
20
+ attr_accessor :is_active
21
+
22
+ # If this device is currently in a private session.
23
+ # @return [TrueClass | FalseClass]
24
+ attr_accessor :is_private_session
25
+
26
+ # Whether controlling this device is restricted. At present if this is
27
+ # "true" then no Web API commands will be accepted by this device.
28
+ # @return [TrueClass | FalseClass]
29
+ attr_accessor :is_restricted
30
+
31
+ # A human-readable name for the device. Some devices have a name that the
32
+ # user can configure (e.g. \"Loudest speaker\") and some devices have a
33
+ # generic name associated with the manufacturer or device model.
34
+ # @return [String]
35
+ attr_accessor :name
36
+
37
+ # Device type, such as "computer", "smartphone" or "speaker".
38
+ # @return [String]
39
+ attr_accessor :type
40
+
41
+ # The current volume in percent.
42
+ # @return [Integer]
43
+ attr_accessor :volume_percent
44
+
45
+ # If this device can be used to set the volume.
46
+ # @return [TrueClass | FalseClass]
47
+ attr_accessor :supports_volume
48
+
49
+ # A mapping from model property names to API property names.
50
+ def self.names
51
+ @_hash = {} if @_hash.nil?
52
+ @_hash['id'] = 'id'
53
+ @_hash['is_active'] = 'is_active'
54
+ @_hash['is_private_session'] = 'is_private_session'
55
+ @_hash['is_restricted'] = 'is_restricted'
56
+ @_hash['name'] = 'name'
57
+ @_hash['type'] = 'type'
58
+ @_hash['volume_percent'] = 'volume_percent'
59
+ @_hash['supports_volume'] = 'supports_volume'
60
+ @_hash
61
+ end
62
+
63
+ # An array for optional fields
64
+ def self.optionals
65
+ %w[
66
+ id
67
+ is_active
68
+ is_private_session
69
+ is_restricted
70
+ name
71
+ type
72
+ volume_percent
73
+ supports_volume
74
+ ]
75
+ end
76
+
77
+ # An array for nullable fields
78
+ def self.nullables
79
+ %w[
80
+ id
81
+ volume_percent
82
+ ]
83
+ end
84
+
85
+ def initialize(id = SKIP, is_active = SKIP, is_private_session = SKIP,
86
+ is_restricted = SKIP, name = SKIP, type = SKIP,
87
+ volume_percent = SKIP, supports_volume = SKIP)
88
+ @id = id unless id == SKIP
89
+ @is_active = is_active unless is_active == SKIP
90
+ @is_private_session = is_private_session unless is_private_session == SKIP
91
+ @is_restricted = is_restricted unless is_restricted == SKIP
92
+ @name = name unless name == SKIP
93
+ @type = type unless type == SKIP
94
+ @volume_percent = volume_percent unless volume_percent == SKIP
95
+ @supports_volume = supports_volume unless supports_volume == SKIP
96
+ end
97
+
98
+ # Creates an instance of the object from a hash.
99
+ def self.from_hash(hash)
100
+ return nil unless hash
101
+
102
+ # Extract variables from the hash.
103
+ id = hash.key?('id') ? hash['id'] : SKIP
104
+ is_active = hash.key?('is_active') ? hash['is_active'] : SKIP
105
+ is_private_session =
106
+ hash.key?('is_private_session') ? hash['is_private_session'] : SKIP
107
+ is_restricted = hash.key?('is_restricted') ? hash['is_restricted'] : SKIP
108
+ name = hash.key?('name') ? hash['name'] : SKIP
109
+ type = hash.key?('type') ? hash['type'] : SKIP
110
+ volume_percent =
111
+ hash.key?('volume_percent') ? hash['volume_percent'] : SKIP
112
+ supports_volume =
113
+ hash.key?('supports_volume') ? hash['supports_volume'] : SKIP
114
+
115
+ # Create object from extracted values.
116
+ DeviceObject.new(id,
117
+ is_active,
118
+ is_private_session,
119
+ is_restricted,
120
+ name,
121
+ type,
122
+ volume_percent,
123
+ supports_volume)
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,140 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # DisallowsObject Model.
8
+ class DisallowsObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Interrupting playback. Optional field.
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :interrupting_playback
15
+
16
+ # Pausing. Optional field.
17
+ # @return [TrueClass | FalseClass]
18
+ attr_accessor :pausing
19
+
20
+ # Resuming. Optional field.
21
+ # @return [TrueClass | FalseClass]
22
+ attr_accessor :resuming
23
+
24
+ # Seeking playback location. Optional field.
25
+ # @return [TrueClass | FalseClass]
26
+ attr_accessor :seeking
27
+
28
+ # Skipping to the next context. Optional field.
29
+ # @return [TrueClass | FalseClass]
30
+ attr_accessor :skipping_next
31
+
32
+ # Skipping to the previous context. Optional field.
33
+ # @return [TrueClass | FalseClass]
34
+ attr_accessor :skipping_prev
35
+
36
+ # Toggling repeat context flag. Optional field.
37
+ # @return [TrueClass | FalseClass]
38
+ attr_accessor :toggling_repeat_context
39
+
40
+ # Toggling shuffle flag. Optional field.
41
+ # @return [TrueClass | FalseClass]
42
+ attr_accessor :toggling_shuffle
43
+
44
+ # Toggling repeat track flag. Optional field.
45
+ # @return [TrueClass | FalseClass]
46
+ attr_accessor :toggling_repeat_track
47
+
48
+ # Transfering playback between devices. Optional field.
49
+ # @return [TrueClass | FalseClass]
50
+ attr_accessor :transferring_playback
51
+
52
+ # A mapping from model property names to API property names.
53
+ def self.names
54
+ @_hash = {} if @_hash.nil?
55
+ @_hash['interrupting_playback'] = 'interrupting_playback'
56
+ @_hash['pausing'] = 'pausing'
57
+ @_hash['resuming'] = 'resuming'
58
+ @_hash['seeking'] = 'seeking'
59
+ @_hash['skipping_next'] = 'skipping_next'
60
+ @_hash['skipping_prev'] = 'skipping_prev'
61
+ @_hash['toggling_repeat_context'] = 'toggling_repeat_context'
62
+ @_hash['toggling_shuffle'] = 'toggling_shuffle'
63
+ @_hash['toggling_repeat_track'] = 'toggling_repeat_track'
64
+ @_hash['transferring_playback'] = 'transferring_playback'
65
+ @_hash
66
+ end
67
+
68
+ # An array for optional fields
69
+ def self.optionals
70
+ %w[
71
+ interrupting_playback
72
+ pausing
73
+ resuming
74
+ seeking
75
+ skipping_next
76
+ skipping_prev
77
+ toggling_repeat_context
78
+ toggling_shuffle
79
+ toggling_repeat_track
80
+ transferring_playback
81
+ ]
82
+ end
83
+
84
+ # An array for nullable fields
85
+ def self.nullables
86
+ []
87
+ end
88
+
89
+ def initialize(interrupting_playback = SKIP, pausing = SKIP,
90
+ resuming = SKIP, seeking = SKIP, skipping_next = SKIP,
91
+ skipping_prev = SKIP, toggling_repeat_context = SKIP,
92
+ toggling_shuffle = SKIP, toggling_repeat_track = SKIP,
93
+ transferring_playback = SKIP)
94
+ @interrupting_playback = interrupting_playback unless interrupting_playback == SKIP
95
+ @pausing = pausing unless pausing == SKIP
96
+ @resuming = resuming unless resuming == SKIP
97
+ @seeking = seeking unless seeking == SKIP
98
+ @skipping_next = skipping_next unless skipping_next == SKIP
99
+ @skipping_prev = skipping_prev unless skipping_prev == SKIP
100
+ @toggling_repeat_context = toggling_repeat_context unless toggling_repeat_context == SKIP
101
+ @toggling_shuffle = toggling_shuffle unless toggling_shuffle == SKIP
102
+ @toggling_repeat_track = toggling_repeat_track unless toggling_repeat_track == SKIP
103
+ @transferring_playback = transferring_playback unless transferring_playback == SKIP
104
+ end
105
+
106
+ # Creates an instance of the object from a hash.
107
+ def self.from_hash(hash)
108
+ return nil unless hash
109
+
110
+ # Extract variables from the hash.
111
+ interrupting_playback =
112
+ hash.key?('interrupting_playback') ? hash['interrupting_playback'] : SKIP
113
+ pausing = hash.key?('pausing') ? hash['pausing'] : SKIP
114
+ resuming = hash.key?('resuming') ? hash['resuming'] : SKIP
115
+ seeking = hash.key?('seeking') ? hash['seeking'] : SKIP
116
+ skipping_next = hash.key?('skipping_next') ? hash['skipping_next'] : SKIP
117
+ skipping_prev = hash.key?('skipping_prev') ? hash['skipping_prev'] : SKIP
118
+ toggling_repeat_context =
119
+ hash.key?('toggling_repeat_context') ? hash['toggling_repeat_context'] : SKIP
120
+ toggling_shuffle =
121
+ hash.key?('toggling_shuffle') ? hash['toggling_shuffle'] : SKIP
122
+ toggling_repeat_track =
123
+ hash.key?('toggling_repeat_track') ? hash['toggling_repeat_track'] : SKIP
124
+ transferring_playback =
125
+ hash.key?('transferring_playback') ? hash['transferring_playback'] : SKIP
126
+
127
+ # Create object from extracted values.
128
+ DisallowsObject.new(interrupting_playback,
129
+ pausing,
130
+ resuming,
131
+ seeking,
132
+ skipping_next,
133
+ skipping_prev,
134
+ toggling_repeat_context,
135
+ toggling_shuffle,
136
+ toggling_repeat_track,
137
+ transferring_playback)
138
+ end
139
+ end
140
+ end
@@ -0,0 +1,237 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # EpisodeBase Model.
8
+ class EpisodeBase < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A URL to a 30 second preview (MP3 format) of the episode. `null` if not
13
+ # available.
14
+ # @return [String]
15
+ attr_accessor :audio_preview_url
16
+
17
+ # A description of the episode. HTML tags are stripped away from this field,
18
+ # use `html_description` field in case HTML tags are needed.
19
+ # @return [String]
20
+ attr_accessor :description
21
+
22
+ # A description of the episode. This field may contain HTML tags.
23
+ # @return [String]
24
+ attr_accessor :html_description
25
+
26
+ # The episode length in milliseconds.
27
+ # @return [Integer]
28
+ attr_accessor :duration_ms
29
+
30
+ # Whether or not the episode has explicit content (true = yes it does; false
31
+ # = no it does not OR unknown).
32
+ # @return [TrueClass | FalseClass]
33
+ attr_accessor :explicit
34
+
35
+ # External URLs for this episode.
36
+ # @return [ExternalUrlObject]
37
+ attr_accessor :external_urls
38
+
39
+ # A link to the Web API endpoint providing full details of the episode.
40
+ # @return [String]
41
+ attr_accessor :href
42
+
43
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
44
+ # episode.
45
+ # @return [String]
46
+ attr_accessor :id
47
+
48
+ # The cover art for the episode in various sizes, widest first.
49
+ # @return [Array[ImageObject]]
50
+ attr_accessor :images
51
+
52
+ # True if the episode is hosted outside of Spotify's CDN.
53
+ # @return [TrueClass | FalseClass]
54
+ attr_accessor :is_externally_hosted
55
+
56
+ # True if the episode is playable in the given market. Otherwise false.
57
+ # @return [TrueClass | FalseClass]
58
+ attr_accessor :is_playable
59
+
60
+ # The language used in the episode, identified by a [ISO
61
+ # 639](https://en.wikipedia.org/wiki/ISO_639) code. This field is deprecated
62
+ # and might be removed in the future. Please use the `languages` field
63
+ # instead.
64
+ # @return [String]
65
+ attr_accessor :language
66
+
67
+ # A list of the languages used in the episode, identified by their [ISO
68
+ # 639-1](https://en.wikipedia.org/wiki/ISO_639) code.
69
+ # @return [Array[String]]
70
+ attr_accessor :languages
71
+
72
+ # The name of the episode.
73
+ # @return [String]
74
+ attr_accessor :name
75
+
76
+ # The date the episode was first released, for example `"1981-12-15"`.
77
+ # Depending on the precision, it might be shown as `"1981"` or `"1981-12"`.
78
+ # @return [String]
79
+ attr_accessor :release_date
80
+
81
+ # The precision with which `release_date` value is known.
82
+ # @return [ReleaseDatePrecisionEnum]
83
+ attr_accessor :release_date_precision
84
+
85
+ # The user's most recent position in the episode. Set if the supplied access
86
+ # token is a user token and has the scope 'user-read-playback-position'.
87
+ # @return [ResumePointObject]
88
+ attr_accessor :resume_point
89
+
90
+ # The object type.
91
+ # @return [Type8Enum]
92
+ attr_accessor :type
93
+
94
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
95
+ # the episode.
96
+ # @return [String]
97
+ attr_accessor :uri
98
+
99
+ # Included in the response when a content restriction is applied.
100
+ # @return [EpisodeRestrictionObject]
101
+ attr_accessor :restrictions
102
+
103
+ # A mapping from model property names to API property names.
104
+ def self.names
105
+ @_hash = {} if @_hash.nil?
106
+ @_hash['audio_preview_url'] = 'audio_preview_url'
107
+ @_hash['description'] = 'description'
108
+ @_hash['html_description'] = 'html_description'
109
+ @_hash['duration_ms'] = 'duration_ms'
110
+ @_hash['explicit'] = 'explicit'
111
+ @_hash['external_urls'] = 'external_urls'
112
+ @_hash['href'] = 'href'
113
+ @_hash['id'] = 'id'
114
+ @_hash['images'] = 'images'
115
+ @_hash['is_externally_hosted'] = 'is_externally_hosted'
116
+ @_hash['is_playable'] = 'is_playable'
117
+ @_hash['language'] = 'language'
118
+ @_hash['languages'] = 'languages'
119
+ @_hash['name'] = 'name'
120
+ @_hash['release_date'] = 'release_date'
121
+ @_hash['release_date_precision'] = 'release_date_precision'
122
+ @_hash['resume_point'] = 'resume_point'
123
+ @_hash['type'] = 'type'
124
+ @_hash['uri'] = 'uri'
125
+ @_hash['restrictions'] = 'restrictions'
126
+ @_hash
127
+ end
128
+
129
+ # An array for optional fields
130
+ def self.optionals
131
+ %w[
132
+ language
133
+ resume_point
134
+ restrictions
135
+ ]
136
+ end
137
+
138
+ # An array for nullable fields
139
+ def self.nullables
140
+ %w[
141
+ audio_preview_url
142
+ ]
143
+ end
144
+
145
+ def initialize(audio_preview_url = nil, description = nil,
146
+ html_description = nil, duration_ms = nil, explicit = nil,
147
+ external_urls = nil, href = nil, id = nil, images = nil,
148
+ is_externally_hosted = nil, is_playable = nil,
149
+ languages = nil, name = nil, release_date = nil,
150
+ release_date_precision = nil, type = nil, uri = nil,
151
+ language = SKIP, resume_point = SKIP, restrictions = SKIP)
152
+ @audio_preview_url = audio_preview_url
153
+ @description = description
154
+ @html_description = html_description
155
+ @duration_ms = duration_ms
156
+ @explicit = explicit
157
+ @external_urls = external_urls
158
+ @href = href
159
+ @id = id
160
+ @images = images
161
+ @is_externally_hosted = is_externally_hosted
162
+ @is_playable = is_playable
163
+ @language = language unless language == SKIP
164
+ @languages = languages
165
+ @name = name
166
+ @release_date = release_date
167
+ @release_date_precision = release_date_precision
168
+ @resume_point = resume_point unless resume_point == SKIP
169
+ @type = type
170
+ @uri = uri
171
+ @restrictions = restrictions unless restrictions == SKIP
172
+ end
173
+
174
+ # Creates an instance of the object from a hash.
175
+ def self.from_hash(hash)
176
+ return nil unless hash
177
+
178
+ # Extract variables from the hash.
179
+ audio_preview_url =
180
+ hash.key?('audio_preview_url') ? hash['audio_preview_url'] : nil
181
+ description = hash.key?('description') ? hash['description'] : nil
182
+ html_description =
183
+ hash.key?('html_description') ? hash['html_description'] : nil
184
+ duration_ms = hash.key?('duration_ms') ? hash['duration_ms'] : nil
185
+ explicit = hash.key?('explicit') ? hash['explicit'] : nil
186
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
187
+ href = hash.key?('href') ? hash['href'] : nil
188
+ id = hash.key?('id') ? hash['id'] : nil
189
+ # Parameter is an array, so we need to iterate through it
190
+ images = nil
191
+ unless hash['images'].nil?
192
+ images = []
193
+ hash['images'].each do |structure|
194
+ images << (ImageObject.from_hash(structure) if structure)
195
+ end
196
+ end
197
+
198
+ images = nil unless hash.key?('images')
199
+ is_externally_hosted =
200
+ hash.key?('is_externally_hosted') ? hash['is_externally_hosted'] : nil
201
+ is_playable = hash.key?('is_playable') ? hash['is_playable'] : nil
202
+ languages = hash.key?('languages') ? hash['languages'] : nil
203
+ name = hash.key?('name') ? hash['name'] : nil
204
+ release_date = hash.key?('release_date') ? hash['release_date'] : nil
205
+ release_date_precision =
206
+ hash.key?('release_date_precision') ? hash['release_date_precision'] : nil
207
+ type = hash.key?('type') ? hash['type'] : nil
208
+ uri = hash.key?('uri') ? hash['uri'] : nil
209
+ language = hash.key?('language') ? hash['language'] : SKIP
210
+ resume_point = ResumePointObject.from_hash(hash['resume_point']) if hash['resume_point']
211
+ restrictions = EpisodeRestrictionObject.from_hash(hash['restrictions']) if
212
+ hash['restrictions']
213
+
214
+ # Create object from extracted values.
215
+ EpisodeBase.new(audio_preview_url,
216
+ description,
217
+ html_description,
218
+ duration_ms,
219
+ explicit,
220
+ external_urls,
221
+ href,
222
+ id,
223
+ images,
224
+ is_externally_hosted,
225
+ is_playable,
226
+ languages,
227
+ name,
228
+ release_date,
229
+ release_date_precision,
230
+ type,
231
+ uri,
232
+ language,
233
+ resume_point,
234
+ restrictions)
235
+ end
236
+ end
237
+ end