class Spotify::API::User

Constants

USERS_URL

API endpoint for users.

Public Class Methods

search_by_id(args = {}) click to toggle source

Gets an user.

@param [Hash] args the search arguments. @option [Fixnum] :timeout the max time a request can take. @option [Fixnum] :retries the number of retries if necessary.

@return [Public::User] the extracted user.

# File lib/spotify/api/user.rb, line 20
def self.search_by_id(args = {})
  service_params = args.slice(:timeout, :retries)
  args           = args.slice(:id)

  self.new(service_params).search_by_id(args)
end

Public Instance Methods

body() click to toggle source

Parses the response to JSON to get more flexible.

@return [Hash] the parsed response.

# File lib/spotify/api/user.rb, line 49
def body
  @response = JSON.parse(response)
rescue
  Spotify::Models::Error.parser_error
end
search_by_id(args = {}) click to toggle source

Gets a track.

@param [Hash] args the search arguments. @option [String] :id the track id. @option [String] :market the market.

@return [Public::User] the extracted user.

# File lib/spotify/api/user.rb, line 36
def search_by_id(args = {})
  get(USERS_URL + '/' + args[:id].to_s)

  define_response do
    Spotify::Models::Simplified::User.new(response)
  end
end