Add Mastodon API service class, auth token config

Add a new REST API service class to keep things DRY
This commit is contained in:
2025-05-17 14:17:57 +04:00
parent c43e43d89c
commit f0cfde560b
6 changed files with 68 additions and 15 deletions

View File

@@ -0,0 +1,22 @@
#
# API Docs: https://docs.joinmastodon.org/methods/
#
class MastodonManagerService < RestApiService
private
def base_url
@base_url ||= "#{Setting.mastodon_public_url}/api"
end
def auth_token
@auth_token ||= Setting.mastodon_auth_token
end
def headers
{
"Content-Type" => "application/json",
"Accept" => "application/json",
"Authorization" => "Bearer #{auth_token}"
}
end
end