Sha256: e0abd07846304524829843f889b02f162b049f97554426283c4e99ec300f3972

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class TimeTree < OmniAuth::Strategies::OAuth2
      option :name, 'timetree'
      option :client_options, site: 'https://timetreeapp.com'

      uid { raw_info.dig('data', 'id') }

      extra do
        {raw_info: raw_info}
      end

    private

      def raw_info
        return @raw_info if defined?(@raw_info)

        endpoint = 'https://timetreeapis.com/user'
        options = {headers: {'Accept' => 'application/vnd.timetree.v1+json'}}
        @raw_info = access_token.get(endpoint, options).parsed
      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-timetree-1.0.0 lib/omniauth/strategies/timetree.rb