diff --git a/lib/postman/attachment.rb b/lib/postman/attachment.rb new file mode 100644 index 0000000..7226dc2 --- /dev/null +++ b/lib/postman/attachment.rb @@ -0,0 +1,31 @@ +require 'base64' + +module Postman + class Attachment + + def initialize(attributes) + @attributes = attributes + end + + def filename + @attributes['filename'] + end + + def content_type + @attributes['content_type'] + end + + def size + @attributes['size'] + end + + def hash + @attributes['hash'] + end + + def data + @data ||= Base64.decode64(@attributes['data']) + end + + end +end