Class: Chimp::ChimpDaemon::GenericServlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Chimp::ChimpDaemon::GenericServlet
- Defined in:
- lib/right_chimp/daemon/chimp_daemon.rb
Overview
GenericServlet – servlet superclass
Direct Known Subclasses
Instance Method Summary collapse
- #get_id(req) ⇒ Object
- #get_job_uuid(req) ⇒ Object
-
#get_payload(req) ⇒ Object
Get the body of the request– assume YAML.
-
#get_verb(req) ⇒ Object
get_verb get_id get_payload.
Instance Method Details
#get_id(req) ⇒ Object
286 287 288 289 290 |
# File 'lib/right_chimp/daemon/chimp_daemon.rb', line 286 def get_id(req) uri_parts = req.request_uri.path.split('/') id = uri_parts[-2] return id end |
#get_job_uuid(req) ⇒ Object
292 293 294 295 296 |
# File 'lib/right_chimp/daemon/chimp_daemon.rb', line 292 def get_job_uuid(req) string = req.body.scan(/job_uuid: .{6}/).last job_uuid = string.scan(/ (.{6})/).last.last return job_uuid end |
#get_payload(req) ⇒ Object
Get the body of the request– assume YAML
300 301 302 303 304 305 306 |
# File 'lib/right_chimp/daemon/chimp_daemon.rb', line 300 def get_payload(req) begin return YAML::load(req.body) rescue StandardError => ex return nil end end |
#get_verb(req) ⇒ Object
get_verb get_id get_payload
282 283 284 |
# File 'lib/right_chimp/daemon/chimp_daemon.rb', line 282 def get_verb(req) r = req.request_uri.path.split('/')[2] end |