Robbie Ray agrees to five-year contract with Mariners