Module: SimpleSpotify::Actions::Player

Defined in:
lib/simplespotify/actions/player.rb

Instance Method Summary collapse

Instance Method Details

#recently_played(limit = 50, after = nil, before = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/simplespotify/actions/player.rb', line 5

def recently_played limit=50, after=nil, before=nil
  query = {
    limit: limit,
  }
  query[:after] = after if after
  query[:before] = before if before
  response = get "me/player/recently-played?limit=#{limit}"

  refresh = -> url {
    puts url
    response = get url
    return Model::Collection.of(SimpleSpotify::Model::PlayEvent, response.body, &refresh)
  }
  Model::Collection.of(SimpleSpotify::Model::PlayEvent, response.body, &refresh)
end