Class: OpenSandbox::SandboxStatus

Inherits:
Data
  • Object
show all
Defined in:
lib/open_sandbox/models.rb

Overview

Value object for sandbox status

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_transition_atObject (readonly)

Returns the value of attribute last_transition_at

Returns:

  • (Object)

    the current value of last_transition_at



18
19
20
# File 'lib/open_sandbox/models.rb', line 18

def last_transition_at
  @last_transition_at
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



18
19
20
# File 'lib/open_sandbox/models.rb', line 18

def message
  @message
end

#reasonObject (readonly)

Returns the value of attribute reason

Returns:

  • (Object)

    the current value of reason



18
19
20
# File 'lib/open_sandbox/models.rb', line 18

def reason
  @reason
end

#stateObject (readonly)

Returns the value of attribute state

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Boolean)


22
# File 'lib/open_sandbox/models.rb', line 22

def failed?    = state == SandboxState::FAILED

#paused?Boolean

Returns:

  • (Boolean)


21
# File 'lib/open_sandbox/models.rb', line 21

def paused?    = state == SandboxState::PAUSED

#pending?Boolean

Returns:

  • (Boolean)


20
# File 'lib/open_sandbox/models.rb', line 20

def pending?   = state == SandboxState::PENDING

#running?Boolean

Returns:

  • (Boolean)


19
# File 'lib/open_sandbox/models.rb', line 19

def running?   = state == SandboxState::RUNNING

#terminated?Boolean

Returns:

  • (Boolean)


23
# File 'lib/open_sandbox/models.rb', line 23

def terminated? = state == SandboxState::TERMINATED