lib/hollow/application.rb
def handle_request(resource: nil, method: nil, data: {})
      begin
        resource_class = Application::get_resource(resource.to_sym)
        handler = resource_class.instance
        method = method.to_sym.downcase
      rescue NoMethodError, NameError
        fail ResourceException.new resource
      end

      if @settings[:resource_methods].include?(method) &&
          handler.respond_to?(method)
        invoke_chain(resource_class, data, :before, method)
        response = handler.public_send(method, data)
        invoke_chain(resource_class, data, :after, method)
        return response
      else
        fail ResourceMethodException.new resource, method
      end
    end
# Attempt to invoke a resource method with the given data.
#
# @param [String, Symbol] resource
#   The case-sensitive name of a desired resource.
# @param [String, Symbol] method
#   The case-sensitive resource method name to invoke.
# @param [Hash] data
#   Any data which the resource may or may not use to handle the reqeust.
# @raise [ResourceException]
#   If the indicated resource is not defined, is not a Class, is
#   {Hollow::Resource} itself, or is not a type of {Hollow::Resource}.
# @raise [ResourceMethodException]
#   If the indicated resource exists and:
#     1. The indicated method is not accessible or defined, or
#     2. The method name is not included in `settings[:resource_methods]`.
Attempt to invoke a resource method with the given data.
Attempt to invoke a resource method with the given data .
def handle_request(resource: nil, method: nil, data: {})
      begin
        resource_class = Application::get_resource(resource.to_sym)
        handler = resource_class.instance
        method = method.to_sym.downcase
      rescue NoMethodError, NameError
        fail ResourceException.new resource
      end
      if @settings[:resource_methods].include?(method) &&
          handler.respond_to?(method)
        invoke_chain(resource_class, data, :before, method)
        response = handler.public_send(method, data)
        invoke_chain(resource_class, data, :after, method)
        return response
      else
        fail ResourceMethodException.new resource, method
      end
    end
def handle_request ( resource : nil , method : nil , data : { } ) begin resource_class = Application :: get_resource ( resource . to_sym ) handler = resource_class . instance method = method . to_sym . downcase rescue NoMethodError , NameError fail ResourceException . new resource end if @settings [ :resource_methods ] . include? ( method ) && handler . respond_to? ( method ) invoke_chain ( resource_class , data , :before , method ) response = handler . public_send ( method , data ) invoke_chain ( resource_class , data , :after , method ) return response else fail ResourceMethodException . new resource , method end end
Attempt to invoke a resource method with the given data.
Attempt to invoke a resource method with the given data .
[ResourceException] If the indicated resource is not defined, is not a Class, is {Hollow::Resource} itself, or is not a type of {Hollow::Resource}.
[ ResourceException ] If the indicated resource is not defined is not a Class is { Hollow :: Resource } itself or is not a type of { Hollow :: Resource } .
[ResourceMethodException] If the indicated resource exists and: 1. The indicated method is not accessible or defined, or 2. The method name is not included in `settings[:resource_methods]`.
[ ResourceMethodException ] If the indicated resource exists and : 1 . The indicated method is not accessible or defined or 2 . The method name is not included in ` settings [ : resource_methods ] ` .
resource
method
data
data Any data which the resource may or may not use to handle the reqeust.
data Any data which the resource may or may not use to handle the reqeust .