Class: Chimp::ChimpDaemon::GenericServlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Chimp::ChimpDaemon::GenericServlet
- Defined in:
- lib/right_chimp/daemon/ChimpDaemon.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
277 278 279 280 281 |
# File 'lib/right_chimp/daemon/ChimpDaemon.rb', line 277 def get_id(req) uri_parts = req.request_uri.path.split('/') id = uri_parts[-2] return id end |
#get_job_uuid(req) ⇒ Object
283 284 285 286 287 |
# File 'lib/right_chimp/daemon/ChimpDaemon.rb', line 283 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
291 292 293 294 295 296 297 |
# File 'lib/right_chimp/daemon/ChimpDaemon.rb', line 291 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
273 274 275 |
# File 'lib/right_chimp/daemon/ChimpDaemon.rb', line 273 def get_verb(req) r = req.request_uri.path.split('/')[2] end |