[imap] configurable content-type selection for multipart messages

User can now select which content-type in multipart messages should be
used as the event message.  Default behavior for multipart messages is
still to select first part with text/plain content-type.
[oldlogstashjson] add tests before making changes
[oldlogstashjson] encode to json instead of ruby hash (LOGSTASH-1626)
[oldlogstashjson] fix test assertions

Still do not fully grok the insist blocks or rspec testing,
but at least we're really making assertions now.
[oldlogstashjson] less convoluted not nil assertions
[oldlogstashjson] simplify decoding from v0 to v1
[oldlogstashjson] simplify encoding from v1 to v0
[oldlogstashjson] implement encoding of @fields
[oldlogstashjson] exclude @version from @fields during encode
[oldlogstashjson] append newline to encoded json