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,110 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# PagingSimplifiedEpisodeObject Model.
|
8
|
+
class PagingSimplifiedEpisodeObject < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# A link to the Web API endpoint returning the full result of the request
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :href
|
15
|
+
|
16
|
+
# The maximum number of items in the response (as set in the query or by
|
17
|
+
# default).
|
18
|
+
# @return [Integer]
|
19
|
+
attr_accessor :limit
|
20
|
+
|
21
|
+
# URL to the next page of items. ( `null` if none)
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :mnext
|
24
|
+
|
25
|
+
# The offset of the items returned (as set in the query or by default)
|
26
|
+
# @return [Integer]
|
27
|
+
attr_accessor :offset
|
28
|
+
|
29
|
+
# URL to the previous page of items. ( `null` if none)
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :previous
|
32
|
+
|
33
|
+
# The total number of items available to return.
|
34
|
+
# @return [Integer]
|
35
|
+
attr_accessor :total
|
36
|
+
|
37
|
+
# The total number of items available to return.
|
38
|
+
# @return [Array[EpisodeBase]]
|
39
|
+
attr_accessor :items
|
40
|
+
|
41
|
+
# A mapping from model property names to API property names.
|
42
|
+
def self.names
|
43
|
+
@_hash = {} if @_hash.nil?
|
44
|
+
@_hash['href'] = 'href'
|
45
|
+
@_hash['limit'] = 'limit'
|
46
|
+
@_hash['mnext'] = 'next'
|
47
|
+
@_hash['offset'] = 'offset'
|
48
|
+
@_hash['previous'] = 'previous'
|
49
|
+
@_hash['total'] = 'total'
|
50
|
+
@_hash['items'] = 'items'
|
51
|
+
@_hash
|
52
|
+
end
|
53
|
+
|
54
|
+
# An array for optional fields
|
55
|
+
def self.optionals
|
56
|
+
[]
|
57
|
+
end
|
58
|
+
|
59
|
+
# An array for nullable fields
|
60
|
+
def self.nullables
|
61
|
+
%w[
|
62
|
+
mnext
|
63
|
+
previous
|
64
|
+
]
|
65
|
+
end
|
66
|
+
|
67
|
+
def initialize(href = nil, limit = nil, mnext = nil, offset = nil,
|
68
|
+
previous = nil, total = nil, items = nil)
|
69
|
+
@href = href
|
70
|
+
@limit = limit
|
71
|
+
@mnext = mnext
|
72
|
+
@offset = offset
|
73
|
+
@previous = previous
|
74
|
+
@total = total
|
75
|
+
@items = items
|
76
|
+
end
|
77
|
+
|
78
|
+
# Creates an instance of the object from a hash.
|
79
|
+
def self.from_hash(hash)
|
80
|
+
return nil unless hash
|
81
|
+
|
82
|
+
# Extract variables from the hash.
|
83
|
+
href = hash.key?('href') ? hash['href'] : nil
|
84
|
+
limit = hash.key?('limit') ? hash['limit'] : nil
|
85
|
+
mnext = hash.key?('next') ? hash['next'] : nil
|
86
|
+
offset = hash.key?('offset') ? hash['offset'] : nil
|
87
|
+
previous = hash.key?('previous') ? hash['previous'] : nil
|
88
|
+
total = hash.key?('total') ? hash['total'] : nil
|
89
|
+
# Parameter is an array, so we need to iterate through it
|
90
|
+
items = nil
|
91
|
+
unless hash['items'].nil?
|
92
|
+
items = []
|
93
|
+
hash['items'].each do |structure|
|
94
|
+
items << (EpisodeBase.from_hash(structure) if structure)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
items = nil unless hash.key?('items')
|
99
|
+
|
100
|
+
# Create object from extracted values.
|
101
|
+
PagingSimplifiedEpisodeObject.new(href,
|
102
|
+
limit,
|
103
|
+
mnext,
|
104
|
+
offset,
|
105
|
+
previous,
|
106
|
+
total,
|
107
|
+
items)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# PagingSimplifiedShowObject Model.
|
8
|
+
class PagingSimplifiedShowObject < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# A link to the Web API endpoint returning the full result of the request
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :href
|
15
|
+
|
16
|
+
# The maximum number of items in the response (as set in the query or by
|
17
|
+
# default).
|
18
|
+
# @return [Integer]
|
19
|
+
attr_accessor :limit
|
20
|
+
|
21
|
+
# URL to the next page of items. ( `null` if none)
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :mnext
|
24
|
+
|
25
|
+
# The offset of the items returned (as set in the query or by default)
|
26
|
+
# @return [Integer]
|
27
|
+
attr_accessor :offset
|
28
|
+
|
29
|
+
# URL to the previous page of items. ( `null` if none)
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :previous
|
32
|
+
|
33
|
+
# The total number of items available to return.
|
34
|
+
# @return [Integer]
|
35
|
+
attr_accessor :total
|
36
|
+
|
37
|
+
# The total number of items available to return.
|
38
|
+
# @return [Array[ShowBase]]
|
39
|
+
attr_accessor :items
|
40
|
+
|
41
|
+
# A mapping from model property names to API property names.
|
42
|
+
def self.names
|
43
|
+
@_hash = {} if @_hash.nil?
|
44
|
+
@_hash['href'] = 'href'
|
45
|
+
@_hash['limit'] = 'limit'
|
46
|
+
@_hash['mnext'] = 'next'
|
47
|
+
@_hash['offset'] = 'offset'
|
48
|
+
@_hash['previous'] = 'previous'
|
49
|
+
@_hash['total'] = 'total'
|
50
|
+
@_hash['items'] = 'items'
|
51
|
+
@_hash
|
52
|
+
end
|
53
|
+
|
54
|
+
# An array for optional fields
|
55
|
+
def self.optionals
|
56
|
+
[]
|
57
|
+
end
|
58
|
+
|
59
|
+
# An array for nullable fields
|
60
|
+
def self.nullables
|
61
|
+
%w[
|
62
|
+
mnext
|
63
|
+
previous
|
64
|
+
]
|
65
|
+
end
|
66
|
+
|
67
|
+
def initialize(href = nil, limit = nil, mnext = nil, offset = nil,
|
68
|
+
previous = nil, total = nil, items = nil)
|
69
|
+
@href = href
|
70
|
+
@limit = limit
|
71
|
+
@mnext = mnext
|
72
|
+
@offset = offset
|
73
|
+
@previous = previous
|
74
|
+
@total = total
|
75
|
+
@items = items
|
76
|
+
end
|
77
|
+
|
78
|
+
# Creates an instance of the object from a hash.
|
79
|
+
def self.from_hash(hash)
|
80
|
+
return nil unless hash
|
81
|
+
|
82
|
+
# Extract variables from the hash.
|
83
|
+
href = hash.key?('href') ? hash['href'] : nil
|
84
|
+
limit = hash.key?('limit') ? hash['limit'] : nil
|
85
|
+
mnext = hash.key?('next') ? hash['next'] : nil
|
86
|
+
offset = hash.key?('offset') ? hash['offset'] : nil
|
87
|
+
previous = hash.key?('previous') ? hash['previous'] : nil
|
88
|
+
total = hash.key?('total') ? hash['total'] : nil
|
89
|
+
# Parameter is an array, so we need to iterate through it
|
90
|
+
items = nil
|
91
|
+
unless hash['items'].nil?
|
92
|
+
items = []
|
93
|
+
hash['items'].each do |structure|
|
94
|
+
items << (ShowBase.from_hash(structure) if structure)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
items = nil unless hash.key?('items')
|
99
|
+
|
100
|
+
# Create object from extracted values.
|
101
|
+
PagingSimplifiedShowObject.new(href,
|
102
|
+
limit,
|
103
|
+
mnext,
|
104
|
+
offset,
|
105
|
+
previous,
|
106
|
+
total,
|
107
|
+
items)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# PagingSimplifiedTrackObject Model.
|
8
|
+
class PagingSimplifiedTrackObject < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# A link to the Web API endpoint returning the full result of the request
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :href
|
15
|
+
|
16
|
+
# The maximum number of items in the response (as set in the query or by
|
17
|
+
# default).
|
18
|
+
# @return [Integer]
|
19
|
+
attr_accessor :limit
|
20
|
+
|
21
|
+
# URL to the next page of items. ( `null` if none)
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :mnext
|
24
|
+
|
25
|
+
# The offset of the items returned (as set in the query or by default)
|
26
|
+
# @return [Integer]
|
27
|
+
attr_accessor :offset
|
28
|
+
|
29
|
+
# URL to the previous page of items. ( `null` if none)
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :previous
|
32
|
+
|
33
|
+
# The total number of items available to return.
|
34
|
+
# @return [Integer]
|
35
|
+
attr_accessor :total
|
36
|
+
|
37
|
+
# The total number of items available to return.
|
38
|
+
# @return [Array[SimplifiedTrackObject]]
|
39
|
+
attr_accessor :items
|
40
|
+
|
41
|
+
# A mapping from model property names to API property names.
|
42
|
+
def self.names
|
43
|
+
@_hash = {} if @_hash.nil?
|
44
|
+
@_hash['href'] = 'href'
|
45
|
+
@_hash['limit'] = 'limit'
|
46
|
+
@_hash['mnext'] = 'next'
|
47
|
+
@_hash['offset'] = 'offset'
|
48
|
+
@_hash['previous'] = 'previous'
|
49
|
+
@_hash['total'] = 'total'
|
50
|
+
@_hash['items'] = 'items'
|
51
|
+
@_hash
|
52
|
+
end
|
53
|
+
|
54
|
+
# An array for optional fields
|
55
|
+
def self.optionals
|
56
|
+
[]
|
57
|
+
end
|
58
|
+
|
59
|
+
# An array for nullable fields
|
60
|
+
def self.nullables
|
61
|
+
%w[
|
62
|
+
mnext
|
63
|
+
previous
|
64
|
+
]
|
65
|
+
end
|
66
|
+
|
67
|
+
def initialize(href = nil, limit = nil, mnext = nil, offset = nil,
|
68
|
+
previous = nil, total = nil, items = nil)
|
69
|
+
@href = href
|
70
|
+
@limit = limit
|
71
|
+
@mnext = mnext
|
72
|
+
@offset = offset
|
73
|
+
@previous = previous
|
74
|
+
@total = total
|
75
|
+
@items = items
|
76
|
+
end
|
77
|
+
|
78
|
+
# Creates an instance of the object from a hash.
|
79
|
+
def self.from_hash(hash)
|
80
|
+
return nil unless hash
|
81
|
+
|
82
|
+
# Extract variables from the hash.
|
83
|
+
href = hash.key?('href') ? hash['href'] : nil
|
84
|
+
limit = hash.key?('limit') ? hash['limit'] : nil
|
85
|
+
mnext = hash.key?('next') ? hash['next'] : nil
|
86
|
+
offset = hash.key?('offset') ? hash['offset'] : nil
|
87
|
+
previous = hash.key?('previous') ? hash['previous'] : nil
|
88
|
+
total = hash.key?('total') ? hash['total'] : nil
|
89
|
+
# Parameter is an array, so we need to iterate through it
|
90
|
+
items = nil
|
91
|
+
unless hash['items'].nil?
|
92
|
+
items = []
|
93
|
+
hash['items'].each do |structure|
|
94
|
+
items << (SimplifiedTrackObject.from_hash(structure) if structure)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
items = nil unless hash.key?('items')
|
99
|
+
|
100
|
+
# Create object from extracted values.
|
101
|
+
PagingSimplifiedTrackObject.new(href,
|
102
|
+
limit,
|
103
|
+
mnext,
|
104
|
+
offset,
|
105
|
+
previous,
|
106
|
+
total,
|
107
|
+
items)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# PagingTrackObject Model.
|
8
|
+
class PagingTrackObject < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# A link to the Web API endpoint returning the full result of the request
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :href
|
15
|
+
|
16
|
+
# The maximum number of items in the response (as set in the query or by
|
17
|
+
# default).
|
18
|
+
# @return [Integer]
|
19
|
+
attr_accessor :limit
|
20
|
+
|
21
|
+
# URL to the next page of items. ( `null` if none)
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :mnext
|
24
|
+
|
25
|
+
# The offset of the items returned (as set in the query or by default)
|
26
|
+
# @return [Integer]
|
27
|
+
attr_accessor :offset
|
28
|
+
|
29
|
+
# URL to the previous page of items. ( `null` if none)
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :previous
|
32
|
+
|
33
|
+
# The total number of items available to return.
|
34
|
+
# @return [Integer]
|
35
|
+
attr_accessor :total
|
36
|
+
|
37
|
+
# The total number of items available to return.
|
38
|
+
# @return [Array[TrackObject]]
|
39
|
+
attr_accessor :items
|
40
|
+
|
41
|
+
# A mapping from model property names to API property names.
|
42
|
+
def self.names
|
43
|
+
@_hash = {} if @_hash.nil?
|
44
|
+
@_hash['href'] = 'href'
|
45
|
+
@_hash['limit'] = 'limit'
|
46
|
+
@_hash['mnext'] = 'next'
|
47
|
+
@_hash['offset'] = 'offset'
|
48
|
+
@_hash['previous'] = 'previous'
|
49
|
+
@_hash['total'] = 'total'
|
50
|
+
@_hash['items'] = 'items'
|
51
|
+
@_hash
|
52
|
+
end
|
53
|
+
|
54
|
+
# An array for optional fields
|
55
|
+
def self.optionals
|
56
|
+
[]
|
57
|
+
end
|
58
|
+
|
59
|
+
# An array for nullable fields
|
60
|
+
def self.nullables
|
61
|
+
%w[
|
62
|
+
mnext
|
63
|
+
previous
|
64
|
+
]
|
65
|
+
end
|
66
|
+
|
67
|
+
def initialize(href = nil, limit = nil, mnext = nil, offset = nil,
|
68
|
+
previous = nil, total = nil, items = nil)
|
69
|
+
@href = href
|
70
|
+
@limit = limit
|
71
|
+
@mnext = mnext
|
72
|
+
@offset = offset
|
73
|
+
@previous = previous
|
74
|
+
@total = total
|
75
|
+
@items = items
|
76
|
+
end
|
77
|
+
|
78
|
+
# Creates an instance of the object from a hash.
|
79
|
+
def self.from_hash(hash)
|
80
|
+
return nil unless hash
|
81
|
+
|
82
|
+
# Extract variables from the hash.
|
83
|
+
href = hash.key?('href') ? hash['href'] : nil
|
84
|
+
limit = hash.key?('limit') ? hash['limit'] : nil
|
85
|
+
mnext = hash.key?('next') ? hash['next'] : nil
|
86
|
+
offset = hash.key?('offset') ? hash['offset'] : nil
|
87
|
+
previous = hash.key?('previous') ? hash['previous'] : nil
|
88
|
+
total = hash.key?('total') ? hash['total'] : nil
|
89
|
+
# Parameter is an array, so we need to iterate through it
|
90
|
+
items = nil
|
91
|
+
unless hash['items'].nil?
|
92
|
+
items = []
|
93
|
+
hash['items'].each do |structure|
|
94
|
+
items << (TrackObject.from_hash(structure) if structure)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
items = nil unless hash.key?('items')
|
99
|
+
|
100
|
+
# Create object from extracted values.
|
101
|
+
PagingTrackObject.new(href,
|
102
|
+
limit,
|
103
|
+
mnext,
|
104
|
+
offset,
|
105
|
+
previous,
|
106
|
+
total,
|
107
|
+
items)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module SpotifyWebApi
|
8
|
+
# PlayHistoryObject Model.
|
9
|
+
class PlayHistoryObject < BaseModel
|
10
|
+
SKIP = Object.new
|
11
|
+
private_constant :SKIP
|
12
|
+
|
13
|
+
# The track the user listened to.
|
14
|
+
# @return [TrackObject]
|
15
|
+
attr_accessor :track
|
16
|
+
|
17
|
+
# The date and time the track was played.
|
18
|
+
# @return [DateTime]
|
19
|
+
attr_accessor :played_at
|
20
|
+
|
21
|
+
# The context the track was played from.
|
22
|
+
# @return [ContextObject]
|
23
|
+
attr_accessor :context
|
24
|
+
|
25
|
+
# A mapping from model property names to API property names.
|
26
|
+
def self.names
|
27
|
+
@_hash = {} if @_hash.nil?
|
28
|
+
@_hash['track'] = 'track'
|
29
|
+
@_hash['played_at'] = 'played_at'
|
30
|
+
@_hash['context'] = 'context'
|
31
|
+
@_hash
|
32
|
+
end
|
33
|
+
|
34
|
+
# An array for optional fields
|
35
|
+
def self.optionals
|
36
|
+
%w[
|
37
|
+
track
|
38
|
+
played_at
|
39
|
+
context
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
# An array for nullable fields
|
44
|
+
def self.nullables
|
45
|
+
[]
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(track = SKIP, played_at = SKIP, context = SKIP)
|
49
|
+
@track = track unless track == SKIP
|
50
|
+
@played_at = played_at unless played_at == SKIP
|
51
|
+
@context = context unless context == SKIP
|
52
|
+
end
|
53
|
+
|
54
|
+
# Creates an instance of the object from a hash.
|
55
|
+
def self.from_hash(hash)
|
56
|
+
return nil unless hash
|
57
|
+
|
58
|
+
# Extract variables from the hash.
|
59
|
+
track = TrackObject.from_hash(hash['track']) if hash['track']
|
60
|
+
played_at = if hash.key?('played_at')
|
61
|
+
(DateTimeHelper.from_rfc3339(hash['played_at']) if hash['played_at'])
|
62
|
+
else
|
63
|
+
SKIP
|
64
|
+
end
|
65
|
+
context = ContextObject.from_hash(hash['context']) if hash['context']
|
66
|
+
|
67
|
+
# Create object from extracted values.
|
68
|
+
PlayHistoryObject.new(track,
|
69
|
+
played_at,
|
70
|
+
context)
|
71
|
+
end
|
72
|
+
|
73
|
+
def to_custom_played_at
|
74
|
+
DateTimeHelper.to_rfc3339(played_at)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,193 @@
|
|
1
|
+
# spotify_web_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SpotifyWebApi
|
7
|
+
# PlaylistObject Model.
|
8
|
+
class PlaylistObject < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# `true` if the owner allows other users to modify the playlist.
|
13
|
+
# @return [TrueClass | FalseClass]
|
14
|
+
attr_accessor :collaborative
|
15
|
+
|
16
|
+
# The playlist description. _Only returned for modified, verified playlists,
|
17
|
+
# otherwise_ `null`.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :description
|
20
|
+
|
21
|
+
# Known external URLs for this playlist.
|
22
|
+
# @return [ExternalUrlObject]
|
23
|
+
attr_accessor :external_urls
|
24
|
+
|
25
|
+
# Information about the followers of the playlist.
|
26
|
+
# @return [FollowersObject]
|
27
|
+
attr_accessor :followers
|
28
|
+
|
29
|
+
# A link to the Web API endpoint providing full details of the playlist.
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :href
|
32
|
+
|
33
|
+
# The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) for the
|
34
|
+
# playlist.
|
35
|
+
# @return [String]
|
36
|
+
attr_accessor :id
|
37
|
+
|
38
|
+
# Images for the playlist. The array may be empty or contain up to three
|
39
|
+
# images. The images are returned by size in descending order. See [Working
|
40
|
+
# with Playlists](/documentation/web-api/concepts/playlists). _**Note**: If
|
41
|
+
# returned, the source URL for the image (`url`) is temporary and will
|
42
|
+
# expire in less than a day._
|
43
|
+
# @return [Array[ImageObject]]
|
44
|
+
attr_accessor :images
|
45
|
+
|
46
|
+
# The name of the playlist.
|
47
|
+
# @return [String]
|
48
|
+
attr_accessor :name
|
49
|
+
|
50
|
+
# The user who owns the playlist
|
51
|
+
# @return [PlaylistOwnerObject]
|
52
|
+
attr_accessor :owner
|
53
|
+
|
54
|
+
# The playlist's public/private status: `true` the playlist is public,
|
55
|
+
# `false` the playlist is private, `null` the playlist status is not
|
56
|
+
# relevant. For more about public/private status, see [Working with
|
57
|
+
# Playlists](/documentation/web-api/concepts/playlists)
|
58
|
+
# @return [TrueClass | FalseClass]
|
59
|
+
attr_accessor :public
|
60
|
+
|
61
|
+
# The version identifier for the current playlist. Can be supplied in other
|
62
|
+
# requests to target a specific playlist version
|
63
|
+
# @return [String]
|
64
|
+
attr_accessor :snapshot_id
|
65
|
+
|
66
|
+
# The tracks of the playlist.
|
67
|
+
# @return [PagingPlaylistTrackObject]
|
68
|
+
attr_accessor :tracks
|
69
|
+
|
70
|
+
# The object type: "playlist"
|
71
|
+
# @return [String]
|
72
|
+
attr_accessor :type
|
73
|
+
|
74
|
+
# The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
|
75
|
+
# the playlist.
|
76
|
+
# @return [String]
|
77
|
+
attr_accessor :uri
|
78
|
+
|
79
|
+
# A mapping from model property names to API property names.
|
80
|
+
def self.names
|
81
|
+
@_hash = {} if @_hash.nil?
|
82
|
+
@_hash['collaborative'] = 'collaborative'
|
83
|
+
@_hash['description'] = 'description'
|
84
|
+
@_hash['external_urls'] = 'external_urls'
|
85
|
+
@_hash['followers'] = 'followers'
|
86
|
+
@_hash['href'] = 'href'
|
87
|
+
@_hash['id'] = 'id'
|
88
|
+
@_hash['images'] = 'images'
|
89
|
+
@_hash['name'] = 'name'
|
90
|
+
@_hash['owner'] = 'owner'
|
91
|
+
@_hash['public'] = 'public'
|
92
|
+
@_hash['snapshot_id'] = 'snapshot_id'
|
93
|
+
@_hash['tracks'] = 'tracks'
|
94
|
+
@_hash['type'] = 'type'
|
95
|
+
@_hash['uri'] = 'uri'
|
96
|
+
@_hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# An array for optional fields
|
100
|
+
def self.optionals
|
101
|
+
%w[
|
102
|
+
collaborative
|
103
|
+
description
|
104
|
+
external_urls
|
105
|
+
followers
|
106
|
+
href
|
107
|
+
id
|
108
|
+
images
|
109
|
+
name
|
110
|
+
owner
|
111
|
+
public
|
112
|
+
snapshot_id
|
113
|
+
tracks
|
114
|
+
type
|
115
|
+
uri
|
116
|
+
]
|
117
|
+
end
|
118
|
+
|
119
|
+
# An array for nullable fields
|
120
|
+
def self.nullables
|
121
|
+
%w[
|
122
|
+
description
|
123
|
+
]
|
124
|
+
end
|
125
|
+
|
126
|
+
def initialize(collaborative = SKIP, description = SKIP,
|
127
|
+
external_urls = SKIP, followers = SKIP, href = SKIP,
|
128
|
+
id = SKIP, images = SKIP, name = SKIP, owner = SKIP,
|
129
|
+
public = SKIP, snapshot_id = SKIP, tracks = SKIP,
|
130
|
+
type = SKIP, uri = SKIP)
|
131
|
+
@collaborative = collaborative unless collaborative == SKIP
|
132
|
+
@description = description unless description == SKIP
|
133
|
+
@external_urls = external_urls unless external_urls == SKIP
|
134
|
+
@followers = followers unless followers == SKIP
|
135
|
+
@href = href unless href == SKIP
|
136
|
+
@id = id unless id == SKIP
|
137
|
+
@images = images unless images == SKIP
|
138
|
+
@name = name unless name == SKIP
|
139
|
+
@owner = owner unless owner == SKIP
|
140
|
+
@public = public unless public == SKIP
|
141
|
+
@snapshot_id = snapshot_id unless snapshot_id == SKIP
|
142
|
+
@tracks = tracks unless tracks == SKIP
|
143
|
+
@type = type unless type == SKIP
|
144
|
+
@uri = uri unless uri == SKIP
|
145
|
+
end
|
146
|
+
|
147
|
+
# Creates an instance of the object from a hash.
|
148
|
+
def self.from_hash(hash)
|
149
|
+
return nil unless hash
|
150
|
+
|
151
|
+
# Extract variables from the hash.
|
152
|
+
collaborative = hash.key?('collaborative') ? hash['collaborative'] : SKIP
|
153
|
+
description = hash.key?('description') ? hash['description'] : SKIP
|
154
|
+
external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
|
155
|
+
followers = FollowersObject.from_hash(hash['followers']) if hash['followers']
|
156
|
+
href = hash.key?('href') ? hash['href'] : SKIP
|
157
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
158
|
+
# Parameter is an array, so we need to iterate through it
|
159
|
+
images = nil
|
160
|
+
unless hash['images'].nil?
|
161
|
+
images = []
|
162
|
+
hash['images'].each do |structure|
|
163
|
+
images << (ImageObject.from_hash(structure) if structure)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
images = SKIP unless hash.key?('images')
|
168
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
169
|
+
owner = PlaylistOwnerObject.from_hash(hash['owner']) if hash['owner']
|
170
|
+
public = hash.key?('public') ? hash['public'] : SKIP
|
171
|
+
snapshot_id = hash.key?('snapshot_id') ? hash['snapshot_id'] : SKIP
|
172
|
+
tracks = PagingPlaylistTrackObject.from_hash(hash['tracks']) if hash['tracks']
|
173
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
174
|
+
uri = hash.key?('uri') ? hash['uri'] : SKIP
|
175
|
+
|
176
|
+
# Create object from extracted values.
|
177
|
+
PlaylistObject.new(collaborative,
|
178
|
+
description,
|
179
|
+
external_urls,
|
180
|
+
followers,
|
181
|
+
href,
|
182
|
+
id,
|
183
|
+
images,
|
184
|
+
name,
|
185
|
+
owner,
|
186
|
+
public,
|
187
|
+
snapshot_id,
|
188
|
+
tracks,
|
189
|
+
type,
|
190
|
+
uri)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|