Class: OmniAuth::Strategies::Meetup
- Defined in:
- lib/omniauth/strategies/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
19 20 21 22 23 24 25 26 |
# File 'lib/omniauth/strategies/meetup.rb', line 19 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' super(app, :meetup, consumer_key, consumer_secret, { :request_token_path => "https://api.meetup.com/oauth/request", :access_token_path => "https://api.meetup.com/oauth/access", :authorize_path => auth_path }, ) end |
Instance Method Details
#auth_hash ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/omniauth/strategies/meetup.rb', line 28 def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => member['id'], 'user_info' => user_info, 'extra' => { 'user_hash' => member } }) end |
#member ⇒ Object
47 48 49 |
# File 'lib/omniauth/strategies/meetup.rb', line 47 def member @member ||= parse(@access_token.get('https://api.meetup.com/members.json?relation=self').body)['results'][0] end |
#parse(response) ⇒ Object
51 52 53 |
# File 'lib/omniauth/strategies/meetup.rb', line 51 def parse(response) MultiJson.decode(response) end |
#user_info ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/omniauth/strategies/meetup.rb', line 36 def user_info { 'name' => member['name'], 'image' => member['photo_url'], 'location' => member['city'], 'urls' => { 'profile' => member['link'] } } end |