class WinewooCore::UseCases::BaseUseCase

Attributes

authorizer[RW]
current_caller[RW]
log_params[RW]
log_repo[RW]
repo[RW]

Public Class Methods

new(repository, log_params=nil) click to toggle source
# File lib/winewoo_core/use_cases/base_use_case.rb, line 4
def initialize(repository, log_params=nil)
  @repo = repository
  @log_repo = WinewooCore::Repositories::Mongo::WinewooUserLogsMongoRepo.new
  @log_params = log_params
  @authorizer = WinewooCore.authorizer.new
end

Protected Instance Methods

authorization_params_for(resource_type, action, resource=nil) click to toggle source
# File lib/winewoo_core/use_cases/base_use_case.rb, line 21
def authorization_params_for(resource_type, action, resource=nil)
  WinewooCore::Services::Authorizers::AuthorizationParams.new.tap do |auth|
    auth.caller = self.current_caller
    auth.resource = resource
    auth.resource_type = resource_type
    auth.action = action
  end
end