Sha256: 17cc5be20053ab5770f11f8581fdd79b7a2b762862ba6c69e4e60877096f9cfa

Contents?: true

Size: 961 Bytes

Versions: 5

Compression:

Stored size: 961 Bytes

Contents

require 'keratin/client'
require 'net/http'

module Keratin::AuthN
  class API < Keratin::Client
    def get(account_id)
      super(path: "/accounts/#{account_id}")
    end

    def update(account_id, username:)
      patch(path: "/accounts/#{account_id}", body: {
        username: username
      }).result
    end

    def lock(account_id)
      patch(path: "/accounts/#{account_id}/lock").result
    end

    def unlock(account_id)
      patch(path: "/accounts/#{account_id}/unlock").result
    end

    def archive(account_id)
      delete(path: "/accounts/#{account_id}").result
    end

    # returns account_id or raises exception
    def import(username:, password:, locked: false)
      post(path: '/accounts/import', body: {
        username: username,
        password: password,
        locked: locked
      }).result['id']
    end

    def expire_password(account_id)
      patch(path: "/accounts/#{account_id}/expire_password")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
keratin-authn-1.0.4 lib/keratin/authn/api.rb
keratin-authn-1.0.3 lib/keratin/authn/api.rb
keratin-authn-1.0.2 lib/keratin/authn/api.rb
keratin-authn-1.0.1 lib/keratin/authn/api.rb
keratin-authn-1.0.0 lib/keratin/authn/api.rb