Skip to content

Commit 5876faa

Browse files
committed
Add rake command to send file through MESH
Used for develeopment and debugging.
1 parent 1f4402c commit 5876faa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/tasks/mesh.rake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ namespace :mesh do
4040

4141
response = MESH.connection.put("inbox/#{message}/status/acknowledged")
4242

43+
puts response.body
44+
warn response.status unless response.status == 200
45+
end
46+
47+
desc "Send a file to a mailbox via MESH"
48+
task "send_file", %i[to file] => :environment do |_, args|
49+
to = args[:to]
50+
file = args[:file]
51+
52+
data = File.read(file)
53+
response = MESH.send_file(to:, data:)
54+
55+
puts response.body
4356
warn response.status unless response.status == 200
4457
end
4558
end

0 commit comments

Comments
 (0)