Sha256: dc30e745683819a6267002f3297a9e327ce987d64217d13fa7c66bb3228e7787

Contents?: true

Size: 1.14 KB

Versions: 18

Compression:

Stored size: 1.14 KB

Contents

require "forwardable"
require_relative "plural_resource"

module Clerk
  module Resources
    class Users
      extend Forwardable

      def initialize(client)
        @client = client
        @resource = PluralResource.new(client, "users")
      end

      def_delegators :@resource, :all, :find, :create, :update, :delete

      def oauth_access_token(user_id, provider)
        @client.request(:get, "#{@resource.resource_path(user_id)}/oauth_access_tokens/#{provider}")
      end

      def verify_password(user_id, password)
        @client.request(:post, "#{@resource.resource_path(user_id)}/verify_password", body: { password: password })
      end

      def verify_totp(user_id, totp_or_backup_code)
        @client.request(:post, "#{@resource.resource_path(user_id)}/verify_totp", body: { code: totp_or_backup_code })
      end

      def disable_mfa(user_id)
        @client.request(:delete, "#{@resource.resource_path(user_id)}/mfa")
      end

      def organization_memberships(user_id, query_params = {})
        @client.request(:get, "#{@resource.resource_path(user_id)}/organization_memberships", query: query_params)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
clerk-sdk-ruby-3.3.0 lib/clerk/resources/users.rb
clerk-sdk-ruby-3.3.0.beta1 lib/clerk/resources/users.rb
clerk-sdk-ruby-3.2.0 lib/clerk/resources/users.rb
clerk-sdk-ruby-4.0.0.beta3 lib/clerk/resources/users.rb
clerk-sdk-ruby-3.1.0 lib/clerk/resources/users.rb
clerk-sdk-ruby-3.1.0.rc.1 lib/clerk/resources/users.rb
clerk-sdk-ruby-4.0.0.beta2 lib/clerk/resources/users.rb
clerk-sdk-ruby-3.0.0 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.11.1 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.11.0 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.10.0 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.10.0.beta2 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.10.0.beta1 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.9.0 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.9.0.beta3 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.9.0.beta2 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.9.0.beta1 lib/clerk/resources/users.rb
clerk-sdk-ruby-2.8.0 lib/clerk/resources/users.rb