the-rocci-project/rOCCI-core

View on GitHub
examples/parse_categories_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', 'categories.json')

cats = parser.categories(cf, {})
cats.each(&:valid!)