Using this gem, and testing a very basic example, the delivery.save command errors returns an error from Bronto: 107: There was an error in your soap request. Please examine the request and try again.
Other calls to the API in this example, such as contact.save and message.save were successful. The only slight difference between my test and the example in the readme, is that I pass in an object of type Bronto::Contact instead of a Bronto::List object to deliver.add_recipient. I've inspected this method and it seems it can handle a contact instead of a list.
My full test is below, followed by the actual http request dumped from Savon (operation.rb:~113). Actual values and IDs have been redacted.
>> Bronto::Base.api_key = '11111111-1111-1111-1111-111111111111'
>> contact = Bronto::Contact.new(email:'[email protected]')
=> #<Bronto::Contact:0x007fb29e32a188 @fields={}, @api_key="11111111-1111-1111-1111-111111111111", @errors=#<Bronto::Errors:0x007fb29e32a110 @messages={}>, @email="[email protected]">
>> contact.save
=> [#<Bronto::Contact:0x007fb29e32a188 @fields={}, @api_key="11111111-1111-1111-1111-111111111111", @errors=#<Bronto::Errors:0x007fb29e32a110 @messages={}>, @email="[email protected]", @id="22222222-2222-2222-2222-222222222222">]
>> message = Bronto::Message.new(name: "Test Message4")
>> message.add_content("html", "HTML Subject", "HTML Content")
>> message.add_content("text", "Text Subject", "Text Content")
>> message.save
=> #<Bronto::Message:0x007fb292f69950 @api_key="11111111-1111-1111-1111-111111111111", @errors=#<Bronto::Errors:0x007fb292f69928 @messages={}>, @name="Test Message4", @content={"html"=>#<Bronto::Message::Content:0x007fb292f62628 @type="html", @subject="HTML Subject", @content="HTML Content">, "text"=>#<Bronto::Message::Content:0x007fb292f5b2d8 @type="text", @subject="Text Subject", @content="Text Content">}, @id="33333333-3333-3333-3333-333333333333">
>> delivery = Bronto::Delivery.new(start: Time.now, type: "normal", from_name: "Test", from_email: "[email protected]")
=> #<Bronto::Delivery:0x007fb293930fd8 @api_key="11111111-1111-1111-1111-111111111111", @errors=#<Bronto::Errors:0x007fb293930fb0 @messages={}>, @start=2015-06-08 14:43:05 -0400, @type="normal", @from_name="Test", @from_email="[email protected]", @recipients=[]>
>> delivery.message_id = message.id
=> "33333333-3333-3333-3333-333333333333"
>> delivery.add_recipient(contact)
=> [{:id=>"22222222-2222-2222-2222-222222222222", :type=>"contact"}]
>> delivery.inspect
=> "#<Bronto::Delivery:0x007fb293930fd8 @api_key=\"11111111-1111-1111-1111-111111111111\", @errors=#<Bronto::Errors:0x007fb293930fb0 @messages={}>, @start=2015-06-08 14:43:05 -0400, @type=\"normal\", @from_name=\"Test\", @from_email=\"[email protected]\", @recipients=[{:id=>\"22222222-2222-2222-2222-222222222222\", :type=>\"contact\"}], @message_id=\"33333333-3333-3333-3333-333333333333\">"
>> delivery.save
Savon::SOAPFault: (soap:Client) 107: There was an error in your soap request. Please examine the request and try again.
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/response.rb:85:in `raise_soap_and_http_errors!'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/response.rb:14:in `initialize'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/operation.rb:72:in `new'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/operation.rb:72:in `create_response'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/operation.rb:58:in `call'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/client.rb:36:in `call'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bronto-0.3.1/lib/bronto/base.rb:38:in `request'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bronto-0.3.1/lib/bronto/base.rb:101:in `create'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bronto-0.3.1/lib/bronto/base.rb:191:in `create'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bronto-0.3.1/lib/bronto/base.rb:186:in `save'
from (irb):14
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/console.rb:110:in `start'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/console.rb:9:in `start'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/waterjump/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'>>
#<HTTPI::Request:0x007fb29e485118
@follow_redirect=false,
@url=#<URI::HTTPS https://api.bronto.com/v4>,
@headers={"SOAPAction"=>"\"addDeliveries\"", "Content-Type"=>"text/xml;charset=UTF-8", "Content-Length"=>"701"},
@body=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://api.bronto.com/v4\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">
<env:Header>
<tns:sessionHeader><sessionId>44444444-4444-4444-4444-444444444444</sessionId></tns:sessionHeader>
</env:Header>
<env:Body>
<tns:addDeliveries>
<deliveries>
<start>14:43:05</start>
<messageId>33333333-3333-3333-3333-333333333333</messageId>
<fromEmail>[email protected]</fromEmail>
<fromName>Test</fromName>
<recipients>
<id>22222222-2222-2222-2222-222222222222</id>
<type>contact</type>
</recipients>
</deliveries>
</tns:addDeliveries>
</env:Body>
</env:Envelope>",
@read_timeout=600
>