Module: Authsignal

Defined in:
lib/authsignal.rb,
lib/authsignal/client.rb,
lib/authsignal/version.rb,
lib/authsignal/api_error.rb,
lib/authsignal/configuration.rb,
lib/authsignal/middleware/json_request.rb,
lib/authsignal/middleware/json_response.rb

Defined Under Namespace

Modules: Middleware Classes: ApiError, Client, Configuration

Constant Summary collapse

NON_API_METHODS =
[:setup, :configuration, :default_configuration]
VERSION =
"5.0.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



20
21
22
# File 'lib/authsignal.rb', line 20

def configuration
    @configuration ||= Authsignal::Configuration.new
end

Class Method Details

.default_configurationObject



24
25
26
# File 'lib/authsignal.rb', line 24

def default_configuration
    configuration.defaults
end

.delete_authenticator(user_id:, user_authenticator_id:) ⇒ Object



58
59
60
61
62
# File 'lib/authsignal.rb', line 58

def delete_authenticator(user_id:, user_authenticator_id:)
    response = Client.new.delete_authenticator(user_id: user_id, user_authenticator_id: user_authenticator_id)

    handle_response(response)
end

.delete_user(user_id:) ⇒ Object



40
41
42
43
44
# File 'lib/authsignal.rb', line 40

def delete_user(user_id:)
    response = Client.new.delete_user(user_id: user_id)

    handle_response(response)
end

.enroll_verified_authenticator(user_id:, attributes:) ⇒ Object



52
53
54
55
56
# File 'lib/authsignal.rb', line 52

def enroll_verified_authenticator(user_id:, attributes:)
    response = Client.new.enroll_verified_authenticator(user_id: user_id, attributes: attributes)

    handle_response(response)
end

.get_action(user_id:, action:, idempotency_key:) ⇒ Object



75
76
77
78
79
# File 'lib/authsignal.rb', line 75

def get_action(user_id:, action:, idempotency_key:)
    response = Client.new.get_action(user_id: user_id, action: action, idempotency_key: idempotency_key)

    handle_response(response)
end

.get_authenticators(user_id:) ⇒ Object



46
47
48
49
50
# File 'lib/authsignal.rb', line 46

def get_authenticators(user_id:)
    response = Client.new.get_authenticators(user_id: user_id)

    handle_response(response)
end

.get_user(user_id:) ⇒ Object



28
29
30
31
32
# File 'lib/authsignal.rb', line 28

def get_user(user_id:)
    response = Client.new.get_user(user_id: user_id)

    handle_response(response)
end

.setup {|configuration| ... } ⇒ Object

Yields:



16
17
18
# File 'lib/authsignal.rb', line 16

def setup
    yield(configuration)
end

.track(user_id:, action:, attributes:) ⇒ Object



64
65
66
67
# File 'lib/authsignal.rb', line 64

def track(user_id:, action:, attributes:)
    response = Client.new.track(user_id: user_id, action: action, attributes: attributes)
    handle_response(response)
end

.update_action(user_id:, action:, idempotency_key:, attributes:) ⇒ Object



81
82
83
84
85
# File 'lib/authsignal.rb', line 81

def update_action(user_id:, action:, idempotency_key:, attributes:)
    response = Client.new.update_action(user_id: user_id, action: action, idempotency_key: idempotency_key, attributes: attributes)

    handle_response(response)
end

.update_user(user_id:, attributes:) ⇒ Object



34
35
36
37
38
# File 'lib/authsignal.rb', line 34

def update_user(user_id:, attributes:)
    response = Client.new.update_user(user_id: user_id, attributes: attributes)

    handle_response(response)
end

.validate_challenge(token:, user_id: nil, action: nil) ⇒ Object



69
70
71
72
73
# File 'lib/authsignal.rb', line 69

def validate_challenge(token:, user_id: nil, action: nil)
    response = Client.new.validate_challenge(token: token,user_id: user_id, action: action)
    
    handle_response(response)
end