From 6d5fe4371f27f28b90c449c945d523a43e476062 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sat, 4 Feb 2023 14:24:23 +1100 Subject: [PATCH] log photos --- lib/adamantium/syndication/mastodon.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/adamantium/syndication/mastodon.rb b/lib/adamantium/syndication/mastodon.rb index d69f080..6e5f92b 100644 --- a/lib/adamantium/syndication/mastodon.rb +++ b/lib/adamantium/syndication/mastodon.rb @@ -28,7 +28,7 @@ module Adamantium key = Digest::MD5.hexdigest text_with_tags mastodon_token = settings.mastodon_token mastodon_server = settings.mastodon_server.split("@").first - logger.info(post[:photo]) + logger.info("Photos: #{post[:photo].inspect}") media_ids = post[:photo]&.map do |photo| file = Tempfile.new(SecureRandom.uuid) file.write(URI.open(photo["value"]).read) @@ -44,13 +44,13 @@ module Adamantium }) file.close file.unlink - puts "*" * 88 - puts response.inspect + logger.info(response.body) - puts "*" * 88 - JSON.parse(response.body).fetch(:id, nil) + JSON.parse(response.body, symbolize_names: true).fetch(:id, nil) end&.compact + raise media_ids.inspect + response = HTTParty.post("#{mastodon_server}api/v1/statuses", { headers: { "Idempotency-Key": key,