Class: FakeSNS::Actions::Publish
Instance Attribute Summary
#db, #params
Instance Method Summary
collapse
#initialize, param
Instance Method Details
#call ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/fake_sns/actions/publish.rb', line 11
def call
if (bytes = message.bytesize) > 262144
raise InvalidParameterValue, "Too much bytes: #{bytes} > 262144."
end
@topic = db.topics.fetch(topic_arn) do
raise InvalidParameterValue, "Unknown topic: #{topic_arn}"
end
@message_id = SecureRandom.uuid
db.messages.create(
id: message_id,
subject: subject,
message: message,
topic_arn: topic_arn,
structure: message_structure,
target_arn: target_arn,
received_at: Time.now,
)
end
|
#message_id ⇒ Object
31
32
33
|
# File 'lib/fake_sns/actions/publish.rb', line 31
def message_id
@message_id || raise(InternalFailure, "no message id yet, this should not happen")
end
|