rspotify 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rspotify/track.rb +4 -0
- data/lib/rspotify/user.rb +14 -0
- data/lib/rspotify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a7ce4a25d971ff2ecaed66fcf716dc165c015cd
|
4
|
+
data.tar.gz: f18c09b1dddd737eb59f33c2d408208b7f82d522
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebddd5cafe9200d6523c604fd88d3972e92bae5f70d34de9d316475dc2d57f4b574850128bc3090303cc886a5d44c6645e2bfa755376745fec70f6b1022d85f5
|
7
|
+
data.tar.gz: 93fc3eefd76fed937f9261004257c6efb2e29a627e1d92286867790a8b7b2959c2bdc31f4562f51c39478c419598c2261ae884d8acbedab4d1a6e82748f26642
|
data/lib/rspotify/track.rb
CHANGED
@@ -11,6 +11,8 @@ module RSpotify
|
|
11
11
|
# @attr [Integer] popularity The popularity of the track. The value will be between 0 and 100, with 100 being the most popular
|
12
12
|
# @attr [String] preview_url A link to a 30 second preview (MP3 format) of the track
|
13
13
|
# @attr [Integer] track_number The number of the track. If an album has several discs, the track number is the number on the specified disc
|
14
|
+
# @attr [String] played_at The date and time the track was played. Only present when pulled from /recently-played
|
15
|
+
# @attr [String] context_type The context the track was played from. Only present when pulled from /recently-played
|
14
16
|
class Track < Base
|
15
17
|
|
16
18
|
# Returns Track object(s) with id(s) provided
|
@@ -64,6 +66,8 @@ module RSpotify
|
|
64
66
|
@popularity = options['popularity']
|
65
67
|
@preview_url = options['preview_url']
|
66
68
|
@track_number = options['track_number']
|
69
|
+
@played_at = options['played_at']
|
70
|
+
@context_type = options['context_type']
|
67
71
|
|
68
72
|
@album = if options['album']
|
69
73
|
Album.new options['album']
|
data/lib/rspotify/user.rb
CHANGED
@@ -122,6 +122,20 @@ module RSpotify
|
|
122
122
|
Track.new response["item"]
|
123
123
|
end
|
124
124
|
|
125
|
+
def recently_played
|
126
|
+
url = "me/player/recently-played"
|
127
|
+
response = RSpotify.resolve_auth_request(@id, url)
|
128
|
+
return response if RSpotify.raw_response
|
129
|
+
|
130
|
+
json = RSpotify.raw_response ? JSON.parse(response) : response
|
131
|
+
json['items'].map do |t|
|
132
|
+
data = t['track']
|
133
|
+
data['played_at'] = t['played_at']
|
134
|
+
data['context_type'] = t['context']['type']
|
135
|
+
Track.new data
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
125
139
|
# Add the current user as a follower of one or more artists, other Spotify users or a playlist. Following artists or users require the *user-follow-modify*
|
126
140
|
# scope. Following a playlist publicly requires the *playlist-modify-public* scope; following it privately requires the *playlist-modify-private* scope.
|
127
141
|
#
|
data/lib/rspotify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Sad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|