Module: Simple::Httpd::ServiceAdapter

Included in:
BaseController
Defined in:
lib/simple/httpd/service_adapter.rb

Defined Under Namespace

Modules: Helpers

Instance Method Summary collapse

Instance Method Details

#delete(path, opts = {}, &block) ⇒ Object



33
34
35
# File 'lib/simple/httpd/service_adapter.rb', line 33

def delete(path, opts = {}, &block)
  install_route("DELETE", path, opts, &block)
end

#get(path, opts = {}, &block) ⇒ Object



21
22
23
# File 'lib/simple/httpd/service_adapter.rb', line 21

def get(path, opts = {}, &block)
  install_route("GET", path, opts, &block)
end

#head(path, opts = {}, &block) ⇒ Object



37
38
39
# File 'lib/simple/httpd/service_adapter.rb', line 37

def head(path, opts = {}, &block)
  install_route("HEAD", path, opts, &block)
end

#mount_service(service) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/simple/httpd/service_adapter.rb', line 4

def mount_service(service)
  @service = service

  instance_eval do
    def dispatch!
      ::Simple::Service.with_context(context)
      super
    ensure
      ::Simple::Service.context = nil
    end

    yield(service)
  end
ensure
  @service = nil
end

#post(path, opts = {}, &block) ⇒ Object



25
26
27
# File 'lib/simple/httpd/service_adapter.rb', line 25

def post(path, opts = {}, &block)
  install_route("POST", path, opts, &block)
end

#put(path, opts = {}, &block) ⇒ Object



29
30
31
# File 'lib/simple/httpd/service_adapter.rb', line 29

def put(path, opts = {}, &block)
  install_route("PUT", path, opts, &block)
end