def request(method, params = {}, secure = false)
      refresh_token if @comm_token

      url = "#{secure ? 'https' : 'http'}://grooveshark.com/more.php?#{method}"
      begin
        data = RestClient.post(url,
                               body(method, params).to_json,
                               'Content-Type' => 'application/json')
      rescue StandardError => ex
        raise GeneralError, ex.message
      end

      data = JSON.parse(data)
      data = data.normalize if data.is_a?(Hash)

      if data.key?('fault')
        fail ApiError, data['fault']
      else
        data['result']
      end
    end
def request(method, params = {}, secure = false)
      refresh_token if @comm_token

      url = "#{secure ? 'https' : 'http'}://grooveshark.com/more.php?#{method}"
      begin
        data = RestClient.post(url,
                               body(method, params).to_json,
                               'Content-Type' => 'application/json')
      rescue StandardError => ex
        raise GeneralError, ex.message
      end

      data = JSON.parse(data)
      data = data.normalize if data.is_a?(Hash)

      if data.key?('fault')
        fail ApiError, data['fault']
      else
        data['result']
      end
    end
Perform API request