the-rocci-project/rOCCI-core

View on GitHub
examples/parse_instance_json.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'occi/infrastructure'

Yell.new '/dev/null', name: Object

model = Occi::Infrastructure::Model.new
model.load_core!
model.load_infrastructure!

model.valid!

parser = Occi::Core::Parsers::JsonParser.new(model: model, media_type: 'application/occi+json')
cf = File.read File.join(File.dirname(__FILE__), 'rendering', 'instance.json')

compute = parser.entities(cf, {}).first
compute.valid!