Before this patch, I was getting the following error each time mail_room received a message and tried to use the postbackto ActionMailbox.
(NoMethodError) connection.basic_auth(
```
#, @formatter=nil, @logdev=nil>>
# terminated with exception (report_on_exception is true):
/home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/delivery/postback.rb:52:in `deliver': undefined method `basic_auth' for #"Faraday v2.7.4"}, @params={}, @options=#, @ssl=#, @default_parallel_manager=nil, @manual_proxy=false, @builder=#, @url_prefix=#, @proxy=nil> (NoMethodError)
connection.basic_auth(
^^^^^^^^^^^
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/mailbox.rb:109:in `deliver'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/mailbox_watcher.rb:30:in `block in run'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/connection.rb:141:in `map'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/connection.rb:141:in `process_mailbox'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/connection.rb:51:in `wait'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/mailbox_watcher.rb:35:in `block in run'
bundler: failed to load command: mail_room (/home/app/webapp/gems/ruby/3.1.0/bin/mail_room)
/home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/delivery/postback.rb:52:in `deliver': undefined method `basic_auth' for #"Faraday v2.7.4"}, @params={}, @options=#, @ssl=#, @default_parallel_manager=nil, @manual_proxy=false, @builder=#, @url_prefix=#, @proxy=nil> (NoMethodError)
connection.basic_auth(
^^^^^^^^^^^
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/mailbox.rb:109:in `deliver'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/mailbox_watcher.rb:30:in `block in run'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/connection.rb:141:in `map'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/connection.rb:141:in `process_mailbox'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/connection.rb:51:in `wait'
from /home/app/webapp/gems/ruby/3.1.0/gems/mail_room-0.10.0/lib/mail_room/mailbox_watcher.rb:35:in `block in run'
```
Before this patch, I was getting the following error each time mail_room received a message and tried to use the
postback
toActionMailbox
.(NoMethodError) connection.basic_auth(
``` #According to: https://lostisland.github.io/faraday/middleware/authentication
Faraday 2.x+ no longer support the:
connection.basic_auth
function.This patch just tests if
connection.basic_auth
is defined (1.x) and if so calls it, otherwise must be the 2.x version of the API.