Sha256: ac58519478a1697dff024852d96146af375d10c62a05b802fb5c51c308138d6f
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require 'omniauth-oauth2' module OmniAuth module Strategies class Cronofy < OmniAuth::Strategies::OAuth2 option :name, "cronofy" def self.api_url @api_url ||= (ENV['CRONOFY_API_URL'] || "https://api.cronofy.com") end def self.api_url=(value) @api_url = value end def self.app_url @app_url ||= (ENV['CRONOFY_APP_URL'] || "https://app.cronofy.com") end def self.app_url=(value) @app_url = value end option :client_options, { :site => ::OmniAuth::Strategies::Cronofy.app_url } 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("#{::OmniAuth::Strategies::Cronofy.api_url}/v1/account").parsed['account'] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-cronofy-0.4.0 | lib/omniauth/strategies/cronofy.rb |