module UPS::Utils

Public Class Methods

base64_to_file(contents, extension) click to toggle source
# File lib/ups/utils.rb, line 3
def self.base64_to_file(contents, extension)
  file_config = ['ups', extension]
  Tempfile.new(file_config, nil, encoding: 'ascii-8bit').tap do |file|
    begin
      file.write Base64.decode64(contents)
    ensure
      file.rewind
    end
  end
end