Sha256: 5a95b2bd718faf9145bd30b944616b58dc20d4dcbb8b8392eaf8dcdfd0378bf9

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

require 'omniauth-oauth'
require 'multi_json'

module OmniAuth
  module Strategies
    class Cacoo < OmniAuth::Strategies::OAuth
      option :name, 'cacoo'

      option :client_options, {
        :site => 'https://cacoo.com',
        :authorize_path => '/oauth/authorize',
        :access_token_path => '/oauth/access_token',
        :request_token_path => '/oauth/request_token'
      }

      uid { raw_info['name'] }

      info do
        {
          :name   => raw_info['name'],
          :nickname => raw_info['nickname'],
          :image_url  => raw_info['imageUrl']
        }
      end

      extra do
        {
          'raw_info' => raw_info
        }
      end

      def raw_info
        @raw_info ||= MultiJson.decode(access_token.get('/api/v1/account.json').body)
      rescue ::Errno::ETIMEDOUT
        raise ::Timeout::Error
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-cacoo-0.0.1 lib/omniauth/strategies/cacoo.rb