docs: add remaining docs for classes in app/logical.

This commit is contained in:
evazion
2021-06-23 20:32:59 -05:00
parent c6855261fe
commit 00ca7526bb
47 changed files with 705 additions and 25 deletions

View File

@@ -1,14 +1,25 @@
# A wrapper for the Amazon SQS API. Used by the PostArchive and PoolArchive
# service to record post and pool versions.
#
# @see https://docs.aws.amazon.com/sqs/index.html
# @see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SQS/Client.html
class SqsService
attr_reader :url
# @param url [String] the URL of the Amazon SQS queue
def initialize(url)
@url = url
end
# @return [Boolean] true if the SQS service is configured
def enabled?
Danbooru.config.aws_credentials.set? && url.present?
end
# Sends a message to the Amazon SQS queue.
# @param string [String] the message to send
# @param options [Hash] extra options for the SQS call
# @see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SQS/Client.html#send_message-instance_method
def send_message(string, options = {})
return unless enabled?
@@ -22,6 +33,7 @@ class SqsService
private
# @return [Aws::SQS::Client] the SQS API client object
def sqs
@sqs ||= Aws::SQS::Client.new(
credentials: Danbooru.config.aws_credentials,