require "omniauth-oauth" require "multi_xml" module OmniAuth module Strategies class MapMyHike < OmniAuth::Strategies::OAuth option :name, "mapmyhike" option :client_options, { :site => "http://api.mapmyfitness.com/3.1" } uid { raw_info['result']['output']['user']['user_id'] } info do { :email => raw_info['result']['output']['user']['email'], :first_name => raw_info['result']['output']['user']['first_name'], :last_name => raw_info['result']['output']['user']['last_name'] } end extra do { 'raw_info' => raw_info } end def raw_info @raw_info ||= MultiXml.parse(access_token.get("/users/get_user?o=xml").body) end end end end OmniAuth.config.add_camelization 'mapmyhike', 'MapMyHike'