spotify-api-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +30 -0
- data/README.md +107 -0
- data/lib/spotify_web_api/api_helper.rb +10 -0
- data/lib/spotify_web_api/client.rb +154 -0
- data/lib/spotify_web_api/configuration.rb +180 -0
- data/lib/spotify_web_api/controllers/albums_controller.rb +295 -0
- data/lib/spotify_web_api/controllers/artists_controller.rb +187 -0
- data/lib/spotify_web_api/controllers/audiobooks_controller.rb +258 -0
- data/lib/spotify_web_api/controllers/base_controller.rb +66 -0
- data/lib/spotify_web_api/controllers/categories_controller.rb +83 -0
- data/lib/spotify_web_api/controllers/chapters_controller.rb +82 -0
- data/lib/spotify_web_api/controllers/episodes_controller.rb +239 -0
- data/lib/spotify_web_api/controllers/genres_controller.rb +39 -0
- data/lib/spotify_web_api/controllers/markets_controller.rb +38 -0
- data/lib/spotify_web_api/controllers/o_auth_authorization_controller.rb +82 -0
- data/lib/spotify_web_api/controllers/player_controller.rb +509 -0
- data/lib/spotify_web_api/controllers/playlists_controller.rb +521 -0
- data/lib/spotify_web_api/controllers/search_controller.rb +60 -0
- data/lib/spotify_web_api/controllers/shows_controller.rb +261 -0
- data/lib/spotify_web_api/controllers/tracks_controller.rb +491 -0
- data/lib/spotify_web_api/controllers/users_controller.rb +396 -0
- data/lib/spotify_web_api/exceptions/api_exception.rb +10 -0
- data/lib/spotify_web_api/exceptions/bad_request_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/forbidden_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/not_found_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/o_auth_provider_exception.rb +48 -0
- data/lib/spotify_web_api/exceptions/too_many_requests_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/unauthorized_exception.rb +32 -0
- data/lib/spotify_web_api/http/api_response.rb +21 -0
- data/lib/spotify_web_api/http/auth/o_auth2.rb +146 -0
- data/lib/spotify_web_api/http/http_call_back.rb +10 -0
- data/lib/spotify_web_api/http/http_method_enum.rb +10 -0
- data/lib/spotify_web_api/http/http_request.rb +10 -0
- data/lib/spotify_web_api/http/http_response.rb +10 -0
- data/lib/spotify_web_api/models/album_base.rb +168 -0
- data/lib/spotify_web_api/models/album_group_enum.rb +29 -0
- data/lib/spotify_web_api/models/album_object.rb +247 -0
- data/lib/spotify_web_api/models/album_restriction_object.rb +53 -0
- data/lib/spotify_web_api/models/album_type_enum.rb +26 -0
- data/lib/spotify_web_api/models/artist_discography_album_object.rb +194 -0
- data/lib/spotify_web_api/models/artist_object.rb +147 -0
- data/lib/spotify_web_api/models/audio_analysis_object.rb +156 -0
- data/lib/spotify_web_api/models/audio_features_object.rb +249 -0
- data/lib/spotify_web_api/models/audiobook_base.rb +245 -0
- data/lib/spotify_web_api/models/audiobook_object.rb +253 -0
- data/lib/spotify_web_api/models/author_object.rb +50 -0
- data/lib/spotify_web_api/models/base_model.rb +62 -0
- data/lib/spotify_web_api/models/categories.rb +110 -0
- data/lib/spotify_web_api/models/category_object.rb +82 -0
- data/lib/spotify_web_api/models/chapter_base.rb +237 -0
- data/lib/spotify_web_api/models/chapter_object.rb +245 -0
- data/lib/spotify_web_api/models/chapter_restriction_object.rb +59 -0
- data/lib/spotify_web_api/models/context_object.rb +78 -0
- data/lib/spotify_web_api/models/copyright_object.rb +60 -0
- data/lib/spotify_web_api/models/currently_playing_context_object.rb +137 -0
- data/lib/spotify_web_api/models/currently_playing_object.rb +109 -0
- data/lib/spotify_web_api/models/cursor_object.rb +59 -0
- data/lib/spotify_web_api/models/cursor_paged_artists.rb +48 -0
- data/lib/spotify_web_api/models/cursor_paging_object.rb +88 -0
- data/lib/spotify_web_api/models/cursor_paging_play_history_object.rb +106 -0
- data/lib/spotify_web_api/models/cursor_paging_simplified_artist_object.rb +106 -0
- data/lib/spotify_web_api/models/device_object.rb +126 -0
- data/lib/spotify_web_api/models/disallows_object.rb +140 -0
- data/lib/spotify_web_api/models/episode_base.rb +237 -0
- data/lib/spotify_web_api/models/episode_object.rb +246 -0
- data/lib/spotify_web_api/models/episode_restriction_object.rb +58 -0
- data/lib/spotify_web_api/models/error_object.rb +59 -0
- data/lib/spotify_web_api/models/explicit_content_settings_object.rb +61 -0
- data/lib/spotify_web_api/models/external_id_object.rb +72 -0
- data/lib/spotify_web_api/models/external_url_object.rb +51 -0
- data/lib/spotify_web_api/models/followers_object.rb +62 -0
- data/lib/spotify_web_api/models/image_object.rb +67 -0
- data/lib/spotify_web_api/models/include_external_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type1_enum.rb +20 -0
- data/lib/spotify_web_api/models/item_type2_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type3_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type_enum.rb +38 -0
- data/lib/spotify_web_api/models/linked_track_object.rb +89 -0
- data/lib/spotify_web_api/models/many_albums.rb +57 -0
- data/lib/spotify_web_api/models/many_artists.rb +57 -0
- data/lib/spotify_web_api/models/many_audio_features.rb +57 -0
- data/lib/spotify_web_api/models/many_audiobooks.rb +57 -0
- data/lib/spotify_web_api/models/many_chapters.rb +57 -0
- data/lib/spotify_web_api/models/many_devices.rb +57 -0
- data/lib/spotify_web_api/models/many_episodes.rb +57 -0
- data/lib/spotify_web_api/models/many_genres.rb +48 -0
- data/lib/spotify_web_api/models/many_simplified_shows.rb +57 -0
- data/lib/spotify_web_api/models/many_tracks.rb +57 -0
- data/lib/spotify_web_api/models/markets.rb +50 -0
- data/lib/spotify_web_api/models/me_albums_request.rb +55 -0
- data/lib/spotify_web_api/models/me_episodes_request.rb +52 -0
- data/lib/spotify_web_api/models/me_episodes_request1.rb +54 -0
- data/lib/spotify_web_api/models/me_following_request.rb +53 -0
- data/lib/spotify_web_api/models/me_following_request1.rb +55 -0
- data/lib/spotify_web_api/models/me_player_play_request.rb +89 -0
- data/lib/spotify_web_api/models/me_player_request.rb +63 -0
- data/lib/spotify_web_api/models/me_shows_request.rb +55 -0
- data/lib/spotify_web_api/models/me_tracks_request.rb +53 -0
- data/lib/spotify_web_api/models/me_tracks_request1.rb +55 -0
- data/lib/spotify_web_api/models/meta.rb +110 -0
- data/lib/spotify_web_api/models/mode_enum.rb +30 -0
- data/lib/spotify_web_api/models/narrator_object.rb +50 -0
- data/lib/spotify_web_api/models/o_auth_provider_error_enum.rb +45 -0
- data/lib/spotify_web_api/models/o_auth_scope_enum.rb +94 -0
- data/lib/spotify_web_api/models/o_auth_token.rb +96 -0
- data/lib/spotify_web_api/models/paged_albums.rb +48 -0
- data/lib/spotify_web_api/models/paged_categories.rb +48 -0
- data/lib/spotify_web_api/models/paging_artist_discography_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_artist_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_featured_playlist_object.rb +59 -0
- data/lib/spotify_web_api/models/paging_object.rb +93 -0
- data/lib/spotify_web_api/models/paging_playlist_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_playlist_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_audiobook_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_episode_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_show_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_audiobook_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_chapter_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_episode_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_show_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_track_object.rb +110 -0
- data/lib/spotify_web_api/models/play_history_object.rb +77 -0
- data/lib/spotify_web_api/models/playlist_object.rb +193 -0
- data/lib/spotify_web_api/models/playlist_owner_object.rb +109 -0
- data/lib/spotify_web_api/models/playlist_snapshot_id.rb +50 -0
- data/lib/spotify_web_api/models/playlist_track_object.rb +90 -0
- data/lib/spotify_web_api/models/playlist_tracks_ref_object.rb +60 -0
- data/lib/spotify_web_api/models/playlist_user_object.rb +98 -0
- data/lib/spotify_web_api/models/playlists_followers_request.rb +51 -0
- data/lib/spotify_web_api/models/playlists_request.rb +82 -0
- data/lib/spotify_web_api/models/playlists_tracks_request.rb +72 -0
- data/lib/spotify_web_api/models/playlists_tracks_request1.rb +97 -0
- data/lib/spotify_web_api/models/playlists_tracks_request2.rb +75 -0
- data/lib/spotify_web_api/models/private_user_object.rb +181 -0
- data/lib/spotify_web_api/models/public_user_object.rb +128 -0
- data/lib/spotify_web_api/models/queue_object.rb +60 -0
- data/lib/spotify_web_api/models/reason_enum.rb +29 -0
- data/lib/spotify_web_api/models/recommendation_seed_object.rb +104 -0
- data/lib/spotify_web_api/models/recommendations_object.rb +74 -0
- data/lib/spotify_web_api/models/release_date_precision_enum.rb +26 -0
- data/lib/spotify_web_api/models/resume_point_object.rb +60 -0
- data/lib/spotify_web_api/models/saved_album_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_audiobook_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_episode_object.rb +70 -0
- data/lib/spotify_web_api/models/saved_show_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_track_object.rb +73 -0
- data/lib/spotify_web_api/models/search_items.rb +107 -0
- data/lib/spotify_web_api/models/section_object.rb +180 -0
- data/lib/spotify_web_api/models/segment_object.rb +166 -0
- data/lib/spotify_web_api/models/show_base.rb +211 -0
- data/lib/spotify_web_api/models/show_object.rb +219 -0
- data/lib/spotify_web_api/models/simplified_album_object.rb +186 -0
- data/lib/spotify_web_api/models/simplified_artist_object.rb +98 -0
- data/lib/spotify_web_api/models/simplified_playlist_object.rb +184 -0
- data/lib/spotify_web_api/models/simplified_track_object.rb +227 -0
- data/lib/spotify_web_api/models/time_interval_object.rb +68 -0
- data/lib/spotify_web_api/models/track.rb +331 -0
- data/lib/spotify_web_api/models/track1.rb +50 -0
- data/lib/spotify_web_api/models/track_object.rb +265 -0
- data/lib/spotify_web_api/models/track_restriction_object.rb +58 -0
- data/lib/spotify_web_api/models/type2_enum.rb +20 -0
- data/lib/spotify_web_api/models/type3_enum.rb +20 -0
- data/lib/spotify_web_api/models/type4_enum.rb +20 -0
- data/lib/spotify_web_api/models/type6_enum.rb +20 -0
- data/lib/spotify_web_api/models/type7_enum.rb +20 -0
- data/lib/spotify_web_api/models/type8_enum.rb +20 -0
- data/lib/spotify_web_api/models/type9_enum.rb +20 -0
- data/lib/spotify_web_api/models/type_enum.rb +20 -0
- data/lib/spotify_web_api/models/users_playlists_request.rb +87 -0
- data/lib/spotify_web_api/utilities/date_time_helper.rb +11 -0
- data/lib/spotify_web_api/utilities/file_wrapper.rb +16 -0
- data/lib/spotify_web_api.rb +198 -0
- metadata +264 -0
@@ -0,0 +1,227 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# SimplifiedTrackObject Model.
|
8
|
+
class SimplifiedTrackObject < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# The artists who performed the track. Each artist object includes a link in
|
13
|
+
# `href` to more detailed information about the artist.
|
14
|
+
# @return [Array[SimplifiedArtistObject]]
|
15
|
+
attr_accessor :artists
|
16
|
+
|
17
|
+
# A list of the countries in which the track can be played, identified by
|
18
|
+
# their [ISO 3166-1
|
19
|
+
# alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
|
20
|
+
# @return [Array[String]]
|
21
|
+
attr_accessor :available_markets
|
22
|
+
|
23
|
+
# The disc number (usually `1` unless the album consists of more than one
|
24
|
+
# disc).
|
25
|
+
# @return [Integer]
|
26
|
+
attr_accessor :disc_number
|
27
|
+
|
28
|
+
# The track length in milliseconds.
|
29
|
+
# @return [Integer]
|
30
|
+
attr_accessor :duration_ms
|
31
|
+
|
32
|
+
# Whether or not the track has explicit lyrics ( `true` = yes it does;
|
33
|
+
# `false` = no it does not OR unknown).
|
34
|
+
# @return [TrueClass | FalseClass]
|
35
|
+
attr_accessor :explicit
|
36
|
+
|
37
|
+
# External URLs for this track.
|
38
|
+
# @return [ExternalUrlObject]
|
39
|
+
attr_accessor :external_urls
|
40
|
+
|
41
|
+
# A link to the Web API endpoint providing full details of the track.
|
42
|
+
# @return [String]
|
43
|
+
attr_accessor :href
|
44
|
+
|
45
|
+
# The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
|
46
|
+
# track.
|
47
|
+
# @return [String]
|
48
|
+
attr_accessor :id
|
49
|
+
|
50
|
+
# Part of the response when [Track
|
51
|
+
# Relinking](/documentation/web-api/concepts/track-relinking/) is applied.
|
52
|
+
# If `true`, the track is playable in the given market. Otherwise `false`.
|
53
|
+
# @return [TrueClass | FalseClass]
|
54
|
+
attr_accessor :is_playable
|
55
|
+
|
56
|
+
# Part of the response when [Track
|
57
|
+
# Relinking](/documentation/web-api/concepts/track-relinking/) is applied
|
58
|
+
# and is only part of the response if the track linking, in fact, exists.
|
59
|
+
# The requested track has been replaced with a different track. The track in
|
60
|
+
# the `linked_from` object contains information about the originally
|
61
|
+
# requested track.
|
62
|
+
# @return [LinkedTrackObject]
|
63
|
+
attr_accessor :linked_from
|
64
|
+
|
65
|
+
# Included in the response when a content restriction is applied.
|
66
|
+
# @return [TrackRestrictionObject]
|
67
|
+
attr_accessor :restrictions
|
68
|
+
|
69
|
+
# The name of the track.
|
70
|
+
# @return [String]
|
71
|
+
attr_accessor :name
|
72
|
+
|
73
|
+
# A URL to a 30 second preview (MP3 format) of the track.
|
74
|
+
# @return [String]
|
75
|
+
attr_accessor :preview_url
|
76
|
+
|
77
|
+
# The number of the track. If an album has several discs, the track number
|
78
|
+
# is the number on the specified disc.
|
79
|
+
# @return [Integer]
|
80
|
+
attr_accessor :track_number
|
81
|
+
|
82
|
+
# The object type: "track".
|
83
|
+
# @return [String]
|
84
|
+
attr_accessor :type
|
85
|
+
|
86
|
+
# The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
|
87
|
+
# the track.
|
88
|
+
# @return [String]
|
89
|
+
attr_accessor :uri
|
90
|
+
|
91
|
+
# Whether or not the track is from a local file.
|
92
|
+
# @return [TrueClass | FalseClass]
|
93
|
+
attr_accessor :is_local
|
94
|
+
|
95
|
+
# A mapping from model property names to API property names.
|
96
|
+
def self.names
|
97
|
+
@_hash = {} if @_hash.nil?
|
98
|
+
@_hash['artists'] = 'artists'
|
99
|
+
@_hash['available_markets'] = 'available_markets'
|
100
|
+
@_hash['disc_number'] = 'disc_number'
|
101
|
+
@_hash['duration_ms'] = 'duration_ms'
|
102
|
+
@_hash['explicit'] = 'explicit'
|
103
|
+
@_hash['external_urls'] = 'external_urls'
|
104
|
+
@_hash['href'] = 'href'
|
105
|
+
@_hash['id'] = 'id'
|
106
|
+
@_hash['is_playable'] = 'is_playable'
|
107
|
+
@_hash['linked_from'] = 'linked_from'
|
108
|
+
@_hash['restrictions'] = 'restrictions'
|
109
|
+
@_hash['name'] = 'name'
|
110
|
+
@_hash['preview_url'] = 'preview_url'
|
111
|
+
@_hash['track_number'] = 'track_number'
|
112
|
+
@_hash['type'] = 'type'
|
113
|
+
@_hash['uri'] = 'uri'
|
114
|
+
@_hash['is_local'] = 'is_local'
|
115
|
+
@_hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# An array for optional fields
|
119
|
+
def self.optionals
|
120
|
+
%w[
|
121
|
+
artists
|
122
|
+
available_markets
|
123
|
+
disc_number
|
124
|
+
duration_ms
|
125
|
+
explicit
|
126
|
+
external_urls
|
127
|
+
href
|
128
|
+
id
|
129
|
+
is_playable
|
130
|
+
linked_from
|
131
|
+
restrictions
|
132
|
+
name
|
133
|
+
preview_url
|
134
|
+
track_number
|
135
|
+
type
|
136
|
+
uri
|
137
|
+
is_local
|
138
|
+
]
|
139
|
+
end
|
140
|
+
|
141
|
+
# An array for nullable fields
|
142
|
+
def self.nullables
|
143
|
+
%w[
|
144
|
+
preview_url
|
145
|
+
]
|
146
|
+
end
|
147
|
+
|
148
|
+
def initialize(artists = SKIP, available_markets = SKIP, disc_number = SKIP,
|
149
|
+
duration_ms = SKIP, explicit = SKIP, external_urls = SKIP,
|
150
|
+
href = SKIP, id = SKIP, is_playable = SKIP,
|
151
|
+
linked_from = SKIP, restrictions = SKIP, name = SKIP,
|
152
|
+
preview_url = SKIP, track_number = SKIP, type = SKIP,
|
153
|
+
uri = SKIP, is_local = SKIP)
|
154
|
+
@artists = artists unless artists == SKIP
|
155
|
+
@available_markets = available_markets unless available_markets == SKIP
|
156
|
+
@disc_number = disc_number unless disc_number == SKIP
|
157
|
+
@duration_ms = duration_ms unless duration_ms == SKIP
|
158
|
+
@explicit = explicit unless explicit == SKIP
|
159
|
+
@external_urls = external_urls unless external_urls == SKIP
|
160
|
+
@href = href unless href == SKIP
|
161
|
+
@id = id unless id == SKIP
|
162
|
+
@is_playable = is_playable unless is_playable == SKIP
|
163
|
+
@linked_from = linked_from unless linked_from == SKIP
|
164
|
+
@restrictions = restrictions unless restrictions == SKIP
|
165
|
+
@name = name unless name == SKIP
|
166
|
+
@preview_url = preview_url unless preview_url == SKIP
|
167
|
+
@track_number = track_number unless track_number == SKIP
|
168
|
+
@type = type unless type == SKIP
|
169
|
+
@uri = uri unless uri == SKIP
|
170
|
+
@is_local = is_local unless is_local == SKIP
|
171
|
+
end
|
172
|
+
|
173
|
+
# Creates an instance of the object from a hash.
|
174
|
+
def self.from_hash(hash)
|
175
|
+
return nil unless hash
|
176
|
+
|
177
|
+
# Extract variables from the hash.
|
178
|
+
# Parameter is an array, so we need to iterate through it
|
179
|
+
artists = nil
|
180
|
+
unless hash['artists'].nil?
|
181
|
+
artists = []
|
182
|
+
hash['artists'].each do |structure|
|
183
|
+
artists << (SimplifiedArtistObject.from_hash(structure) if structure)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
artists = SKIP unless hash.key?('artists')
|
188
|
+
available_markets =
|
189
|
+
hash.key?('available_markets') ? hash['available_markets'] : SKIP
|
190
|
+
disc_number = hash.key?('disc_number') ? hash['disc_number'] : SKIP
|
191
|
+
duration_ms = hash.key?('duration_ms') ? hash['duration_ms'] : SKIP
|
192
|
+
explicit = hash.key?('explicit') ? hash['explicit'] : SKIP
|
193
|
+
external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
|
194
|
+
href = hash.key?('href') ? hash['href'] : SKIP
|
195
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
196
|
+
is_playable = hash.key?('is_playable') ? hash['is_playable'] : SKIP
|
197
|
+
linked_from = LinkedTrackObject.from_hash(hash['linked_from']) if hash['linked_from']
|
198
|
+
restrictions = TrackRestrictionObject.from_hash(hash['restrictions']) if
|
199
|
+
hash['restrictions']
|
200
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
201
|
+
preview_url = hash.key?('preview_url') ? hash['preview_url'] : SKIP
|
202
|
+
track_number = hash.key?('track_number') ? hash['track_number'] : SKIP
|
203
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
204
|
+
uri = hash.key?('uri') ? hash['uri'] : SKIP
|
205
|
+
is_local = hash.key?('is_local') ? hash['is_local'] : SKIP
|
206
|
+
|
207
|
+
# Create object from extracted values.
|
208
|
+
SimplifiedTrackObject.new(artists,
|
209
|
+
available_markets,
|
210
|
+
disc_number,
|
211
|
+
duration_ms,
|
212
|
+
explicit,
|
213
|
+
external_urls,
|
214
|
+
href,
|
215
|
+
id,
|
216
|
+
is_playable,
|
217
|
+
linked_from,
|
218
|
+
restrictions,
|
219
|
+
name,
|
220
|
+
preview_url,
|
221
|
+
track_number,
|
222
|
+
type,
|
223
|
+
uri,
|
224
|
+
is_local)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# TimeIntervalObject Model.
|
8
|
+
class TimeIntervalObject < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# The starting point (in seconds) of the time interval.
|
13
|
+
# @return [Float]
|
14
|
+
attr_accessor :start
|
15
|
+
|
16
|
+
# The duration (in seconds) of the time interval.
|
17
|
+
# @return [Float]
|
18
|
+
attr_accessor :duration
|
19
|
+
|
20
|
+
# The confidence, from 0.0 to 1.0, of the reliability of the interval.
|
21
|
+
# @return [Float]
|
22
|
+
attr_accessor :confidence
|
23
|
+
|
24
|
+
# A mapping from model property names to API property names.
|
25
|
+
def self.names
|
26
|
+
@_hash = {} if @_hash.nil?
|
27
|
+
@_hash['start'] = 'start'
|
28
|
+
@_hash['duration'] = 'duration'
|
29
|
+
@_hash['confidence'] = 'confidence'
|
30
|
+
@_hash
|
31
|
+
end
|
32
|
+
|
33
|
+
# An array for optional fields
|
34
|
+
def self.optionals
|
35
|
+
%w[
|
36
|
+
start
|
37
|
+
duration
|
38
|
+
confidence
|
39
|
+
]
|
40
|
+
end
|
41
|
+
|
42
|
+
# An array for nullable fields
|
43
|
+
def self.nullables
|
44
|
+
[]
|
45
|
+
end
|
46
|
+
|
47
|
+
def initialize(start = SKIP, duration = SKIP, confidence = SKIP)
|
48
|
+
@start = start unless start == SKIP
|
49
|
+
@duration = duration unless duration == SKIP
|
50
|
+
@confidence = confidence unless confidence == SKIP
|
51
|
+
end
|
52
|
+
|
53
|
+
# Creates an instance of the object from a hash.
|
54
|
+
def self.from_hash(hash)
|
55
|
+
return nil unless hash
|
56
|
+
|
57
|
+
# Extract variables from the hash.
|
58
|
+
start = hash.key?('start') ? hash['start'] : SKIP
|
59
|
+
duration = hash.key?('duration') ? hash['duration'] : SKIP
|
60
|
+
confidence = hash.key?('confidence') ? hash['confidence'] : SKIP
|
61
|
+
|
62
|
+
# Create object from extracted values.
|
63
|
+
TimeIntervalObject.new(start,
|
64
|
+
duration,
|
65
|
+
confidence)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,331 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# Track Model.
|
8
|
+
class Track < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# The exact number of audio samples analyzed from this track. See also
|
13
|
+
# `analysis_sample_rate`.
|
14
|
+
# @return [Integer]
|
15
|
+
attr_accessor :num_samples
|
16
|
+
|
17
|
+
# Length of the track in seconds.
|
18
|
+
# @return [Float]
|
19
|
+
attr_accessor :duration
|
20
|
+
|
21
|
+
# This field will always contain the empty string.
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :sample_md5
|
24
|
+
|
25
|
+
# An offset to the start of the region of the track that was analyzed. (As
|
26
|
+
# the entire track is analyzed, this should always be 0.)
|
27
|
+
# @return [Integer]
|
28
|
+
attr_accessor :offset_seconds
|
29
|
+
|
30
|
+
# The length of the region of the track was analyzed, if a subset of the
|
31
|
+
# track was analyzed. (As the entire track is analyzed, this should always
|
32
|
+
# be 0.)
|
33
|
+
# @return [Integer]
|
34
|
+
attr_accessor :window_seconds
|
35
|
+
|
36
|
+
# The sample rate used to decode and analyze this track. May differ from the
|
37
|
+
# actual sample rate of this track available on Spotify.
|
38
|
+
# @return [Integer]
|
39
|
+
attr_accessor :analysis_sample_rate
|
40
|
+
|
41
|
+
# The number of channels used for analysis. If 1, all channels are summed
|
42
|
+
# together to mono before analysis.
|
43
|
+
# @return [Integer]
|
44
|
+
attr_accessor :analysis_channels
|
45
|
+
|
46
|
+
# The time, in seconds, at which the track's fade-in period ends. If the
|
47
|
+
# track has no fade-in, this will be 0.0.
|
48
|
+
# @return [Float]
|
49
|
+
attr_accessor :end_of_fade_in
|
50
|
+
|
51
|
+
# The time, in seconds, at which the track's fade-out period starts. If the
|
52
|
+
# track has no fade-out, this should match the track's length.
|
53
|
+
# @return [Float]
|
54
|
+
attr_accessor :start_of_fade_out
|
55
|
+
|
56
|
+
# The overall loudness of a track in decibels (dB). Loudness values are
|
57
|
+
# averaged across the entire track and are useful for comparing relative
|
58
|
+
# loudness of tracks. Loudness is the quality of a sound that is the primary
|
59
|
+
# psychological correlate of physical strength (amplitude). Values typically
|
60
|
+
# range between -60 and 0 db.
|
61
|
+
# @return [Float]
|
62
|
+
attr_accessor :loudness
|
63
|
+
|
64
|
+
# The overall estimated tempo of a track in beats per minute (BPM). In
|
65
|
+
# musical terminology, tempo is the speed or pace of a given piece and
|
66
|
+
# derives directly from the average beat duration.
|
67
|
+
# @return [Float]
|
68
|
+
attr_accessor :tempo
|
69
|
+
|
70
|
+
# The confidence, from 0.0 to 1.0, of the reliability of the `tempo`.
|
71
|
+
# @return [Float]
|
72
|
+
attr_accessor :tempo_confidence
|
73
|
+
|
74
|
+
# An estimated time signature. The time signature (meter) is a notational
|
75
|
+
# convention to specify how many beats are in each bar (or measure). The
|
76
|
+
# time signature ranges from 3 to 7 indicating time signatures of "3/4", to
|
77
|
+
# "7/4".
|
78
|
+
# @return [Integer]
|
79
|
+
attr_accessor :time_signature
|
80
|
+
|
81
|
+
# The confidence, from 0.0 to 1.0, of the reliability of the
|
82
|
+
# `time_signature`.
|
83
|
+
# @return [Float]
|
84
|
+
attr_accessor :time_signature_confidence
|
85
|
+
|
86
|
+
# The key the track is in. Integers map to pitches using standard [Pitch
|
87
|
+
# Class notation](https://en.wikipedia.org/wiki/Pitch_class). E.g. 0 = C, 1
|
88
|
+
# = C♯/D♭, 2 = D, and so on. If no key was detected, the value is -1.
|
89
|
+
# @return [Integer]
|
90
|
+
attr_accessor :key
|
91
|
+
|
92
|
+
# The confidence, from 0.0 to 1.0, of the reliability of the `key`.
|
93
|
+
# @return [Float]
|
94
|
+
attr_accessor :key_confidence
|
95
|
+
|
96
|
+
# Mode indicates the modality (major or minor) of a track, the type of scale
|
97
|
+
# from which its melodic content is derived. Major is represented by 1 and
|
98
|
+
# minor is 0.
|
99
|
+
# @return [Integer]
|
100
|
+
attr_accessor :mode
|
101
|
+
|
102
|
+
# The confidence, from 0.0 to 1.0, of the reliability of the `mode`.
|
103
|
+
# @return [Float]
|
104
|
+
attr_accessor :mode_confidence
|
105
|
+
|
106
|
+
# An [Echo Nest Musical Fingerprint
|
107
|
+
# (ENMFP)](https://academiccommons.columbia.edu/doi/10.7916/D8Q248M4)
|
108
|
+
# codestring for this track.
|
109
|
+
# @return [String]
|
110
|
+
attr_accessor :codestring
|
111
|
+
|
112
|
+
# A version number for the Echo Nest Musical Fingerprint format used in the
|
113
|
+
# codestring field.
|
114
|
+
# @return [Float]
|
115
|
+
attr_accessor :code_version
|
116
|
+
|
117
|
+
# An [EchoPrint](https://github.com/spotify/echoprint-codegen) codestring
|
118
|
+
# for this track.
|
119
|
+
# @return [String]
|
120
|
+
attr_accessor :echoprintstring
|
121
|
+
|
122
|
+
# A version number for the EchoPrint format used in the echoprintstring
|
123
|
+
# field.
|
124
|
+
# @return [Float]
|
125
|
+
attr_accessor :echoprint_version
|
126
|
+
|
127
|
+
# A [Synchstring](https://github.com/echonest/synchdata) for this track.
|
128
|
+
# @return [String]
|
129
|
+
attr_accessor :synchstring
|
130
|
+
|
131
|
+
# A version number for the Synchstring used in the synchstring field.
|
132
|
+
# @return [Float]
|
133
|
+
attr_accessor :synch_version
|
134
|
+
|
135
|
+
# A Rhythmstring for this track. The format of this string is similar to the
|
136
|
+
# Synchstring.
|
137
|
+
# @return [String]
|
138
|
+
attr_accessor :rhythmstring
|
139
|
+
|
140
|
+
# A version number for the Rhythmstring used in the rhythmstring field.
|
141
|
+
# @return [Float]
|
142
|
+
attr_accessor :rhythm_version
|
143
|
+
|
144
|
+
# A mapping from model property names to API property names.
|
145
|
+
def self.names
|
146
|
+
@_hash = {} if @_hash.nil?
|
147
|
+
@_hash['num_samples'] = 'num_samples'
|
148
|
+
@_hash['duration'] = 'duration'
|
149
|
+
@_hash['sample_md5'] = 'sample_md5'
|
150
|
+
@_hash['offset_seconds'] = 'offset_seconds'
|
151
|
+
@_hash['window_seconds'] = 'window_seconds'
|
152
|
+
@_hash['analysis_sample_rate'] = 'analysis_sample_rate'
|
153
|
+
@_hash['analysis_channels'] = 'analysis_channels'
|
154
|
+
@_hash['end_of_fade_in'] = 'end_of_fade_in'
|
155
|
+
@_hash['start_of_fade_out'] = 'start_of_fade_out'
|
156
|
+
@_hash['loudness'] = 'loudness'
|
157
|
+
@_hash['tempo'] = 'tempo'
|
158
|
+
@_hash['tempo_confidence'] = 'tempo_confidence'
|
159
|
+
@_hash['time_signature'] = 'time_signature'
|
160
|
+
@_hash['time_signature_confidence'] = 'time_signature_confidence'
|
161
|
+
@_hash['key'] = 'key'
|
162
|
+
@_hash['key_confidence'] = 'key_confidence'
|
163
|
+
@_hash['mode'] = 'mode'
|
164
|
+
@_hash['mode_confidence'] = 'mode_confidence'
|
165
|
+
@_hash['codestring'] = 'codestring'
|
166
|
+
@_hash['code_version'] = 'code_version'
|
167
|
+
@_hash['echoprintstring'] = 'echoprintstring'
|
168
|
+
@_hash['echoprint_version'] = 'echoprint_version'
|
169
|
+
@_hash['synchstring'] = 'synchstring'
|
170
|
+
@_hash['synch_version'] = 'synch_version'
|
171
|
+
@_hash['rhythmstring'] = 'rhythmstring'
|
172
|
+
@_hash['rhythm_version'] = 'rhythm_version'
|
173
|
+
@_hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# An array for optional fields
|
177
|
+
def self.optionals
|
178
|
+
%w[
|
179
|
+
num_samples
|
180
|
+
duration
|
181
|
+
sample_md5
|
182
|
+
offset_seconds
|
183
|
+
window_seconds
|
184
|
+
analysis_sample_rate
|
185
|
+
analysis_channels
|
186
|
+
end_of_fade_in
|
187
|
+
start_of_fade_out
|
188
|
+
loudness
|
189
|
+
tempo
|
190
|
+
tempo_confidence
|
191
|
+
time_signature
|
192
|
+
time_signature_confidence
|
193
|
+
key
|
194
|
+
key_confidence
|
195
|
+
mode
|
196
|
+
mode_confidence
|
197
|
+
codestring
|
198
|
+
code_version
|
199
|
+
echoprintstring
|
200
|
+
echoprint_version
|
201
|
+
synchstring
|
202
|
+
synch_version
|
203
|
+
rhythmstring
|
204
|
+
rhythm_version
|
205
|
+
]
|
206
|
+
end
|
207
|
+
|
208
|
+
# An array for nullable fields
|
209
|
+
def self.nullables
|
210
|
+
[]
|
211
|
+
end
|
212
|
+
|
213
|
+
def initialize(num_samples = SKIP, duration = SKIP, sample_md5 = SKIP,
|
214
|
+
offset_seconds = SKIP, window_seconds = SKIP,
|
215
|
+
analysis_sample_rate = SKIP, analysis_channels = SKIP,
|
216
|
+
end_of_fade_in = SKIP, start_of_fade_out = SKIP,
|
217
|
+
loudness = SKIP, tempo = SKIP, tempo_confidence = SKIP,
|
218
|
+
time_signature = SKIP, time_signature_confidence = SKIP,
|
219
|
+
key = SKIP, key_confidence = SKIP, mode = SKIP,
|
220
|
+
mode_confidence = SKIP, codestring = SKIP,
|
221
|
+
code_version = SKIP, echoprintstring = SKIP,
|
222
|
+
echoprint_version = SKIP, synchstring = SKIP,
|
223
|
+
synch_version = SKIP, rhythmstring = SKIP,
|
224
|
+
rhythm_version = SKIP)
|
225
|
+
@num_samples = num_samples unless num_samples == SKIP
|
226
|
+
@duration = duration unless duration == SKIP
|
227
|
+
@sample_md5 = sample_md5 unless sample_md5 == SKIP
|
228
|
+
@offset_seconds = offset_seconds unless offset_seconds == SKIP
|
229
|
+
@window_seconds = window_seconds unless window_seconds == SKIP
|
230
|
+
@analysis_sample_rate = analysis_sample_rate unless analysis_sample_rate == SKIP
|
231
|
+
@analysis_channels = analysis_channels unless analysis_channels == SKIP
|
232
|
+
@end_of_fade_in = end_of_fade_in unless end_of_fade_in == SKIP
|
233
|
+
@start_of_fade_out = start_of_fade_out unless start_of_fade_out == SKIP
|
234
|
+
@loudness = loudness unless loudness == SKIP
|
235
|
+
@tempo = tempo unless tempo == SKIP
|
236
|
+
@tempo_confidence = tempo_confidence unless tempo_confidence == SKIP
|
237
|
+
@time_signature = time_signature unless time_signature == SKIP
|
238
|
+
unless time_signature_confidence == SKIP
|
239
|
+
@time_signature_confidence =
|
240
|
+
time_signature_confidence
|
241
|
+
end
|
242
|
+
@key = key unless key == SKIP
|
243
|
+
@key_confidence = key_confidence unless key_confidence == SKIP
|
244
|
+
@mode = mode unless mode == SKIP
|
245
|
+
@mode_confidence = mode_confidence unless mode_confidence == SKIP
|
246
|
+
@codestring = codestring unless codestring == SKIP
|
247
|
+
@code_version = code_version unless code_version == SKIP
|
248
|
+
@echoprintstring = echoprintstring unless echoprintstring == SKIP
|
249
|
+
@echoprint_version = echoprint_version unless echoprint_version == SKIP
|
250
|
+
@synchstring = synchstring unless synchstring == SKIP
|
251
|
+
@synch_version = synch_version unless synch_version == SKIP
|
252
|
+
@rhythmstring = rhythmstring unless rhythmstring == SKIP
|
253
|
+
@rhythm_version = rhythm_version unless rhythm_version == SKIP
|
254
|
+
end
|
255
|
+
|
256
|
+
# Creates an instance of the object from a hash.
|
257
|
+
def self.from_hash(hash)
|
258
|
+
return nil unless hash
|
259
|
+
|
260
|
+
# Extract variables from the hash.
|
261
|
+
num_samples = hash.key?('num_samples') ? hash['num_samples'] : SKIP
|
262
|
+
duration = hash.key?('duration') ? hash['duration'] : SKIP
|
263
|
+
sample_md5 = hash.key?('sample_md5') ? hash['sample_md5'] : SKIP
|
264
|
+
offset_seconds =
|
265
|
+
hash.key?('offset_seconds') ? hash['offset_seconds'] : SKIP
|
266
|
+
window_seconds =
|
267
|
+
hash.key?('window_seconds') ? hash['window_seconds'] : SKIP
|
268
|
+
analysis_sample_rate =
|
269
|
+
hash.key?('analysis_sample_rate') ? hash['analysis_sample_rate'] : SKIP
|
270
|
+
analysis_channels =
|
271
|
+
hash.key?('analysis_channels') ? hash['analysis_channels'] : SKIP
|
272
|
+
end_of_fade_in =
|
273
|
+
hash.key?('end_of_fade_in') ? hash['end_of_fade_in'] : SKIP
|
274
|
+
start_of_fade_out =
|
275
|
+
hash.key?('start_of_fade_out') ? hash['start_of_fade_out'] : SKIP
|
276
|
+
loudness = hash.key?('loudness') ? hash['loudness'] : SKIP
|
277
|
+
tempo = hash.key?('tempo') ? hash['tempo'] : SKIP
|
278
|
+
tempo_confidence =
|
279
|
+
hash.key?('tempo_confidence') ? hash['tempo_confidence'] : SKIP
|
280
|
+
time_signature =
|
281
|
+
hash.key?('time_signature') ? hash['time_signature'] : SKIP
|
282
|
+
time_signature_confidence =
|
283
|
+
hash.key?('time_signature_confidence') ? hash['time_signature_confidence'] : SKIP
|
284
|
+
key = hash.key?('key') ? hash['key'] : SKIP
|
285
|
+
key_confidence =
|
286
|
+
hash.key?('key_confidence') ? hash['key_confidence'] : SKIP
|
287
|
+
mode = hash.key?('mode') ? hash['mode'] : SKIP
|
288
|
+
mode_confidence =
|
289
|
+
hash.key?('mode_confidence') ? hash['mode_confidence'] : SKIP
|
290
|
+
codestring = hash.key?('codestring') ? hash['codestring'] : SKIP
|
291
|
+
code_version = hash.key?('code_version') ? hash['code_version'] : SKIP
|
292
|
+
echoprintstring =
|
293
|
+
hash.key?('echoprintstring') ? hash['echoprintstring'] : SKIP
|
294
|
+
echoprint_version =
|
295
|
+
hash.key?('echoprint_version') ? hash['echoprint_version'] : SKIP
|
296
|
+
synchstring = hash.key?('synchstring') ? hash['synchstring'] : SKIP
|
297
|
+
synch_version = hash.key?('synch_version') ? hash['synch_version'] : SKIP
|
298
|
+
rhythmstring = hash.key?('rhythmstring') ? hash['rhythmstring'] : SKIP
|
299
|
+
rhythm_version =
|
300
|
+
hash.key?('rhythm_version') ? hash['rhythm_version'] : SKIP
|
301
|
+
|
302
|
+
# Create object from extracted values.
|
303
|
+
Track.new(num_samples,
|
304
|
+
duration,
|
305
|
+
sample_md5,
|
306
|
+
offset_seconds,
|
307
|
+
window_seconds,
|
308
|
+
analysis_sample_rate,
|
309
|
+
analysis_channels,
|
310
|
+
end_of_fade_in,
|
311
|
+
start_of_fade_out,
|
312
|
+
loudness,
|
313
|
+
tempo,
|
314
|
+
tempo_confidence,
|
315
|
+
time_signature,
|
316
|
+
time_signature_confidence,
|
317
|
+
key,
|
318
|
+
key_confidence,
|
319
|
+
mode,
|
320
|
+
mode_confidence,
|
321
|
+
codestring,
|
322
|
+
code_version,
|
323
|
+
echoprintstring,
|
324
|
+
echoprint_version,
|
325
|
+
synchstring,
|
326
|
+
synch_version,
|
327
|
+
rhythmstring,
|
328
|
+
rhythm_version)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# Track1 Model.
|
8
|
+
class Track1 < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Spotify URI
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :uri
|
15
|
+
|
16
|
+
# A mapping from model property names to API property names.
|
17
|
+
def self.names
|
18
|
+
@_hash = {} if @_hash.nil?
|
19
|
+
@_hash['uri'] = 'uri'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
# An array for optional fields
|
24
|
+
def self.optionals
|
25
|
+
%w[
|
26
|
+
uri
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
# An array for nullable fields
|
31
|
+
def self.nullables
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(uri = SKIP)
|
36
|
+
@uri = uri unless uri == SKIP
|
37
|
+
end
|
38
|
+
|
39
|
+
# Creates an instance of the object from a hash.
|
40
|
+
def self.from_hash(hash)
|
41
|
+
return nil unless hash
|
42
|
+
|
43
|
+
# Extract variables from the hash.
|
44
|
+
uri = hash.key?('uri') ? hash['uri'] : SKIP
|
45
|
+
|
46
|
+
# Create object from extracted values.
|
47
|
+
Track1.new(uri)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|