Sha256: 123d37a11eea7e46aeb9e93ec8c658a0edacac39afe6f2d212b29b1f159c53e7
Contents?: true
Size: 916 Bytes
Versions: 2
Compression:
Stored size: 916 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', authorize_url: '/oauth/authorize', token_url: '/oauth/token' uid { raw_info[:id] } extra do { raw_info: raw_info } end def raw_info return @raw_info unless @raw_info.nil? endpoint = 'https://timetreeapis.com/user' options = { headers: { 'Accept' => 'application/vnd.timetree.v1+json' } } res = access_token.get(endpoint, options) parsed_body = JSON.parse(res.body, symbolize_names: true) @raw_info = parsed_body[:data] || {} end def callback_url full_host + script_name + callback_path end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
omniauth-timetree-0.1.3 | lib/omniauth/strategies/timetree.rb |
omniauth-timetree-0.1.2 | lib/omniauth/strategies/timetree.rb |