Class: Appwrite::Auth

Inherits:
Service show all
Defined in:
lib/appwrite/services/auth.rb

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from Appwrite::Service

Instance Method Details

#confirm(user_id:, token:) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/appwrite/services/auth.rb', line 101

def confirm(user_id:, token:)
    path = '/auth/register/confirm'

    params = {
        'userId': user_id, 
        'token': token
    }

    return @client.call('post', path, {
        'content-type' => 'application/json',
    }, params);
end

#confirm_resend(confirm:) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
# File 'lib/appwrite/services/auth.rb', line 114

def confirm_resend(confirm:)
    path = '/auth/register/confirm/resend'

    params = {
        'confirm': confirm
    }

    return @client.call('post', path, {
        'content-type' => 'application/json',
    }, params);
end

#login(email:, password:, success: '', failure: '') ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/appwrite/services/auth.rb', line 4

def (email:, password:, success: '', failure: '')
    path = '/auth/login'

    params = {
        'email': email, 
        'password': password, 
        'success': success, 
        'failure': failure
    }

    return @client.call('post', path, {
        'content-type' => 'application/json',
    }, params);
end

#logoutObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/appwrite/services/auth.rb', line 19

def logout()
    path = '/auth/logout'

    params = {
    }

    return @client.call('delete', path, {
        'content-type' => 'application/json',
    }, params);
end

#logout_by_session(id:) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/appwrite/services/auth.rb', line 30

def logout_by_session(id:)
    path = '/auth/logout/{id}'
        .gsub('{id}', id)

    params = {
    }

    return @client.call('delete', path, {
        'content-type' => 'application/json',
    }, params);
end

#oauth(provider:, success:, failure:) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/appwrite/services/auth.rb', line 42

def oauth(provider:, success:, failure:)
    path = '/auth/oauth/{provider}'
        .gsub('{provider}', provider)

    params = {
        'success': success, 
        'failure': failure
    }

    return @client.call('get', path, {
        'content-type' => 'application/json',
    }, params);
end

#recovery(email:, reset:) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/appwrite/services/auth.rb', line 56

def recovery(email:, reset:)
    path = '/auth/recovery'

    params = {
        'email': email, 
        'reset': reset
    }

    return @client.call('post', path, {
        'content-type' => 'application/json',
    }, params);
end

#recovery_reset(user_id:, token:, password_a:, password_b:) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/appwrite/services/auth.rb', line 69

def recovery_reset(user_id:, token:, password_a:, password_b:)
    path = '/auth/recovery/reset'

    params = {
        'userId': user_id, 
        'token': token, 
        'password-a': password_a, 
        'password-b': password_b
    }

    return @client.call('put', path, {
        'content-type' => 'application/json',
    }, params);
end

#register(email:, password:, confirm:, success: '', failure: '', name: '') ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/appwrite/services/auth.rb', line 84

def register(email:, password:, confirm:, success: '', failure: '', name: '')
    path = '/auth/register'

    params = {
        'email': email, 
        'password': password, 
        'confirm': confirm, 
        'success': success, 
        'failure': failure, 
        'name': name
    }

    return @client.call('post', path, {
        'content-type' => 'application/json',
    }, params);
end