Class: Bosh::Director::Models::DeploymentProblem
- Defined in:
- lib/bosh/director/models/deployment_problem.rb
Constant Summary collapse
- STATES =
%w(open closed resolved)
Instance Method Summary collapse
- #before_create ⇒ Object
- #data ⇒ Object
- #data=(raw_data) ⇒ Object
- #description ⇒ Object
- #handler ⇒ Object
- #open? ⇒ Boolean
- #resolutions ⇒ Object
- #validate ⇒ Object
Instance Method Details
#before_create ⇒ Object
19 20 21 22 |
# File 'lib/bosh/director/models/deployment_problem.rb', line 19 def before_create self.created_at ||= Time.now self.last_seen_at ||= Time.now end |
#data ⇒ Object
24 25 26 |
# File 'lib/bosh/director/models/deployment_problem.rb', line 24 def data Yajl::Parser.parse(data_json) end |
#data=(raw_data) ⇒ Object
28 29 30 |
# File 'lib/bosh/director/models/deployment_problem.rb', line 28 def data=(raw_data) self.data_json = Yajl::Encoder.encode(raw_data) end |
#description ⇒ Object
40 41 42 |
# File 'lib/bosh/director/models/deployment_problem.rb', line 40 def description handler.description end |
#handler ⇒ Object
32 33 34 |
# File 'lib/bosh/director/models/deployment_problem.rb', line 32 def handler @handler ||= Bosh::Director::ProblemHandlers::Base.create_from_model(self) end |
#open? ⇒ Boolean
44 45 46 |
# File 'lib/bosh/director/models/deployment_problem.rb', line 44 def open? state == "open" end |
#resolutions ⇒ Object
36 37 38 |
# File 'lib/bosh/director/models/deployment_problem.rb', line 36 def resolutions handler.resolutions end |
#validate ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/bosh/director/models/deployment_problem.rb', line 10 def validate validates_presence :deployment_id validates_presence :resource_id validates_presence :type validates_presence :data_json validates_presence :state validates_includes STATES, :state end |