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

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

Instance Attribute Summary collapse

Attributes inherited from DSL::RunContext

#class_name, #event_signature, #logger, #proxy, #run_id

Instance Method Summary collapse

Methods inherited from DSL::RunContext

#after_fork, #cleanup, #method_missing, #register_cleanup

Methods included from Cron::DSL

#cron

Methods included from DSL::File

#getfullpath

Methods included from DSL::Cache

#cache_get, #cache_set

Methods included from DSL::Graphite

#graphite, #graphite_get_latests

Methods included from DSL::RabbitMQ

#amqp

Methods included from DSL::Mongo

#mongo

Methods included from DSL::Psql

#psql

Methods included from DSL::MySQL

#mysql

Methods included from DSL::Orbit

#orbit

Methods included from DSL::Etcd

#etcd, #locked?, #ttl_lock, #unlock

Methods included from DSL::Fog

#autoscaling, #aws, #find_server_by_id, #find_server_by_ip, #find_servers_in_autoscaling_groups, #get_servers_in_autoscaling_group

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

Returns a new instance of WebRunContext.



72
73
74
75
# File 'lib/ocular/inputs/http_input.rb', line 72

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.



68
69
70
# File 'lib/ocular/inputs/http_input.rb', line 68

def env
  @env
end

#paramsObject

Returns the value of attribute params.



68
69
70
# File 'lib/ocular/inputs/http_input.rb', line 68

def params
  @params
end

#requestObject

Returns the value of attribute request.



68
69
70
# File 'lib/ocular/inputs/http_input.rb', line 68

def request
  @request
end

#responseObject

Returns the value of attribute response.



68
69
70
# File 'lib/ocular/inputs/http_input.rb', line 68

def response
  @response
end

Instance Method Details

#content_type(type) ⇒ Object



77
78
79
# File 'lib/ocular/inputs/http_input.rb', line 77

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

#exec_wrapper(res) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/ocular/inputs/http_input.rb', line 81

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

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

    return res
end