How do you beat Metal Gear RAY in Metal Gear Rising: Revengeance?

Quick answer: Hit the targets on RAY’s legs until Blade Mode is offered and cut its armor and cannon. In the second fight, slice its rockets, jump its cannon sweep and finish it with the on-screen prompts.
Show walkthrough (quest spoilers)
Round one: legs
Run under RAY and attack its legs. When the prompt shows, enter Blade Mode and cut the armor and cannon. Repeat this several times, then follow the prompt that brings it down.
Round one: attacks to avoid
Its plasma cannon fires straight ahead, so run to the side rather than straight away from it. Shells land on the ground and explode after a short delay. Red markers show where it will stomp, so leave those spots.
Round two: rockets and cannon
After the sewers, RAY sweeps its cannon from side to side, so jump over the beam. It also fires rocket barrages; use Blade Mode to slice the missiles. Stay in spots that are clear of projectiles and keep attacking until Blade Mode appears again.
Finish
When RAY jumps back, Ninja Run after it and run down the side of the building while dodging rockets and the cannon. Follow the last on-screen prompts to slice RAY apart. The File R-00: Guard Duty walkthrough covers what comes next.
