Class: OpenSandbox::SandboxStatus
- Inherits:
-
Data
- Object
- Data
- OpenSandbox::SandboxStatus
- Defined in:
- lib/open_sandbox/models.rb
Overview
Value object for sandbox status
Instance Attribute Summary collapse
-
#last_transition_at ⇒ Object
readonly
Returns the value of attribute last_transition_at.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Class Method Summary collapse
Instance Method Summary collapse
- #failed? ⇒ Boolean
- #paused? ⇒ Boolean
- #pending? ⇒ Boolean
- #running? ⇒ Boolean
- #terminated? ⇒ Boolean
Instance Attribute Details
#last_transition_at ⇒ Object (readonly)
Returns the value of attribute last_transition_at
18 19 20 |
# File 'lib/open_sandbox/models.rb', line 18 def last_transition_at @last_transition_at end |
#message ⇒ Object (readonly)
Returns the value of attribute message
18 19 20 |
# File 'lib/open_sandbox/models.rb', line 18 def @message end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason
18 19 20 |
# File 'lib/open_sandbox/models.rb', line 18 def reason @reason end |
#state ⇒ Object (readonly)
Returns the value of attribute state
18 19 20 |
# File 'lib/open_sandbox/models.rb', line 18 def state @state end |
Class Method Details
.from_hash(h) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/open_sandbox/models.rb', line 25 def self.from_hash(h) return nil unless h new( state: h["state"], reason: h["reason"], message: h["message"], last_transition_at: h["lastTransitionAt"] ? Time.parse(h["lastTransitionAt"]) : nil ) end |
Instance Method Details
#failed? ⇒ Boolean
22 |
# File 'lib/open_sandbox/models.rb', line 22 def failed? = state == SandboxState::FAILED |
#paused? ⇒ Boolean
21 |
# File 'lib/open_sandbox/models.rb', line 21 def paused? = state == SandboxState::PAUSED |
#pending? ⇒ Boolean
20 |
# File 'lib/open_sandbox/models.rb', line 20 def pending? = state == SandboxState::PENDING |
#running? ⇒ Boolean
19 |
# File 'lib/open_sandbox/models.rb', line 19 def running? = state == SandboxState::RUNNING |
#terminated? ⇒ Boolean
23 |
# File 'lib/open_sandbox/models.rb', line 23 def terminated? = state == SandboxState::TERMINATED |