lib/eco/api/session/config.rb in eco-helpers-0.6.17 vs lib/eco/api/session/config.rb in eco-helpers-0.7.1
- old
+ new
@@ -41,10 +41,14 @@
def usecases
self["usecases"] ||= Session::Config::UseCases.new(root: self)
end
+ def api_policies
+ self["api_policies"] ||= Session::Config::Policies.new(root: self)
+ end
+
# LOGGER
def log_console_level=(value)
logger.console_level= value
end
@@ -101,15 +105,10 @@
def api(logger = ::Logger.new(IO::NULL))
apis.api(logger)
end
- def policy_groups
- policy_groups = api&.policy_groups.to_a.compact
- Eco::API::Organization::PolicyGroups.new(policy_groups)
- end
-
# FILES
def working_directory=(path)
files.working_directory = path
end
@@ -128,10 +127,22 @@
# ORG
def tagtree=(file)
org["tagtree"] = file
end
+ def policy_groups
+ return @policy_groups if instance_variable_defined?(:@policy_groups)
+ pgs = api&.policy_groups.to_a
+ @policy_groups = Eco::API::Organization::PolicyGroups.new(pgs)
+ end
+
+ def schemas
+ return @schemas if instance_variable_defined?(:@schemas)
+ schs = api&.person_schemas.to_a
+ @schemas = Eco::API::Organization::PersonSchemas.new(schs)
+ end
+
# PEOPLE
def discarded_people_file=(value)
people.discarded_file = value
end
@@ -169,10 +180,15 @@
# CUSTOM USE CASES
def use_cases(&block)
usecases.add(&block)
end
+ # API POLICIES
+ def policies(&block)
+ api_policies.add(&block)
+ end
+
end
end
end
end
@@ -182,5 +198,6 @@
require_relative 'config/mailer'
require_relative 'config/s3_storage'
require_relative 'config/files'
require_relative 'config/people'
require_relative 'config/use_cases'
+require_relative 'config/policies'