def canonical
      canonical = ""
      canonical << method.to_s.upcase << "\n"
      canonical << uri.path << "\n"

      canonical_query.each_with_index do |(param,value), index|
      canonical << param << "=" << value
      canonical << "&" unless index == query.size - 1
      end

      canonical << "\n"
      canonical << canonical_headers.map{|h| h.join(":")}.join("\n")
      canonical << "\n\n"
      canonical << signed_headers.join(";")
      canonical << "\n"

      canonical << digest.hexdigest(body.to_s).downcase
      canonical
    end
def canonical
      canonical = ""
      canonical << method.to_s.upcase << "\n"
      canonical << uri.path << "\n"

      canonical_query.each_with_index do |(param,value), index|
      canonical << param << "=" << value
      canonical << "&" unless index == query.size - 1
      end

      canonical << "\n"
      canonical << canonical_headers.map{|h| h.join(":")}.join("\n")
      canonical << "\n\n"
      canonical << signed_headers.join(";")
      canonical << "\n"

      canonical << digest.hexdigest(body.to_s).downcase
      canonical
    end
Task 1: Create a canonical request.