Class: NewsmastMastodon::AuthenticateUserService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/newsmast_mastodon/authenticate_user_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url, email, password) ⇒ AuthenticateUserService

Returns a new instance of AuthenticateUserService.



9
10
11
12
13
14
# File 'app/services/newsmast_mastodon/authenticate_user_service.rb', line 9

def initialize(base_url, email, password)
  @base_url = base_url
  @email = email
  @password = password
  @endpoint = '/oauth/token'
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
# File 'app/services/newsmast_mastodon/authenticate_user_service.rb', line 16

def call
  validate_oauth_credentials!
  response = perform_request
  parse_response(response)
rescue StandardError => e
  Rails.logger.error "[AuthenticateUserService] Error: #{e.class} - #{e.message}"
  raise e
end