Skip to content

Instantly share code, notes, and snippets.

@ascruggs
Created September 24, 2009 20:57
Show Gist options
  • Save ascruggs/193046 to your computer and use it in GitHub Desktop.
Save ascruggs/193046 to your computer and use it in GitHub Desktop.
def execute(connection)
response = connection.request(method, request_hash)
parse_response(response["result"])
rescue Ymail::YmailApi::YmailJsonClient::MailboxBusy, Ymail::YmailApi::YmailJsonClient::RequestTooLarge => e
execute_each(connection)
end
def execute_each(connection)
response_hash = {}
@requests.each do |request|
batch_of_one = Ymail::YmailApi::Requests::BatchExecute.new([request])
response_of_one = batch_of_one.execute(connection)
response_of_one.keys.each do |key|
response_hash[key] ||= {}
response_hash[key].merge!(response_of_one[response_of_one])
end
end
response_hash
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment