class OmniAuth::Strategies::Todoist

Public Instance Methods

callback_url() click to toggle source

Bugfix for regression introduced after omniauth-oauth2 v1.3.1 details: github.com/intridea/omniauth-oauth2/issues/81

# File lib/omniauth/strategies/todoist.rb, line 41
def callback_url
  options[:callback_url] || full_host + script_name + callback_path
end
raw_info() click to toggle source
# File lib/omniauth/strategies/todoist.rb, line 45
def raw_info
  @raw_info ||= begin
    params = {
      headers: {
        "Content-Type" => "application/x-www-form-urlencoded"
      },
      body: {
        token: access_token.token,
        sync_token: "*",
        resource_types: '["user"]'
      }
    }
    access_token.post("https://api.todoist.com/sync/v8/sync", params).parsed.fetch('user', {})
  end
end

Private Instance Methods

prune!(hash) click to toggle source
# File lib/omniauth/strategies/todoist.rb, line 63
def prune!(hash)
  hash.delete_if do |_, value|
    prune!(value) if value.is_a?(Hash)
    value.nil? || (value.respond_to?(:empty?) && value.empty?)
  end
end