module Backends::Helpers::JsonCollectionHelper

Public Instance Methods

read_from_json(path) click to toggle source
# File lib/backends/helpers/json_collection_helper.rb, line 4
def read_from_json(path)
  collection = Occi::Collection.new
  collection.model = nil

  # Load all JSON files in the given directory, these contain
  # JSON rendering of OCCI kind/mixin/action definitions
  @logger.debug "[#{self.class}] Getting fixtures from #{path}"
  parsed = JSON.parse(File.read(path))
  collection.merge! Occi::Collection.new(parsed)

  collection
end