An assault by Boko Haram on Sunday aimed at taking over the key northeastern Nigerian city of Maiduguri has been repelled, the military said, roughly 12 hours after fighting began.