Sha256: a52c987d9b62ebce76cded4159db1f894bf2c5f24b09e94000f87212dddb56b0
Contents?: true
Size: 942 Bytes
Versions: 1
Compression:
Stored size: 942 Bytes
Contents
# frozen_string_literal: true require 'omniauth-oauth2' module OmniAuth module Strategies # OmniAuth strategy for Calendly class Calendly < OmniAuth::Strategies::OAuth2 option :name, 'calendly' option :client_options, site: 'https://auth.calendly.com' USER_API_URL = 'https://api.calendly.com/users/' uid { extract_uid } extra { {raw_info: raw_info} } private def raw_info return @raw_info if defined?(@raw_info) @raw_info = access_token.get("#{USER_API_URL}me").parsed end def extract_uid return unless raw_info return unless raw_info['resource'] return unless raw_info['resource']['uri'] uri = raw_info['resource']['uri'] re = /\A#{USER_API_URL}(.+)\z/ m = re.match uri return if m.nil? m[1] end def callback_url full_host + callback_path end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-calendly-1.0.1 | lib/omniauth/strategies/calendly.rb |