Skip to content

Commit

Permalink
Merge pull request #1 from identification-io/master
Browse files Browse the repository at this point in the history
Updated with data from latest endpoint
  • Loading branch information
lucasallan committed Oct 20, 2015
2 parents 003de99 + dd4d783 commit 34562db
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/omniauth-podio/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Omniauth
module Podio
VERSION = "0.0.1"
VERSION = "0.1.0"
end
end
31 changes: 23 additions & 8 deletions lib/omniauth/strategies/podio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,44 @@ module OmniAuth
module Strategies
class Podio < OmniAuth::Strategies::OAuth2
option :client_options, {
:site => 'https://api.podio.com/',
:authorize_url => 'https://podio.com/oauth/authorize',
:token_url => "https://podio.com/oauth/token"
site: 'https://api.podio.com/',
authorize_url: 'https://podio.com/oauth/authorize',
token_url: 'https://podio.com/oauth/token'
}

def request_phase
super
end

uid do
raw_info["user"]["user_id"]
end

info do
profile_info = raw_info["profile"]
user_info = raw_info["user"]
email = user_info["mail"]
verified = user_info["mails"].any?{|mail| mail["mail"] == email && mail["verified"] == true}

{
:email => raw_info["mail"],
:user_id => raw_info["user_id"]

email: email,
verified: verified,
name: profile_info["name"],
user_id: profile_info["user_id"].to_s,
image: profile_info["image"] && profile_info["image"]["link"],
location: profile_info["location"] && profile_info["location"][0],
status: user_info["status"],
time_zone: user_info["timezone"],
locale: user_info["locale"]
}
end

extra do
{:raw_info => raw_info}
{raw_info: raw_info}
end

def raw_info
@raw_info ||= MultiJson.decode(access_token.get('/user').body)
@raw_info ||= MultiJson.decode(access_token.get('/user/status').body)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions omniauth-podio.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ $:.push File.expand_path("../lib", __FILE__)
require "omniauth-podio/version"

Gem::Specification.new do |gem|
gem.authors = ["Lucas Allan"]
gem.email = ["[email protected]"]
gem.authors = ["Lucas Allan", "Joel Van Horn"]
gem.email = ["[email protected]", "[email protected]"]
gem.description = %q{OmniAuth strategy for Podio.}
gem.summary = %q{OmniAuth strategy for Podio.}
gem.homepage = "https://github.com/lucasallan/omniauth-podio"
Expand Down

0 comments on commit 34562db

Please sign in to comment.