Class: OmniAuth::Strategies::Yammer
- Defined in:
- lib/omniauth/strategies/yammer.rb
Instance Attribute Summary
Attributes inherited from OAuth
#consumer_key, #consumer_options, #consumer_secret, #name
Instance Method Summary collapse
- #auth_hash ⇒ Object
-
#initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) ⇒ Yammer
constructor
A new instance of Yammer.
- #user_hash ⇒ Object
- #user_info ⇒ Object
Methods inherited from OAuth
#callback_phase, #consumer, #request_phase, #unique_id
Constructor Details
#initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block) ⇒ Yammer
Returns a new instance of Yammer.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/omniauth/strategies/yammer.rb', line 7 def initialize(app, consumer_key = nil, consumer_secret = nil, = {}, &block) = { :site => 'https://www.yammer.com', :request_token_path => '/oauth/request_token', :access_token_path => '/oauth/access_token', :authorize_path => "/oauth/authorize" } super(app, :yammer, consumer_key, consumer_secret, , ) end |
Instance Method Details
#auth_hash ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/omniauth/strategies/yammer.rb', line 18 def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => user_hash['id'], 'user_info' => user_info, 'extra' => {'user_hash' => user_hash} }) end |
#user_hash ⇒ Object
38 39 40 |
# File 'lib/omniauth/strategies/yammer.rb', line 38 def user_hash @user_hash ||= MultiJson.decode(@access_token.get('/api/v1/users/current.json').body) end |
#user_info ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/omniauth/strategies/yammer.rb', line 26 def user_info user_hash = self.user_hash { 'nickname' => user_hash['name'], 'name' => user_hash['full-name'], 'location' => user_hash['location'], 'image' => user_hash['mugshot-url'], 'description' => user_hash['job-title'], 'urls' => {'Yammer' => user_hash['web-url']} } end |