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,249 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# AudioFeaturesObject Model.
|
8
|
+
class AudioFeaturesObject < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# A confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0
|
13
|
+
# represents high confidence the track is acoustic.
|
14
|
+
# @return [Float]
|
15
|
+
attr_accessor :acousticness
|
16
|
+
|
17
|
+
# A URL to access the full audio analysis of this track. An access token is
|
18
|
+
# required to access this data.
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :analysis_url
|
21
|
+
|
22
|
+
# Danceability describes how suitable a track is for dancing based on a
|
23
|
+
# combination of musical elements including tempo, rhythm stability, beat
|
24
|
+
# strength, and overall regularity. A value of 0.0 is least danceable and
|
25
|
+
# 1.0 is most danceable.
|
26
|
+
# @return [Float]
|
27
|
+
attr_accessor :danceability
|
28
|
+
|
29
|
+
# The duration of the track in milliseconds.
|
30
|
+
# @return [Integer]
|
31
|
+
attr_accessor :duration_ms
|
32
|
+
|
33
|
+
# Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of
|
34
|
+
# intensity and activity. Typically, energetic tracks feel fast, loud, and
|
35
|
+
# noisy. For example, death metal has high energy, while a Bach prelude
|
36
|
+
# scores low on the scale. Perceptual features contributing to this
|
37
|
+
# attribute include dynamic range, perceived loudness, timbre, onset rate,
|
38
|
+
# and general entropy.
|
39
|
+
# @return [Float]
|
40
|
+
attr_accessor :energy
|
41
|
+
|
42
|
+
# The Spotify ID for the track.
|
43
|
+
# @return [String]
|
44
|
+
attr_accessor :id
|
45
|
+
|
46
|
+
# Predicts whether a track contains no vocals. "Ooh" and "aah" sounds are
|
47
|
+
# treated as instrumental in this context. Rap or spoken word tracks are
|
48
|
+
# clearly "vocal". The closer the instrumentalness value is to 1.0, the
|
49
|
+
# greater likelihood the track contains no vocal content. Values above 0.5
|
50
|
+
# are intended to represent instrumental tracks, but confidence is higher as
|
51
|
+
# the value approaches 1.0.
|
52
|
+
# @return [Float]
|
53
|
+
attr_accessor :instrumentalness
|
54
|
+
|
55
|
+
# The key the track is in. Integers map to pitches using standard [Pitch
|
56
|
+
# Class notation](https://en.wikipedia.org/wiki/Pitch_class). E.g. 0 = C, 1
|
57
|
+
# = C♯/D♭, 2 = D, and so on. If no key was detected, the value is -1.
|
58
|
+
# @return [Integer]
|
59
|
+
attr_accessor :key
|
60
|
+
|
61
|
+
# Detects the presence of an audience in the recording. Higher liveness
|
62
|
+
# values represent an increased probability that the track was performed
|
63
|
+
# live. A value above 0.8 provides strong likelihood that the track is live.
|
64
|
+
# @return [Float]
|
65
|
+
attr_accessor :liveness
|
66
|
+
|
67
|
+
# The overall loudness of a track in decibels (dB). Loudness values are
|
68
|
+
# averaged across the entire track and are useful for comparing relative
|
69
|
+
# loudness of tracks. Loudness is the quality of a sound that is the primary
|
70
|
+
# psychological correlate of physical strength (amplitude). Values typically
|
71
|
+
# range between -60 and 0 db.
|
72
|
+
# @return [Float]
|
73
|
+
attr_accessor :loudness
|
74
|
+
|
75
|
+
# Mode indicates the modality (major or minor) of a track, the type of scale
|
76
|
+
# from which its melodic content is derived. Major is represented by 1 and
|
77
|
+
# minor is 0.
|
78
|
+
# @return [Integer]
|
79
|
+
attr_accessor :mode
|
80
|
+
|
81
|
+
# Speechiness detects the presence of spoken words in a track. The more
|
82
|
+
# exclusively speech-like the recording (e.g. talk show, audio book,
|
83
|
+
# poetry), the closer to 1.0 the attribute value. Values above 0.66 describe
|
84
|
+
# tracks that are probably made entirely of spoken words. Values between
|
85
|
+
# 0.33 and 0.66 describe tracks that may contain both music and speech,
|
86
|
+
# either in sections or layered, including such cases as rap music. Values
|
87
|
+
# below 0.33 most likely represent music and other non-speech-like tracks.
|
88
|
+
# @return [Float]
|
89
|
+
attr_accessor :speechiness
|
90
|
+
|
91
|
+
# The overall estimated tempo of a track in beats per minute (BPM). In
|
92
|
+
# musical terminology, tempo is the speed or pace of a given piece and
|
93
|
+
# derives directly from the average beat duration.
|
94
|
+
# @return [Float]
|
95
|
+
attr_accessor :tempo
|
96
|
+
|
97
|
+
# An estimated time signature. The time signature (meter) is a notational
|
98
|
+
# convention to specify how many beats are in each bar (or measure). The
|
99
|
+
# time signature ranges from 3 to 7 indicating time signatures of "3/4", to
|
100
|
+
# "7/4".
|
101
|
+
# @return [Integer]
|
102
|
+
attr_accessor :time_signature
|
103
|
+
|
104
|
+
# A link to the Web API endpoint providing full details of the track.
|
105
|
+
# @return [String]
|
106
|
+
attr_accessor :track_href
|
107
|
+
|
108
|
+
# The object type.
|
109
|
+
# @return [Type6Enum]
|
110
|
+
attr_accessor :type
|
111
|
+
|
112
|
+
# The Spotify URI for the track.
|
113
|
+
# @return [String]
|
114
|
+
attr_accessor :uri
|
115
|
+
|
116
|
+
# A measure from 0.0 to 1.0 describing the musical positiveness conveyed by
|
117
|
+
# a track. Tracks with high valence sound more positive (e.g. happy,
|
118
|
+
# cheerful, euphoric), while tracks with low valence sound more negative
|
119
|
+
# (e.g. sad, depressed, angry).
|
120
|
+
# @return [Float]
|
121
|
+
attr_accessor :valence
|
122
|
+
|
123
|
+
# A mapping from model property names to API property names.
|
124
|
+
def self.names
|
125
|
+
@_hash = {} if @_hash.nil?
|
126
|
+
@_hash['acousticness'] = 'acousticness'
|
127
|
+
@_hash['analysis_url'] = 'analysis_url'
|
128
|
+
@_hash['danceability'] = 'danceability'
|
129
|
+
@_hash['duration_ms'] = 'duration_ms'
|
130
|
+
@_hash['energy'] = 'energy'
|
131
|
+
@_hash['id'] = 'id'
|
132
|
+
@_hash['instrumentalness'] = 'instrumentalness'
|
133
|
+
@_hash['key'] = 'key'
|
134
|
+
@_hash['liveness'] = 'liveness'
|
135
|
+
@_hash['loudness'] = 'loudness'
|
136
|
+
@_hash['mode'] = 'mode'
|
137
|
+
@_hash['speechiness'] = 'speechiness'
|
138
|
+
@_hash['tempo'] = 'tempo'
|
139
|
+
@_hash['time_signature'] = 'time_signature'
|
140
|
+
@_hash['track_href'] = 'track_href'
|
141
|
+
@_hash['type'] = 'type'
|
142
|
+
@_hash['uri'] = 'uri'
|
143
|
+
@_hash['valence'] = 'valence'
|
144
|
+
@_hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# An array for optional fields
|
148
|
+
def self.optionals
|
149
|
+
%w[
|
150
|
+
acousticness
|
151
|
+
analysis_url
|
152
|
+
danceability
|
153
|
+
duration_ms
|
154
|
+
energy
|
155
|
+
id
|
156
|
+
instrumentalness
|
157
|
+
key
|
158
|
+
liveness
|
159
|
+
loudness
|
160
|
+
mode
|
161
|
+
speechiness
|
162
|
+
tempo
|
163
|
+
time_signature
|
164
|
+
track_href
|
165
|
+
type
|
166
|
+
uri
|
167
|
+
valence
|
168
|
+
]
|
169
|
+
end
|
170
|
+
|
171
|
+
# An array for nullable fields
|
172
|
+
def self.nullables
|
173
|
+
[]
|
174
|
+
end
|
175
|
+
|
176
|
+
def initialize(acousticness = SKIP, analysis_url = SKIP,
|
177
|
+
danceability = SKIP, duration_ms = SKIP, energy = SKIP,
|
178
|
+
id = SKIP, instrumentalness = SKIP, key = SKIP,
|
179
|
+
liveness = SKIP, loudness = SKIP, mode = SKIP,
|
180
|
+
speechiness = SKIP, tempo = SKIP, time_signature = SKIP,
|
181
|
+
track_href = SKIP, type = SKIP, uri = SKIP, valence = SKIP)
|
182
|
+
@acousticness = acousticness unless acousticness == SKIP
|
183
|
+
@analysis_url = analysis_url unless analysis_url == SKIP
|
184
|
+
@danceability = danceability unless danceability == SKIP
|
185
|
+
@duration_ms = duration_ms unless duration_ms == SKIP
|
186
|
+
@energy = energy unless energy == SKIP
|
187
|
+
@id = id unless id == SKIP
|
188
|
+
@instrumentalness = instrumentalness unless instrumentalness == SKIP
|
189
|
+
@key = key unless key == SKIP
|
190
|
+
@liveness = liveness unless liveness == SKIP
|
191
|
+
@loudness = loudness unless loudness == SKIP
|
192
|
+
@mode = mode unless mode == SKIP
|
193
|
+
@speechiness = speechiness unless speechiness == SKIP
|
194
|
+
@tempo = tempo unless tempo == SKIP
|
195
|
+
@time_signature = time_signature unless time_signature == SKIP
|
196
|
+
@track_href = track_href unless track_href == SKIP
|
197
|
+
@type = type unless type == SKIP
|
198
|
+
@uri = uri unless uri == SKIP
|
199
|
+
@valence = valence unless valence == SKIP
|
200
|
+
end
|
201
|
+
|
202
|
+
# Creates an instance of the object from a hash.
|
203
|
+
def self.from_hash(hash)
|
204
|
+
return nil unless hash
|
205
|
+
|
206
|
+
# Extract variables from the hash.
|
207
|
+
acousticness = hash.key?('acousticness') ? hash['acousticness'] : SKIP
|
208
|
+
analysis_url = hash.key?('analysis_url') ? hash['analysis_url'] : SKIP
|
209
|
+
danceability = hash.key?('danceability') ? hash['danceability'] : SKIP
|
210
|
+
duration_ms = hash.key?('duration_ms') ? hash['duration_ms'] : SKIP
|
211
|
+
energy = hash.key?('energy') ? hash['energy'] : SKIP
|
212
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
213
|
+
instrumentalness =
|
214
|
+
hash.key?('instrumentalness') ? hash['instrumentalness'] : SKIP
|
215
|
+
key = hash.key?('key') ? hash['key'] : SKIP
|
216
|
+
liveness = hash.key?('liveness') ? hash['liveness'] : SKIP
|
217
|
+
loudness = hash.key?('loudness') ? hash['loudness'] : SKIP
|
218
|
+
mode = hash.key?('mode') ? hash['mode'] : SKIP
|
219
|
+
speechiness = hash.key?('speechiness') ? hash['speechiness'] : SKIP
|
220
|
+
tempo = hash.key?('tempo') ? hash['tempo'] : SKIP
|
221
|
+
time_signature =
|
222
|
+
hash.key?('time_signature') ? hash['time_signature'] : SKIP
|
223
|
+
track_href = hash.key?('track_href') ? hash['track_href'] : SKIP
|
224
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
225
|
+
uri = hash.key?('uri') ? hash['uri'] : SKIP
|
226
|
+
valence = hash.key?('valence') ? hash['valence'] : SKIP
|
227
|
+
|
228
|
+
# Create object from extracted values.
|
229
|
+
AudioFeaturesObject.new(acousticness,
|
230
|
+
analysis_url,
|
231
|
+
danceability,
|
232
|
+
duration_ms,
|
233
|
+
energy,
|
234
|
+
id,
|
235
|
+
instrumentalness,
|
236
|
+
key,
|
237
|
+
liveness,
|
238
|
+
loudness,
|
239
|
+
mode,
|
240
|
+
speechiness,
|
241
|
+
tempo,
|
242
|
+
time_signature,
|
243
|
+
track_href,
|
244
|
+
type,
|
245
|
+
uri,
|
246
|
+
valence)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
@@ -0,0 +1,245 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# AudiobookBase Model.
|
8
|
+
class AudiobookBase < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# The author(s) for the audiobook.
|
13
|
+
# @return [Array[AuthorObject]]
|
14
|
+
attr_accessor :authors
|
15
|
+
|
16
|
+
# A list of the countries in which the audiobook can be played, identified
|
17
|
+
# by their [ISO 3166-1
|
18
|
+
# alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
|
19
|
+
# @return [Array[String]]
|
20
|
+
attr_accessor :available_markets
|
21
|
+
|
22
|
+
# The copyright statements of the audiobook.
|
23
|
+
# @return [Array[CopyrightObject]]
|
24
|
+
attr_accessor :copyrights
|
25
|
+
|
26
|
+
# A description of the audiobook. HTML tags are stripped away from this
|
27
|
+
# field, use `html_description` field in case HTML tags are needed.
|
28
|
+
# @return [String]
|
29
|
+
attr_accessor :description
|
30
|
+
|
31
|
+
# A description of the audiobook. This field may contain HTML tags.
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :html_description
|
34
|
+
|
35
|
+
# The edition of the audiobook.
|
36
|
+
# @return [String]
|
37
|
+
attr_accessor :edition
|
38
|
+
|
39
|
+
# Whether or not the audiobook has explicit content (true = yes it does;
|
40
|
+
# false = no it does not OR unknown).
|
41
|
+
# @return [TrueClass | FalseClass]
|
42
|
+
attr_accessor :explicit
|
43
|
+
|
44
|
+
# External URLs for this audiobook.
|
45
|
+
# @return [ExternalUrlObject]
|
46
|
+
attr_accessor :external_urls
|
47
|
+
|
48
|
+
# A link to the Web API endpoint providing full details of the audiobook.
|
49
|
+
# @return [String]
|
50
|
+
attr_accessor :href
|
51
|
+
|
52
|
+
# The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
|
53
|
+
# audiobook.
|
54
|
+
# @return [String]
|
55
|
+
attr_accessor :id
|
56
|
+
|
57
|
+
# The cover art for the audiobook in various sizes, widest first.
|
58
|
+
# @return [Array[ImageObject]]
|
59
|
+
attr_accessor :images
|
60
|
+
|
61
|
+
# A list of the languages used in the audiobook, identified by their [ISO
|
62
|
+
# 639](https://en.wikipedia.org/wiki/ISO_639) code.
|
63
|
+
# @return [Array[String]]
|
64
|
+
attr_accessor :languages
|
65
|
+
|
66
|
+
# The media type of the audiobook.
|
67
|
+
# @return [String]
|
68
|
+
attr_accessor :media_type
|
69
|
+
|
70
|
+
# The name of the audiobook.
|
71
|
+
# @return [String]
|
72
|
+
attr_accessor :name
|
73
|
+
|
74
|
+
# The narrator(s) for the audiobook.
|
75
|
+
# @return [Array[NarratorObject]]
|
76
|
+
attr_accessor :narrators
|
77
|
+
|
78
|
+
# The publisher of the audiobook.
|
79
|
+
# @return [String]
|
80
|
+
attr_accessor :publisher
|
81
|
+
|
82
|
+
# The object type.
|
83
|
+
# @return [Type9Enum]
|
84
|
+
attr_accessor :type
|
85
|
+
|
86
|
+
# The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
|
87
|
+
# the audiobook.
|
88
|
+
# @return [String]
|
89
|
+
attr_accessor :uri
|
90
|
+
|
91
|
+
# The number of chapters in this audiobook.
|
92
|
+
# @return [Integer]
|
93
|
+
attr_accessor :total_chapters
|
94
|
+
|
95
|
+
# A mapping from model property names to API property names.
|
96
|
+
def self.names
|
97
|
+
@_hash = {} if @_hash.nil?
|
98
|
+
@_hash['authors'] = 'authors'
|
99
|
+
@_hash['available_markets'] = 'available_markets'
|
100
|
+
@_hash['copyrights'] = 'copyrights'
|
101
|
+
@_hash['description'] = 'description'
|
102
|
+
@_hash['html_description'] = 'html_description'
|
103
|
+
@_hash['edition'] = 'edition'
|
104
|
+
@_hash['explicit'] = 'explicit'
|
105
|
+
@_hash['external_urls'] = 'external_urls'
|
106
|
+
@_hash['href'] = 'href'
|
107
|
+
@_hash['id'] = 'id'
|
108
|
+
@_hash['images'] = 'images'
|
109
|
+
@_hash['languages'] = 'languages'
|
110
|
+
@_hash['media_type'] = 'media_type'
|
111
|
+
@_hash['name'] = 'name'
|
112
|
+
@_hash['narrators'] = 'narrators'
|
113
|
+
@_hash['publisher'] = 'publisher'
|
114
|
+
@_hash['type'] = 'type'
|
115
|
+
@_hash['uri'] = 'uri'
|
116
|
+
@_hash['total_chapters'] = 'total_chapters'
|
117
|
+
@_hash
|
118
|
+
end
|
119
|
+
|
120
|
+
# An array for optional fields
|
121
|
+
def self.optionals
|
122
|
+
%w[
|
123
|
+
edition
|
124
|
+
]
|
125
|
+
end
|
126
|
+
|
127
|
+
# An array for nullable fields
|
128
|
+
def self.nullables
|
129
|
+
[]
|
130
|
+
end
|
131
|
+
|
132
|
+
def initialize(authors = nil, available_markets = nil, copyrights = nil,
|
133
|
+
description = nil, html_description = nil, explicit = nil,
|
134
|
+
external_urls = nil, href = nil, id = nil, images = nil,
|
135
|
+
languages = nil, media_type = nil, name = nil,
|
136
|
+
narrators = nil, publisher = nil, type = nil, uri = nil,
|
137
|
+
total_chapters = nil, edition = SKIP)
|
138
|
+
@authors = authors
|
139
|
+
@available_markets = available_markets
|
140
|
+
@copyrights = copyrights
|
141
|
+
@description = description
|
142
|
+
@html_description = html_description
|
143
|
+
@edition = edition unless edition == SKIP
|
144
|
+
@explicit = explicit
|
145
|
+
@external_urls = external_urls
|
146
|
+
@href = href
|
147
|
+
@id = id
|
148
|
+
@images = images
|
149
|
+
@languages = languages
|
150
|
+
@media_type = media_type
|
151
|
+
@name = name
|
152
|
+
@narrators = narrators
|
153
|
+
@publisher = publisher
|
154
|
+
@type = type
|
155
|
+
@uri = uri
|
156
|
+
@total_chapters = total_chapters
|
157
|
+
end
|
158
|
+
|
159
|
+
# Creates an instance of the object from a hash.
|
160
|
+
def self.from_hash(hash)
|
161
|
+
return nil unless hash
|
162
|
+
|
163
|
+
# Extract variables from the hash.
|
164
|
+
# Parameter is an array, so we need to iterate through it
|
165
|
+
authors = nil
|
166
|
+
unless hash['authors'].nil?
|
167
|
+
authors = []
|
168
|
+
hash['authors'].each do |structure|
|
169
|
+
authors << (AuthorObject.from_hash(structure) if structure)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
authors = nil unless hash.key?('authors')
|
174
|
+
available_markets =
|
175
|
+
hash.key?('available_markets') ? hash['available_markets'] : nil
|
176
|
+
# Parameter is an array, so we need to iterate through it
|
177
|
+
copyrights = nil
|
178
|
+
unless hash['copyrights'].nil?
|
179
|
+
copyrights = []
|
180
|
+
hash['copyrights'].each do |structure|
|
181
|
+
copyrights << (CopyrightObject.from_hash(structure) if structure)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
copyrights = nil unless hash.key?('copyrights')
|
186
|
+
description = hash.key?('description') ? hash['description'] : nil
|
187
|
+
html_description =
|
188
|
+
hash.key?('html_description') ? hash['html_description'] : nil
|
189
|
+
explicit = hash.key?('explicit') ? hash['explicit'] : nil
|
190
|
+
external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
|
191
|
+
href = hash.key?('href') ? hash['href'] : nil
|
192
|
+
id = hash.key?('id') ? hash['id'] : nil
|
193
|
+
# Parameter is an array, so we need to iterate through it
|
194
|
+
images = nil
|
195
|
+
unless hash['images'].nil?
|
196
|
+
images = []
|
197
|
+
hash['images'].each do |structure|
|
198
|
+
images << (ImageObject.from_hash(structure) if structure)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
images = nil unless hash.key?('images')
|
203
|
+
languages = hash.key?('languages') ? hash['languages'] : nil
|
204
|
+
media_type = hash.key?('media_type') ? hash['media_type'] : nil
|
205
|
+
name = hash.key?('name') ? hash['name'] : nil
|
206
|
+
# Parameter is an array, so we need to iterate through it
|
207
|
+
narrators = nil
|
208
|
+
unless hash['narrators'].nil?
|
209
|
+
narrators = []
|
210
|
+
hash['narrators'].each do |structure|
|
211
|
+
narrators << (NarratorObject.from_hash(structure) if structure)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
narrators = nil unless hash.key?('narrators')
|
216
|
+
publisher = hash.key?('publisher') ? hash['publisher'] : nil
|
217
|
+
type = hash.key?('type') ? hash['type'] : nil
|
218
|
+
uri = hash.key?('uri') ? hash['uri'] : nil
|
219
|
+
total_chapters =
|
220
|
+
hash.key?('total_chapters') ? hash['total_chapters'] : nil
|
221
|
+
edition = hash.key?('edition') ? hash['edition'] : SKIP
|
222
|
+
|
223
|
+
# Create object from extracted values.
|
224
|
+
AudiobookBase.new(authors,
|
225
|
+
available_markets,
|
226
|
+
copyrights,
|
227
|
+
description,
|
228
|
+
html_description,
|
229
|
+
explicit,
|
230
|
+
external_urls,
|
231
|
+
href,
|
232
|
+
id,
|
233
|
+
images,
|
234
|
+
languages,
|
235
|
+
media_type,
|
236
|
+
name,
|
237
|
+
narrators,
|
238
|
+
publisher,
|
239
|
+
type,
|
240
|
+
uri,
|
241
|
+
total_chapters,
|
242
|
+
edition)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|