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,180 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # SectionObject Model.
8
+ class SectionObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The starting point (in seconds) of the section.
13
+ # @return [Float]
14
+ attr_accessor :start
15
+
16
+ # The duration (in seconds) of the section.
17
+ # @return [Float]
18
+ attr_accessor :duration
19
+
20
+ # The confidence, from 0.0 to 1.0, of the reliability of the section's
21
+ # "designation".
22
+ # @return [Float]
23
+ attr_accessor :confidence
24
+
25
+ # The overall loudness of the section in decibels (dB). Loudness values are
26
+ # useful for comparing relative loudness of sections within tracks.
27
+ # @return [Float]
28
+ attr_accessor :loudness
29
+
30
+ # The overall estimated tempo of the section in beats per minute (BPM). In
31
+ # musical terminology, tempo is the speed or pace of a given piece and
32
+ # derives directly from the average beat duration.
33
+ # @return [Float]
34
+ attr_accessor :tempo
35
+
36
+ # The confidence, from 0.0 to 1.0, of the reliability of the tempo. Some
37
+ # tracks contain tempo changes or sounds which don't contain tempo (like
38
+ # pure speech) which would correspond to a low value in this field.
39
+ # @return [Float]
40
+ attr_accessor :tempo_confidence
41
+
42
+ # The estimated overall key of the section. The values in this field ranging
43
+ # from 0 to 11 mapping to pitches using standard Pitch Class notation (E.g.
44
+ # 0 = C, 1 = C♯/D♭, 2 = D, and so on). If no key was detected, the value is
45
+ # -1.
46
+ # @return [Integer]
47
+ attr_accessor :key
48
+
49
+ # The confidence, from 0.0 to 1.0, of the reliability of the key. Songs with
50
+ # many key changes may correspond to low values in this field.
51
+ # @return [Float]
52
+ attr_accessor :key_confidence
53
+
54
+ # Indicates the modality (major or minor) of a section, the type of scale
55
+ # from which its melodic content is derived. This field will contain a 0 for
56
+ # "minor", a 1 for "major", or a -1 for no result. Note that the major key
57
+ # (e.g. C major) could more likely be confused with the minor key at 3
58
+ # semitones lower (e.g. A minor) as both keys carry the same pitches.
59
+ # @return [ModeEnum]
60
+ attr_accessor :mode
61
+
62
+ # The confidence, from 0.0 to 1.0, of the reliability of the `mode`.
63
+ # @return [Float]
64
+ attr_accessor :mode_confidence
65
+
66
+ # An estimated time signature. The time signature (meter) is a notational
67
+ # convention to specify how many beats are in each bar (or measure). The
68
+ # time signature ranges from 3 to 7 indicating time signatures of "3/4", to
69
+ # "7/4".
70
+ # @return [Integer]
71
+ attr_accessor :time_signature
72
+
73
+ # The confidence, from 0.0 to 1.0, of the reliability of the
74
+ # `time_signature`. Sections with time signature changes may correspond to
75
+ # low values in this field.
76
+ # @return [Float]
77
+ attr_accessor :time_signature_confidence
78
+
79
+ # A mapping from model property names to API property names.
80
+ def self.names
81
+ @_hash = {} if @_hash.nil?
82
+ @_hash['start'] = 'start'
83
+ @_hash['duration'] = 'duration'
84
+ @_hash['confidence'] = 'confidence'
85
+ @_hash['loudness'] = 'loudness'
86
+ @_hash['tempo'] = 'tempo'
87
+ @_hash['tempo_confidence'] = 'tempo_confidence'
88
+ @_hash['key'] = 'key'
89
+ @_hash['key_confidence'] = 'key_confidence'
90
+ @_hash['mode'] = 'mode'
91
+ @_hash['mode_confidence'] = 'mode_confidence'
92
+ @_hash['time_signature'] = 'time_signature'
93
+ @_hash['time_signature_confidence'] = 'time_signature_confidence'
94
+ @_hash
95
+ end
96
+
97
+ # An array for optional fields
98
+ def self.optionals
99
+ %w[
100
+ start
101
+ duration
102
+ confidence
103
+ loudness
104
+ tempo
105
+ tempo_confidence
106
+ key
107
+ key_confidence
108
+ mode
109
+ mode_confidence
110
+ time_signature
111
+ time_signature_confidence
112
+ ]
113
+ end
114
+
115
+ # An array for nullable fields
116
+ def self.nullables
117
+ []
118
+ end
119
+
120
+ def initialize(start = SKIP, duration = SKIP, confidence = SKIP,
121
+ loudness = SKIP, tempo = SKIP, tempo_confidence = SKIP,
122
+ key = SKIP, key_confidence = SKIP, mode = SKIP,
123
+ mode_confidence = SKIP, time_signature = SKIP,
124
+ time_signature_confidence = SKIP)
125
+ @start = start unless start == SKIP
126
+ @duration = duration unless duration == SKIP
127
+ @confidence = confidence unless confidence == SKIP
128
+ @loudness = loudness unless loudness == SKIP
129
+ @tempo = tempo unless tempo == SKIP
130
+ @tempo_confidence = tempo_confidence unless tempo_confidence == SKIP
131
+ @key = key unless key == SKIP
132
+ @key_confidence = key_confidence unless key_confidence == SKIP
133
+ @mode = mode unless mode == SKIP
134
+ @mode_confidence = mode_confidence unless mode_confidence == SKIP
135
+ @time_signature = time_signature unless time_signature == SKIP
136
+ unless time_signature_confidence == SKIP
137
+ @time_signature_confidence =
138
+ time_signature_confidence
139
+ end
140
+ end
141
+
142
+ # Creates an instance of the object from a hash.
143
+ def self.from_hash(hash)
144
+ return nil unless hash
145
+
146
+ # Extract variables from the hash.
147
+ start = hash.key?('start') ? hash['start'] : SKIP
148
+ duration = hash.key?('duration') ? hash['duration'] : SKIP
149
+ confidence = hash.key?('confidence') ? hash['confidence'] : SKIP
150
+ loudness = hash.key?('loudness') ? hash['loudness'] : SKIP
151
+ tempo = hash.key?('tempo') ? hash['tempo'] : SKIP
152
+ tempo_confidence =
153
+ hash.key?('tempo_confidence') ? hash['tempo_confidence'] : SKIP
154
+ key = hash.key?('key') ? hash['key'] : SKIP
155
+ key_confidence =
156
+ hash.key?('key_confidence') ? hash['key_confidence'] : SKIP
157
+ mode = hash.key?('mode') ? hash['mode'] : SKIP
158
+ mode_confidence =
159
+ hash.key?('mode_confidence') ? hash['mode_confidence'] : SKIP
160
+ time_signature =
161
+ hash.key?('time_signature') ? hash['time_signature'] : SKIP
162
+ time_signature_confidence =
163
+ hash.key?('time_signature_confidence') ? hash['time_signature_confidence'] : SKIP
164
+
165
+ # Create object from extracted values.
166
+ SectionObject.new(start,
167
+ duration,
168
+ confidence,
169
+ loudness,
170
+ tempo,
171
+ tempo_confidence,
172
+ key,
173
+ key_confidence,
174
+ mode,
175
+ mode_confidence,
176
+ time_signature,
177
+ time_signature_confidence)
178
+ end
179
+ end
180
+ end
@@ -0,0 +1,166 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # SegmentObject Model.
8
+ class SegmentObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The starting point (in seconds) of the segment.
13
+ # @return [Float]
14
+ attr_accessor :start
15
+
16
+ # The duration (in seconds) of the segment.
17
+ # @return [Float]
18
+ attr_accessor :duration
19
+
20
+ # The confidence, from 0.0 to 1.0, of the reliability of the segmentation.
21
+ # Segments of the song which are difficult to logically segment (e.g: noise)
22
+ # may correspond to low values in this field.
23
+ # @return [Float]
24
+ attr_accessor :confidence
25
+
26
+ # The onset loudness of the segment in decibels (dB). Combined with
27
+ # `loudness_max` and `loudness_max_time`, these components can be used to
28
+ # describe the "attack" of the segment.
29
+ # @return [Float]
30
+ attr_accessor :loudness_start
31
+
32
+ # The peak loudness of the segment in decibels (dB). Combined with
33
+ # `loudness_start` and `loudness_max_time`, these components can be used to
34
+ # describe the "attack" of the segment.
35
+ # @return [Float]
36
+ attr_accessor :loudness_max
37
+
38
+ # The segment-relative offset of the segment peak loudness in seconds.
39
+ # Combined with `loudness_start` and `loudness_max`, these components can be
40
+ # used to desctibe the "attack" of the segment.
41
+ # @return [Float]
42
+ attr_accessor :loudness_max_time
43
+
44
+ # The offset loudness of the segment in decibels (dB). This value should be
45
+ # equivalent to the loudness_start of the following segment.
46
+ # @return [Float]
47
+ attr_accessor :loudness_end
48
+
49
+ # Pitch content is given by a “chroma” vector, corresponding to the 12 pitch
50
+ # classes C, C#, D to B, with values ranging from 0 to 1 that describe the
51
+ # relative dominance of every pitch in the chromatic scale. For example a C
52
+ # Major chord would likely be represented by large values of C, E and G
53
+ # (i.e. classes 0, 4, and 7).
54
+ # Vectors are normalized to 1 by their strongest dimension, therefore noisy
55
+ # sounds are likely represented by values that are all close to 1, while
56
+ # pure tones are described by one value at 1 (the pitch) and others near 0.
57
+ # As can be seen below, the 12 vector indices are a combination of low-power
58
+ # spectrum values at their respective pitch frequencies.
59
+ # ![pitch
60
+ # vector](https://developer.spotify.com/assets/audio/Pitch_vector.png)
61
+ # @return [Array[Float]]
62
+ attr_accessor :pitches
63
+
64
+ # Timbre is the quality of a musical note or sound that distinguishes
65
+ # different types of musical instruments, or voices. It is a complex notion
66
+ # also referred to as sound color, texture, or tone quality, and is derived
67
+ # from the shape of a segment’s spectro-temporal surface, independently of
68
+ # pitch and loudness. The timbre feature is a vector that includes 12
69
+ # unbounded values roughly centered around 0. Those values are high level
70
+ # abstractions of the spectral surface, ordered by degree of importance.
71
+ # For completeness however, the first dimension represents the average
72
+ # loudness of the segment; second emphasizes brightness; third is more
73
+ # closely correlated to the flatness of a sound; fourth to sounds with a
74
+ # stronger attack; etc. See an image below representing the 12 basis
75
+ # functions (i.e. template segments).
76
+ # ![timbre basis
77
+ # functions](https://developer.spotify.com/assets/audio/Timbre_basis_functio
78
+ # ns.png)
79
+ # The actual timbre of the segment is best described as a linear combination
80
+ # of these 12 basis functions weighted by the coefficient values: timbre =
81
+ # c1 x b1 + c2 x b2 + ... + c12 x b12, where c1 to c12 represent the 12
82
+ # coefficients and b1 to b12 the 12 basis functions as displayed below.
83
+ # Timbre vectors are best used in comparison with each other.
84
+ # @return [Array[Float]]
85
+ attr_accessor :timbre
86
+
87
+ # A mapping from model property names to API property names.
88
+ def self.names
89
+ @_hash = {} if @_hash.nil?
90
+ @_hash['start'] = 'start'
91
+ @_hash['duration'] = 'duration'
92
+ @_hash['confidence'] = 'confidence'
93
+ @_hash['loudness_start'] = 'loudness_start'
94
+ @_hash['loudness_max'] = 'loudness_max'
95
+ @_hash['loudness_max_time'] = 'loudness_max_time'
96
+ @_hash['loudness_end'] = 'loudness_end'
97
+ @_hash['pitches'] = 'pitches'
98
+ @_hash['timbre'] = 'timbre'
99
+ @_hash
100
+ end
101
+
102
+ # An array for optional fields
103
+ def self.optionals
104
+ %w[
105
+ start
106
+ duration
107
+ confidence
108
+ loudness_start
109
+ loudness_max
110
+ loudness_max_time
111
+ loudness_end
112
+ pitches
113
+ timbre
114
+ ]
115
+ end
116
+
117
+ # An array for nullable fields
118
+ def self.nullables
119
+ []
120
+ end
121
+
122
+ def initialize(start = SKIP, duration = SKIP, confidence = SKIP,
123
+ loudness_start = SKIP, loudness_max = SKIP,
124
+ loudness_max_time = SKIP, loudness_end = SKIP,
125
+ pitches = SKIP, timbre = SKIP)
126
+ @start = start unless start == SKIP
127
+ @duration = duration unless duration == SKIP
128
+ @confidence = confidence unless confidence == SKIP
129
+ @loudness_start = loudness_start unless loudness_start == SKIP
130
+ @loudness_max = loudness_max unless loudness_max == SKIP
131
+ @loudness_max_time = loudness_max_time unless loudness_max_time == SKIP
132
+ @loudness_end = loudness_end unless loudness_end == SKIP
133
+ @pitches = pitches unless pitches == SKIP
134
+ @timbre = timbre unless timbre == SKIP
135
+ end
136
+
137
+ # Creates an instance of the object from a hash.
138
+ def self.from_hash(hash)
139
+ return nil unless hash
140
+
141
+ # Extract variables from the hash.
142
+ start = hash.key?('start') ? hash['start'] : SKIP
143
+ duration = hash.key?('duration') ? hash['duration'] : SKIP
144
+ confidence = hash.key?('confidence') ? hash['confidence'] : SKIP
145
+ loudness_start =
146
+ hash.key?('loudness_start') ? hash['loudness_start'] : SKIP
147
+ loudness_max = hash.key?('loudness_max') ? hash['loudness_max'] : SKIP
148
+ loudness_max_time =
149
+ hash.key?('loudness_max_time') ? hash['loudness_max_time'] : SKIP
150
+ loudness_end = hash.key?('loudness_end') ? hash['loudness_end'] : SKIP
151
+ pitches = hash.key?('pitches') ? hash['pitches'] : SKIP
152
+ timbre = hash.key?('timbre') ? hash['timbre'] : SKIP
153
+
154
+ # Create object from extracted values.
155
+ SegmentObject.new(start,
156
+ duration,
157
+ confidence,
158
+ loudness_start,
159
+ loudness_max,
160
+ loudness_max_time,
161
+ loudness_end,
162
+ pitches,
163
+ timbre)
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,211 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # ShowBase Model.
8
+ class ShowBase < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A list of the countries in which the show can be played, identified by
13
+ # their [ISO 3166-1
14
+ # alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
15
+ # @return [Array[String]]
16
+ attr_accessor :available_markets
17
+
18
+ # The copyright statements of the show.
19
+ # @return [Array[CopyrightObject]]
20
+ attr_accessor :copyrights
21
+
22
+ # A description of the show. HTML tags are stripped away from this field,
23
+ # use `html_description` field in case HTML tags are needed.
24
+ # @return [String]
25
+ attr_accessor :description
26
+
27
+ # A description of the show. This field may contain HTML tags.
28
+ # @return [String]
29
+ attr_accessor :html_description
30
+
31
+ # Whether or not the show has explicit content (true = yes it does; false =
32
+ # no it does not OR unknown).
33
+ # @return [TrueClass | FalseClass]
34
+ attr_accessor :explicit
35
+
36
+ # External URLs for this show.
37
+ # @return [ExternalUrlObject]
38
+ attr_accessor :external_urls
39
+
40
+ # A link to the Web API endpoint providing full details of the show.
41
+ # @return [String]
42
+ attr_accessor :href
43
+
44
+ # The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
45
+ # show.
46
+ # @return [String]
47
+ attr_accessor :id
48
+
49
+ # The cover art for the show in various sizes, widest first.
50
+ # @return [Array[ImageObject]]
51
+ attr_accessor :images
52
+
53
+ # True if all of the shows episodes are hosted outside of Spotify's CDN.
54
+ # This field might be `null` in some cases.
55
+ # @return [TrueClass | FalseClass]
56
+ attr_accessor :is_externally_hosted
57
+
58
+ # A list of the languages used in the show, identified by their [ISO
59
+ # 639](https://en.wikipedia.org/wiki/ISO_639) code.
60
+ # @return [Array[String]]
61
+ attr_accessor :languages
62
+
63
+ # The media type of the show.
64
+ # @return [String]
65
+ attr_accessor :media_type
66
+
67
+ # The name of the episode.
68
+ # @return [String]
69
+ attr_accessor :name
70
+
71
+ # The publisher of the show.
72
+ # @return [String]
73
+ attr_accessor :publisher
74
+
75
+ # The object type.
76
+ # @return [Type7Enum]
77
+ attr_accessor :type
78
+
79
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
80
+ # the show.
81
+ # @return [String]
82
+ attr_accessor :uri
83
+
84
+ # The total number of episodes in the show.
85
+ # @return [Integer]
86
+ attr_accessor :total_episodes
87
+
88
+ # A mapping from model property names to API property names.
89
+ def self.names
90
+ @_hash = {} if @_hash.nil?
91
+ @_hash['available_markets'] = 'available_markets'
92
+ @_hash['copyrights'] = 'copyrights'
93
+ @_hash['description'] = 'description'
94
+ @_hash['html_description'] = 'html_description'
95
+ @_hash['explicit'] = 'explicit'
96
+ @_hash['external_urls'] = 'external_urls'
97
+ @_hash['href'] = 'href'
98
+ @_hash['id'] = 'id'
99
+ @_hash['images'] = 'images'
100
+ @_hash['is_externally_hosted'] = 'is_externally_hosted'
101
+ @_hash['languages'] = 'languages'
102
+ @_hash['media_type'] = 'media_type'
103
+ @_hash['name'] = 'name'
104
+ @_hash['publisher'] = 'publisher'
105
+ @_hash['type'] = 'type'
106
+ @_hash['uri'] = 'uri'
107
+ @_hash['total_episodes'] = 'total_episodes'
108
+ @_hash
109
+ end
110
+
111
+ # An array for optional fields
112
+ def self.optionals
113
+ []
114
+ end
115
+
116
+ # An array for nullable fields
117
+ def self.nullables
118
+ []
119
+ end
120
+
121
+ def initialize(available_markets = nil, copyrights = nil, description = nil,
122
+ html_description = nil, explicit = nil, external_urls = nil,
123
+ href = nil, id = nil, images = nil,
124
+ is_externally_hosted = nil, languages = nil,
125
+ media_type = nil, name = nil, publisher = nil, type = nil,
126
+ uri = nil, total_episodes = nil)
127
+ @available_markets = available_markets
128
+ @copyrights = copyrights
129
+ @description = description
130
+ @html_description = html_description
131
+ @explicit = explicit
132
+ @external_urls = external_urls
133
+ @href = href
134
+ @id = id
135
+ @images = images
136
+ @is_externally_hosted = is_externally_hosted
137
+ @languages = languages
138
+ @media_type = media_type
139
+ @name = name
140
+ @publisher = publisher
141
+ @type = type
142
+ @uri = uri
143
+ @total_episodes = total_episodes
144
+ end
145
+
146
+ # Creates an instance of the object from a hash.
147
+ def self.from_hash(hash)
148
+ return nil unless hash
149
+
150
+ # Extract variables from the hash.
151
+ available_markets =
152
+ hash.key?('available_markets') ? hash['available_markets'] : nil
153
+ # Parameter is an array, so we need to iterate through it
154
+ copyrights = nil
155
+ unless hash['copyrights'].nil?
156
+ copyrights = []
157
+ hash['copyrights'].each do |structure|
158
+ copyrights << (CopyrightObject.from_hash(structure) if structure)
159
+ end
160
+ end
161
+
162
+ copyrights = nil unless hash.key?('copyrights')
163
+ description = hash.key?('description') ? hash['description'] : nil
164
+ html_description =
165
+ hash.key?('html_description') ? hash['html_description'] : nil
166
+ explicit = hash.key?('explicit') ? hash['explicit'] : nil
167
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
168
+ href = hash.key?('href') ? hash['href'] : nil
169
+ id = hash.key?('id') ? hash['id'] : nil
170
+ # Parameter is an array, so we need to iterate through it
171
+ images = nil
172
+ unless hash['images'].nil?
173
+ images = []
174
+ hash['images'].each do |structure|
175
+ images << (ImageObject.from_hash(structure) if structure)
176
+ end
177
+ end
178
+
179
+ images = nil unless hash.key?('images')
180
+ is_externally_hosted =
181
+ hash.key?('is_externally_hosted') ? hash['is_externally_hosted'] : nil
182
+ languages = hash.key?('languages') ? hash['languages'] : nil
183
+ media_type = hash.key?('media_type') ? hash['media_type'] : nil
184
+ name = hash.key?('name') ? hash['name'] : nil
185
+ publisher = hash.key?('publisher') ? hash['publisher'] : nil
186
+ type = hash.key?('type') ? hash['type'] : nil
187
+ uri = hash.key?('uri') ? hash['uri'] : nil
188
+ total_episodes =
189
+ hash.key?('total_episodes') ? hash['total_episodes'] : nil
190
+
191
+ # Create object from extracted values.
192
+ ShowBase.new(available_markets,
193
+ copyrights,
194
+ description,
195
+ html_description,
196
+ explicit,
197
+ external_urls,
198
+ href,
199
+ id,
200
+ images,
201
+ is_externally_hosted,
202
+ languages,
203
+ media_type,
204
+ name,
205
+ publisher,
206
+ type,
207
+ uri,
208
+ total_episodes)
209
+ end
210
+ end
211
+ end