Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
parterburn committed Jan 9, 2024
1 parent 253ad5a commit ad27ff3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ group :development, :test do
end

group :development do
gem 'awesome_print', '~> 1.9', '>= 1.9.2'
gem 'better_errors', '~> 2.9', '>= 2.9.1'
gem 'awesome_print'
gem 'better_errors'
gem 'binding_of_caller'
gem 'bullet'
gem 'meta_request'
Expand Down
24 changes: 12 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ GEM
awesome_print (1.9.2)
bcrypt (3.1.18)
benchmark-ips (2.9.2)
better_errors (2.9.1)
coderay (>= 1.0.0)
better_errors (2.10.1)
erubi (>= 1.0.0)
rack (>= 0.9.0)
binding_of_caller (0.8.0)
rouge (>= 1.0.0)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
builder (3.2.4)
bullet (7.0.7)
bullet (7.1.5)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
byebug (8.2.5)
Expand Down Expand Up @@ -110,7 +110,6 @@ GEM
actionpack (>= 6.0, < 7.1.0)
activesupport (>= 6.0, < 7.1.0)
railties (>= 6.0, < 7.1.0)
coderay (1.1.3)
combined_time_select (2.0.0)
rails (>= 5.0.0)
concurrent-ruby (1.2.2)
Expand All @@ -120,7 +119,7 @@ GEM
database_cleaner (1.8.4)
date (3.3.3)
dead_end (3.1.1)
debug_inspector (0.0.3)
debug_inspector (1.2.0)
delorean (2.1.0)
chronic
derailed_benchmarks (2.1.1)
Expand Down Expand Up @@ -284,7 +283,7 @@ GEM
mini_magick (4.12.0)
mini_mime (1.1.5)
mini_portile2 (2.8.2)
minitest (5.19.0)
minitest (5.20.0)
msgpack (1.6.0)
multi_json (1.15.0)
multipart-post (2.3.0)
Expand All @@ -308,7 +307,7 @@ GEM
puma (6.3.0)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.7)
rack (2.2.8)
rack-affiliates (0.4.0)
rack
rack-attack (6.6.1)
Expand Down Expand Up @@ -366,6 +365,7 @@ GEM
reverse_markdown (2.1.1)
nokogiri
rinku (2.0.6)
rouge (4.2.0)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
Expand Down Expand Up @@ -454,7 +454,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
uniform_notifier (1.13.0)
uniform_notifier (1.16.0)
warden (1.2.9)
rack (>= 2.0.9)
webmock (3.8.3)
Expand All @@ -467,7 +467,7 @@ GEM
words_counted (1.0.2)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.11)
zeitwerk (2.6.12)
zip-zip (0.3)
rubyzip (>= 1.0.0)

Expand All @@ -477,8 +477,8 @@ PLATFORMS
DEPENDENCIES
addressable
autoprefixer-rails
awesome_print (~> 1.9, >= 1.9.2)
better_errors (~> 2.9, >= 2.9.1)
awesome_print
better_errors
binding_of_caller
bullet
byebug
Expand Down
14 changes: 12 additions & 2 deletions app/lib/email_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ def collage_from_mailgun_attachments
end
resp = connection.get("/v3/#{ENV['SMTP_DOMAIN']}/events?pretty=yes&event=accepted&ascending=no&limit=1&message-id=#{@message_id}")
last_message = resp.body&.dig("items", 0)
if @user.id == 1
p "*" * 100
p "LAST MESSAGE"
p "*" * 100
end
return unless last_message.present?

message_url = URI.parse(last_message["storage"]["url"])
Expand All @@ -376,12 +381,11 @@ def collage_from_mailgun_attachments
f.response :json
f.request :authorization, :basic, 'api', ENV['MAILGUN_API_KEY']
end
message = msg_conn.get(message_url.path)
message = msg_conn.get(message_url.path); nil

if @user.id == 1
p "*" * 100
p "MESSAGE BODY"
p message.body
p "*" * 100
end
return unless message.body["recipients"].to_s.include?(@user.user_key) || message.body["from"].to_s.include?(@user.email)
Expand All @@ -392,6 +396,12 @@ def collage_from_mailgun_attachments

att["url"].gsub("://", "://api:#{ENV['MAILGUN_API_KEY']}@")
end.compact

if @user.id == 1
p "*" * 100
p "ATTACHMENT URLS"
p "*" * 100
end
return nil unless attachment_urls.any?

collage_from_urls(attachment_urls)
Expand Down

0 comments on commit ad27ff3

Please sign in to comment.