diff options
| author | anicet | 2015-06-22 22:36:23 +0200 |
|---|---|---|
| committer | anicet | 2015-06-22 22:36:23 +0200 |
| commit | 0014ee7862acdbc4d461f008b57af7f80864aa3f (patch) | |
| tree | e42f4e9b32ef3e305cd2f46d950f1768b2458e74 | |
| parent | 1ce3b1518954ef7f893d0e317f342e5ef4bb5332 (diff) | |
| download | chouette-core-0014ee7862acdbc4d461f008b57af7f80864aa3f.tar.bz2 | |
ComplianceCheck : cleaning
| -rw-r--r-- | app/models/compliance_check.rb | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/app/models/compliance_check.rb b/app/models/compliance_check.rb index 714c183d7..d3e4054a6 100644 --- a/app/models/compliance_check.rb +++ b/app/models/compliance_check.rb @@ -4,19 +4,15 @@ class ComplianceCheck def initialize( response ) @datas = response end - + def report? links["action_report"].present? end - + def report Rails.cache.fetch("#{cache_key}/action_report", expires_in: cache_expiration) do - report_path = links["action_report"] - if report_path - response = Ievkit.get(report_path) - ComplianceCheckReport.new(response) - else - nil + if report_path = links["action_report"] + ComplianceCheckReport.new Ievkit.get(report_path) end end end @@ -24,15 +20,11 @@ class ComplianceCheck def compliance_check_validation_report? links["validation_report"].present? end - + def compliance_check_validation_report Rails.cache.fetch("#{cache_key}/validation_report", expires_in: cache_expiration) do - report_path = links["validation_report"] - if report_path - response = Ievkit.get(report_path) - ComplianceCheckResult.new(response) - else - nil + if report_path = links["validation_report"] + ComplianceCheckResult.new Ievkit.get(report_path) end end end @@ -43,31 +35,24 @@ class ComplianceCheck def rule_parameter_set Rails.cache.fetch("#{cache_key}/validation_params", expires_in: cache_expiration) do - rule_parameter_set_path = links["validation_params"] - if rule_parameter_set_path + if rule_parameter_set_path = links["validation_params"] response = Ievkit.get(rule_parameter_set_path) - rule_parameter_set = RuleParameterSet.new(:name => "", :compliance_check => self).tap { |rps| rps.parameters = response.validation } - else - nil + RuleParameterSet.new(name: '', compliance_check: self).tap do |rps| + rps.parameters = response.validation + end end end end def destroy - delete_path = links["delete"] - cancel_path = links["cancel"] - - if delete_path + if delete_path = links["delete"] Ievkit.delete(delete_path) - elsif cancel_path + elsif cancel_path = links["cancel"] Ievkit.delete(cancel_path) - else - nil end end def format datas.type end - end |
