Class: OmniAuth::Strategies::Meetup
- Defined in:
- lib/omniauth/strategies/oauth/meetup.rb
Overview
Authenticate with Meetup via OAuth and retrieve an access token for API usage
Usage: use OmniAuth::Strategies::Meetup, 'consumerkey', 'consumersecret'
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) ⇒ Meetup
constructor
Initialize meetup middleware.
- #member ⇒ Object
- #parse(response) ⇒ 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) ⇒ Meetup
Initialize meetup middleware
16 17 18 19 20 21 22 23 24 |
# File 'lib/omniauth/strategies/oauth/meetup.rb', line 16 def initialize(app, consumer_key=nil, consumer_secret=nil, ={}, &block) auth_path = ([:sign_in] == false) ? 'http://www.meetup.com/authorize' : 'http://www.meetup.com/authenticate' = { :access_token_path => 'https://api.meetup.com/oauth/access', :authorize_path => auth_path, :request_token_path => 'https://api.meetup.com/oauth/request', } super(app, :meetup, consumer_key, consumer_secret, , , &block) end |
Instance Method Details
#auth_hash ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/omniauth/strategies/oauth/meetup.rb', line 26 def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => member['id'], 'user_info' => user_info, 'extra' => { 'user_hash' => member, }, } ) end |
#member ⇒ Object
49 50 51 |
# File 'lib/omniauth/strategies/oauth/meetup.rb', line 49 def member @member ||= parse(@access_token.get('https://api.meetup.com/members.json?relation=self').body)['results'][0] end |
#parse(response) ⇒ Object
53 54 55 |
# File 'lib/omniauth/strategies/oauth/meetup.rb', line 53 def parse(response) MultiJson.decode(response) end |
#user_info ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/omniauth/strategies/oauth/meetup.rb', line 38 def user_info { 'name' => member['name'], 'image' => member['photo_url'], 'location' => member['city'], 'urls' => { 'profile' => member['link'], }, } end |