Class: Ocular::Inputs::HTTP::Input::WebRunContext

Inherits:
DSL::RunContext show all
Defined in:
lib/ocular/inputs/http_input.rb

Instance Attribute Summary collapse

Attributes inherited from DSL::RunContext

#class_name, #event_signature, #proxy, #run_id

Instance Method Summary collapse

Methods inherited from DSL::RunContext

#cleanup, #method_missing, #register_cleanup

Methods included from Cron::DSL

#cron

Methods included from DSL::Orbit

#orbit

Methods included from DSL::Etcd

#etcd

Methods included from DSL::Fog

#autoscaling, #aws, #find_server_by_ip, #find_servers_in_autoscaling_groups

Methods included from DSL::SSH

#ssh_to

Methods included from DSL::Logging

#debug, #error, #fatal, #info, #log_cause, #log_event, #log_timing, #warn

Constructor Details

#initializeWebRunContext



45
46
47
48
# File 'lib/ocular/inputs/http_input.rb', line 45

def initialize()
    super(Ocular::Logging::ConsoleLogger.new) 
    @headers = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ocular::DSL::RunContext

Instance Attribute Details

#envObject

Returns the value of attribute env.



43
44
45
# File 'lib/ocular/inputs/http_input.rb', line 43

def env
  @env
end

#paramsObject

Returns the value of attribute params.



43
44
45
# File 'lib/ocular/inputs/http_input.rb', line 43

def params
  @params
end

#requestObject

Returns the value of attribute request.



43
44
45
# File 'lib/ocular/inputs/http_input.rb', line 43

def request
  @request
end

#responseObject

Returns the value of attribute response.



43
44
45
# File 'lib/ocular/inputs/http_input.rb', line 43

def response
  @response
end

Instance Method Details

#content_type(type) ⇒ Object



50
51
52
# File 'lib/ocular/inputs/http_input.rb', line 50

def content_type(type)
    @headers["Content-Type"] = type
end

#exec_wrapper(res) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ocular/inputs/http_input.rb', line 54

def exec_wrapper(res)
    if Fixnum === res
        res = [res, @headers, nil]
    end

    if String === res
        res = [200, @headers, res]
    end

    return res
end