Ting can convert between various systems for phonetically writing Mandarin Chinese. It can also handle various representation of tones, so it can be used to convert pinyin with numbers to pinyin with tones.
Hanyu Pinyin, Bopomofo, Wade-Giles, Tongyong Pinyin and International Phonetic Alphabet (IPA) are supported.
For code examples visit the GitHub page.
Gems are hosted at GemCutter, so a simple "gem install ting" should do the trick.