Skip to content

Commit

Permalink
code syntax changes
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesad committed Mar 22, 2019
1 parent e754adf commit 02db6f0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions lib/rspotify/base.rb
Expand Up @@ -30,7 +30,6 @@ def self.find(ids, type, market: nil)
warn 'Spotify API does not support finding several users simultaneously'
return false
end
limit = (type == 'album' ? 20 : 50)
find_many(ids, type, market: market)
when String
id = ids
Expand Down Expand Up @@ -143,7 +142,7 @@ def embed(options = {})
frameborder: 0,
allowtransparency: true,
view: nil,
theme: nil,
theme: nil
}
options = default_options.merge(options)

Expand Down
2 changes: 1 addition & 1 deletion lib/rspotify/connection.rb
Expand Up @@ -9,7 +9,7 @@ class MissingAuthentication < StandardError; end
API_URI = 'https://api.spotify.com/v1/'.freeze
AUTHORIZE_URI = 'https://accounts.spotify.com/authorize'.freeze
TOKEN_URI = 'https://accounts.spotify.com/api/token'.freeze
VERBS = %w(get post put delete)
VERBS = %w[get post put delete].freeze

class << self
attr_accessor :raw_response
Expand Down
16 changes: 8 additions & 8 deletions lib/rspotify/player.rb
Expand Up @@ -10,12 +10,12 @@ def initialize(user, options = {})
@is_playing = options['is_playing']

@track = if options['track']
Track.new options['track']
end
Track.new options['track']
end

@device = if options['device']
Device.new options['device']
end
Device.new options['device']
end
end

def playing?
Expand All @@ -28,7 +28,7 @@ def playing?
# @example
# player = user.player
# player.play_context(nil,"spotify:album:1Je1IMUlBXcx1Fz0WE7oPT")
def play_context(device_id=nil, uri)
def play_context(device_id = nil, uri)
params = {"context_uri": uri}
play(device_id, params)
end
Expand All @@ -40,7 +40,7 @@ def play_context(device_id=nil, uri)
# player = user.player
# tracks_uris = ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]
# player.play_tracks(nil, tracks_uris)
def play_tracks(device_id=nil, uris)
def play_tracks(device_id = nil, uris)
params = {"uris": uris}
play(device_id, params)
end
Expand All @@ -52,7 +52,7 @@ def play_tracks(device_id=nil, uris)
# player = user.player
# player.play_track(nil, "spotify:track:4iV5W9uYEdYUVa79Axb7Rh")
# # User must be a premium subscriber for this feature to work.
def play_track(device_id=nil, uri)
def play_track(device_id = nil, uri)
params = {"uris": [uri]}
play(device_id, params)
end
Expand All @@ -65,7 +65,7 @@ def play_track(device_id=nil, uri)
# player.play
def play(device_id = nil, params = {})
url = "me/player/play"
url = device_id.nil? ? url : url+"?device_id=#{device_id}"
url = device_id.nil? ? url : "#{url}?device_id=#{device_id}"

User.oauth_put(@user.id, url, params.to_json)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rspotify/version.rb
@@ -1,3 +1,3 @@
module RSpotify
VERSION = '2.6.0'
VERSION = '2.6.0'.freeze
end

0 comments on commit 02db6f0

Please sign in to comment.