Sha256: 52e5a022caabf3c43f2ccbdefa89e51dd89baf090470469e473a265c1a383cf9

Contents?: true

Size: 939 Bytes

Versions: 1

Compression:

Stored size: 939 Bytes

Contents

module OmniAuth
  module Strategies
    class Cronofy < CronofyBase
      option :name, "cronofy"

      uid { raw_info['account_id'] }

      info do
        {
          :email => raw_info['email'],
          :name => raw_info['name']
        }
      end

      extra do
        {
          'raw_info' => raw_info,
          'linking_profile' => access_token['linking_profile'],
        }
      end

      def callback_url
        options[:redirect_uri] || (full_host + script_name + callback_path)
      end

      def raw_info
        @raw_info ||= access_token.get("#{client_options[:api_url]}/v1/account").parsed['account']
      end

      def request_phase
        link_token = session['omniauth.params']['link_token']
        if link_token && !link_token.empty?
          options[:authorize_params] ||= {}
          options[:authorize_params].merge!(:link_token => link_token)
        end
        super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-cronofy-0.10.0 lib/omniauth/strategies/cronofy.rb