Sha256: fe9df8955875239325262f0b1d46a477a09b4da5ff337a1b4bf2dec58f898943
Contents?: true
Size: 965 Bytes
Versions: 6
Compression:
Stored size: 965 Bytes
Contents
require 'base64' # Wraps an individual (file) attachment as part of a Mandrill event payload. # # Each attachment is described in the raw Mandrill payload as a hash with three elements: # 'name' => the filename # 'type' => the content mime type # 'content' => the raw content, which will be base64-encoded if not plain text # class Mandrill::WebHook::Attachment < Hash # Returns the attachment name def name self['name'] end # Returns the attachment mime type def type self['type'] end # Returns the raw attachment content, which may be base64 encoded def content self['content'] end # Returns a boolean for whether the attachment content is base64 encoded def base64 self['base64'] end # Returns the decoded content for the attachment def decoded_content if base64 Base64.decode64(content) else content end rescue # any decoding error, just return the content content end end
Version data entries
6 entries across 6 versions & 1 rubygems