def add_torrent(file, type = :url, options = {})
      arguments = set_arguments_from_options(options)

      case type
        when :url
          file = URI.encode(file) if URI.decode(file) == file
          arguments.filename = file
        when :file
          arguments.metainfo = Base64.encode64(File.read(file))
        else
          raise ArgumentError.new('type has to be :url or :file.')
      end

      response = rpc('torrent-add', arguments)
      id = get_id_from_response(response)

      log_message = 'torrent-add result: ' + response.result
      log_message << ' (id ' + id.to_s + ')' if id
      @log.debug(log_message)

      if id && options[:seed_ratio_limit]
        set_torrent(id, {
          'seedRatioLimit' => options[:seed_ratio_limit].to_f,
          'seedRatioMode' => 1
        })
      end

      response
    end
def add_torrent(file, type = :url, options = {})
      arguments = set_arguments_from_options(options)

      case type
        when :url
          file = URI.encode(file) if URI.decode(file) == file
          arguments.filename = file
        when :file
          arguments.metainfo = Base64.encode64(File.read(file))
        else
          raise ArgumentError.new('type has to be :url or :file.')
      end

      response = rpc('torrent-add', arguments)
      id = get_id_from_response(response)

      log_message = 'torrent-add result: ' + response.result
      log_message << ' (id ' + id.to_s + ')' if id
      @log.debug(log_message)

      if id && options[:seed_ratio_limit]
        set_torrent(id, {
          'seedRatioLimit' => options[:seed_ratio_limit].to_f,
          'seedRatioMode' => 1
        })
      end

      response
    end
POST json packed torrent add command.