Class: SystemControllerBase
- Inherits:
-
ApplicationControllerBase
- Object
- ActionController::Base
- ApplicationControllerBase
- SystemControllerBase
- Includes:
- ActionView::Helpers::DateHelper
- Defined in:
- lib/mrpin/controllers/system_controller_base.rb
Instance Method Summary collapse
- #cleanup_data ⇒ Object
- #download ⇒ Object
- #gc_stat ⇒ Object
- #generate_client_json ⇒ Object
- #info ⇒ Object
-
#initialize ⇒ SystemControllerBase
constructor
A new instance of SystemControllerBase.
- #invalidate_cache ⇒ Object
- #send_notifications ⇒ Object
Constructor Details
#initialize ⇒ SystemControllerBase
Returns a new instance of SystemControllerBase.
85 86 87 |
# File 'lib/mrpin/controllers/system_controller_base.rb', line 85 def initialize super end |
Instance Method Details
#cleanup_data ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/mrpin/controllers/system_controller_base.rb', line 150 def cleanup_data result = nil begin result = get_response_ok(AppInfo.instance.cleanup_data) rescue Exception => e result = get_response_error(e.to_s) end render json: result end |
#download ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/mrpin/controllers/system_controller_base.rb', line 163 def download begin url = get_url_for_download(params['type']) assert(!url.nil?, "url is not specified for param #{params['type']}") redirect_to(url) rescue Exception => e result = get_response_error(e.to_s) render json: result end end |
#gc_stat ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/mrpin/controllers/system_controller_base.rb', line 68 def gc_stat result = nil begin result = get_response_ok(GC.stat) rescue Exception => e result = get_response_error(e.to_s) end render json: result end |
#generate_client_json ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/mrpin/controllers/system_controller_base.rb', line 202 def generate_client_json begin errors = AppInfo.instance.call_in_all_managers('generate_client_json') errors.map!(&:to_s) if errors.empty? result = get_response_ok else result = get_response_error(errors) end rescue Exception => e result = get_response_error(e.to_s) end render json: result end |
#info ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/mrpin/controllers/system_controller_base.rb', line 90 def info result = nil begin response = get_system_info result = get_response_ok(response) rescue Exception => e result = get_response_error(e.to_s) end render json: result end |
#invalidate_cache ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/mrpin/controllers/system_controller_base.rb', line 118 def invalidate_cache result = nil begin result = AppInfo.instance.invalidate_cache rescue Exception => e result = get_response_error(e.to_s) end render json: result end |
#send_notifications ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/mrpin/controllers/system_controller_base.rb', line 131 def send_notifications result = nil begin manager_notifications = AppInfo.instance.manager_notifications unless manager_notifications.nil? manager_notifications.send_notifications end result = get_response_ok rescue Exception => e result = get_response_error(e.to_s) end render json: result end |