Method: Code0::License.load

Defined in:
lib/code0/license.rb

.load(data) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/code0/license.rb', line 24

def load(data)
  raise ValidationError, "No data" if data.nil?

  data = Boundary.remove_boundary(data)

  decrypted_license = encryptor.decrypt(data)

  new(JSON.parse(decrypted_license))
rescue JSON::ParserError
  raise ValidationError, "License data is invalid JSON"
end