lib/omniauth/strategies/osm.rb in omniauth-osm-0.1.1 vs lib/omniauth/strategies/osm.rb in omniauth-osm-0.1.2
- old
+ new
@@ -1,17 +1,18 @@
require 'omniauth-oauth'
+require 'multi_json'
module OmniAuth
module Strategies
class Osm < OmniAuth::Strategies::OAuth
option :name, "osm"
option :client_options, {
:site => 'http://www.openstreetmap.org',
- :request_token_url => 'http://www.openstreetmap.org/oauth/request_token',
- :access_token_url => 'http://www.openstreetmap.org/oauth/access_token',
- :authorize_url => 'http://www.openstreetmap.org/oauth/authorize'
+ :request_token_url => 'http://www.openstreetmap.org/oauth/request_token',
+ :access_token_url => 'http://www.openstreetmap.org/oauth/access_token',
+ :authorize_url => 'http://www.openstreetmap.org/oauth/authorize'
}
uid{ raw_info['user']['id'] }
info do
@@ -43,10 +44,10 @@
extra do
{ 'raw_info' => raw_info }
end
def raw_info
- @raw_info ||= Hash.from_xml(access_token.get('/api/0.6/user/details.json').body)['osm']
+ @raw_info ||= MultiJson.decode(access_token.get('/api/0.6/user/details.json').body)['osm']
rescue ::Errno::ETIMEDOUT
raise ::Timeout::Error
end
end
end