class ActiveFedora::Fedora
def authorized_connection
def authorized_connection connection = Faraday.new(host) connection.basic_auth(user, password) connection end
def base_path
def base_path @config[:base_path] || '/' end
def clean_connection
def clean_connection @clean_connection ||= CleanConnection.new(connection) end
def connection
def connection @connection ||= CachingConnection.new(authorized_connection) end
def host
def host @config[:url] end
def init_base_path
def init_base_path connection.head(root_resource_path) ActiveFedora::Base.logger.info "Attempted to init base path `#{root_resource_path}`, but it already exists" if ActiveFedora::Base.logger false rescue Ldp::NotFound if !host.downcase.end_with?("/rest") ActiveFedora::Base.logger.warn "Fedora URL (#{host}) does not end with /rest. This could be a problem. Check your fedora.yml config" end connection.put(root_resource_path, BLANK).success? end
def initialize(config)
def initialize(config) @config = config init_base_path end
def ldp_resource_service
def ldp_resource_service @service ||= LdpResourceService.new(connection) end
def password
def password @config[:password] end
def root_resource_path
def root_resource_path @root_resource_path ||= base_path.sub(SLASH, BLANK) end
def user
def user @config[:user] end