Class: FlexOps::Resources::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/flexops/resources/auth.rb

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ Auth

Returns a new instance of Auth.



12
13
14
# File 'lib/flexops/resources/auth.rb', line 12

def initialize(http)
  @http = http
end

Instance Method Details

#change_password(current_password:, new_password:) ⇒ Object



40
41
42
# File 'lib/flexops/resources/auth.rb', line 40

def change_password(current_password:, new_password:)
  @http.post("/api/Account/change-password", body: { currentPassword: current_password, newPassword: new_password })
end

#forgot_password(email:) ⇒ Object



44
45
46
# File 'lib/flexops/resources/auth.rb', line 44

def forgot_password(email:)
  @http.post("/api/Account/forgot-password", body: { email: email })
end

#get_profileObject



32
33
34
# File 'lib/flexops/resources/auth.rb', line 32

def get_profile
  @http.get("/api/Account/profile")
end

#login(email:, password:) ⇒ Object



16
17
18
# File 'lib/flexops/resources/auth.rb', line 16

def (email:, password:)
  @http.post("/api/Account/login", body: { email: email, password: password })
end

#logoutObject



28
29
30
# File 'lib/flexops/resources/auth.rb', line 28

def logout
  @http.post("/api/Account/logout")
end

#refresh_token(refresh_token) ⇒ Object



24
25
26
# File 'lib/flexops/resources/auth.rb', line 24

def refresh_token(refresh_token)
  @http.post("/api/Account/refresh-token", body: { refreshToken: refresh_token })
end

#register(request) ⇒ Object



20
21
22
# File 'lib/flexops/resources/auth.rb', line 20

def register(request)
  @http.post("/api/Account/register", body: request)
end

#reset_password(token:, new_password:) ⇒ Object



48
49
50
# File 'lib/flexops/resources/auth.rb', line 48

def reset_password(token:, new_password:)
  @http.post("/api/Account/reset-password", body: { token: token, newPassword: new_password })
end

#update_profile(data) ⇒ Object



36
37
38
# File 'lib/flexops/resources/auth.rb', line 36

def update_profile(data)
  @http.put("/api/Account/profile", body: data)
end

#verify_email(token:) ⇒ Object



52
53
54
# File 'lib/flexops/resources/auth.rb', line 52

def verify_email(token:)
  @http.post("/api/Account/verify-email", body: { token: token })
end