Added checking for cookie expiry and ruby example to generate cookie