class RubyIsds::Responses::Messages::Attachment
Attributes
decoded_content[RW]
encoded_content[RW]
file_name[RW]
file_type[RW]
Public Class Methods
new(hash)
click to toggle source
# File lib/ruby_isds/responses/messages/attachment.rb, line 7 def initialize(hash) @file_type = hash['dmMimeType'] @file_name = hash['dmFileDescr'] @encoded_content = hash['dmEncodedContent'] @decoded_content = Base64.decode64(@encoded_content) end
Public Instance Methods
download(destination = '/tmp')
click to toggle source
# File lib/ruby_isds/responses/messages/attachment.rb, line 14 def download(destination = '/tmp') file_destination = "#{destination}/#{@file_name}" File.open(file_destination, 'wb') do |f| f.write(@decoded_content) end file_destination end