Class: SplitIoClient::Helpers::DecryptionHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/splitclient-rb/helpers/decryption_helper.rb

Class Method Summary collapse

Class Method Details

.get_encoded_definition(compression, data) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/splitclient-rb/helpers/decryption_helper.rb', line 10

def self.get_encoded_definition(compression, data)
  case compression
  when NO_COMPRESSION
    Base64.decode64(data)
  when GZIP_COMPRESSION
    gz = Zlib::GzipReader.new(StringIO.new(Base64.decode64(data)))
    gz.read
  when ZLIB_COMPRESSION
    Zlib::Inflate.inflate(Base64.decode64(data))
  else
    raise StandardError, 'Compression flag value is incorrect'
  end
end