Class: ChatgptAssistant::RegisterService
- Inherits:
-
Object
- Object
- ChatgptAssistant::RegisterService
- Defined in:
- lib/chatgpt_assistant/bots/services/register_service.rb
Overview
This class is responsible to background the register service
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(email, password, name, chat_id) ⇒ RegisterService
constructor
A new instance of RegisterService.
Constructor Details
#initialize(email, password, name, chat_id) ⇒ RegisterService
Returns a new instance of RegisterService.
6 7 8 9 10 11 12 13 |
# File 'lib/chatgpt_assistant/bots/services/register_service.rb', line 6 def initialize(email, password, name, chat_id) @name = name @email = email @password = password @chat_id = chat_id @config = Config.new @config.db_connection end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/chatgpt_assistant/bots/services/register_service.rb', line 15 def call return if user_already_exists? @user = User.new(email: @email, password: @password, telegram_id: @chat_id, name: @name) @user.save ? : rescue UserAlreadyExistsError, WrongEmailError, WrongPasswordError => e telegram_async.(e., @chat_id) end |