I have been using Omniauth to retrieve an environment that contains the steam username.
The output looks like this:
<OmniAuth::AuthHash::InfoHash image="https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/d4/d45a66fee7932d270ec32d4457d865b485245cf1_medium.jpg" location="YT, CA" name="Daiki" nickname="Corybantic Walrus" urls=#<OmniAuth::AuthHash FriendList=#<URI::HTTP:0x0000000614f590 URL:http://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key=4A8837BF7A6C439681B57F4962D8B011&steamid=76561198128055024&relationship=friend> Profile="http://steamcommunity.com/id/hatterkiller/">> provider="steam" uid="76561198128055024">
I don't really know how to format this inside Stack Overflow, so here is a cleaner Pastebin.
The information I need is inside the <Omniauth::AuthHash::Infohash
thing of the code. Is there a way to use Ruby to retrieve the username (nickname) and to put it inside an array?
Sort of like this, but this only worked for the previous output format:
auth = request.env['omniauth.auth']
session[:current_user] = { :nickname => auth.info['nickname'],
:image => auth.info['image'],
:uid => auth.uid }
<%= session[:current_user][:nickname] %>
` in the index erb isn't working. Is there another way? – corybantic Aug 13 '15 at 11:37