lib/omniauth/strategies/yammer.rb in omniauth-yammer-0.0.3 vs lib/omniauth/strategies/yammer.rb in omniauth-yammer-0.0.4

- old
+ new

@@ -19,11 +19,11 @@ :nickname => raw_info['name'], :full_name => raw_info['full_name'], :location => raw_info['location'], :image => raw_info['mugshot_url'], :description => raw_info['job_title'], - :email => raw_info['contact']['email_addresses'][0]['address'], + :email => primary_email, :urls => { :yammer => raw_info['web_url'] } }) end @@ -59,8 +59,11 @@ prune!(value) if value.is_a?(Hash) value.nil? || (value.respond_to?(:empty?) && value.empty?) end end + def primary_email + raw_info['contact']['email_addresses'].detect{|address| address['type'] == 'primary'}['address'] + end end end -end \ No newline at end of file +end