rspotify 1.21.0 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5401f81655cd7d706dde9f93f183661753a109b7
4
- data.tar.gz: a63d95d2af54dee701e1fb28828d3d1d71fe9124
3
+ metadata.gz: 3a7ce4a25d971ff2ecaed66fcf716dc165c015cd
4
+ data.tar.gz: f18c09b1dddd737eb59f33c2d408208b7f82d522
5
5
  SHA512:
6
- metadata.gz: 888b12960363e50b95cf1729298312beb99b8876626afd37472afc28d6c6de266ce5b5ba7beb7afc8ebf47aa83bf50fa3a89dc8566f674168ba9e07eaa40b8cc
7
- data.tar.gz: 176d975c4012163ed91f0ec8b3f1949b32f7c918a943a7bfa5f2a86b676c595c1a05bbd308407c4b8da60b62123864121f0e25812037d50202a1d34ce6ecd5f1
6
+ metadata.gz: ebddd5cafe9200d6523c604fd88d3972e92bae5f70d34de9d316475dc2d57f4b574850128bc3090303cc886a5d44c6645e2bfa755376745fec70f6b1022d85f5
7
+ data.tar.gz: 93fc3eefd76fed937f9261004257c6efb2e29a627e1d92286867790a8b7b2959c2bdc31f4562f51c39478c419598c2261ae884d8acbedab4d1a6e82748f26642
@@ -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
  #
@@ -1,3 +1,3 @@
1
1
  module RSpotify
2
- VERSION = '1.21.0'
2
+ VERSION = '1.22.0'
3
3
  end
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.21.0
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-06 00:00:00.000000000 Z
11
+ date: 2017-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2