You cannot play Pokémon Ruby online. The game was released for the Game Boy Advance in 2003, and the console did not have online functionality at that time. A wireless adapter was released in 2004, but Pokémon Ruby does not support this hardware.
However, even though the original Game Boy Advance version does not feature online play, the game is being remade for 3DS. Pokémon Omega Ruby is set for release on November 21, 2014. Though online play hasn't yet been confirmed for Omega Ruby, the fact that online play was added in past Pokémon remakes, such as Pokémon HeartGold, makes the inclusion of online features in Omega Ruby also quite likely.