Class: OpenSandbox::Sandbox

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

Overview

Value object for a Sandbox resource

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



37
38
39
# File 'lib/open_sandbox/models.rb', line 37

def created_at
  @created_at
end

#entrypointObject (readonly)

Returns the value of attribute entrypoint

Returns:

  • (Object)

    the current value of entrypoint



37
38
39
# File 'lib/open_sandbox/models.rb', line 37

def entrypoint
  @entrypoint
end

#expires_atObject (readonly)

Returns the value of attribute expires_at

Returns:

  • (Object)

    the current value of expires_at



37
38
39
# File 'lib/open_sandbox/models.rb', line 37

def expires_at
  @expires_at
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



37
38
39
# File 'lib/open_sandbox/models.rb', line 37

def id
  @id
end

#image_uriObject (readonly)

Returns the value of attribute image_uri

Returns:

  • (Object)

    the current value of image_uri



37
38
39
# File 'lib/open_sandbox/models.rb', line 37

def image_uri
  @image_uri
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



37
38
39
# File 'lib/open_sandbox/models.rb', line 37

def 
  @metadata
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



37
38
39
# File 'lib/open_sandbox/models.rb', line 37

def status
  @status
end

Class Method Details

.from_hash(h) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/open_sandbox/models.rb', line 38

def self.from_hash(h)
  new(
    id:         h["id"],
    status:     SandboxStatus.from_hash(h["status"]),
    image_uri:  h.dig("image", "uri"),
    entrypoint: h["entrypoint"] || [],
    metadata:   h["metadata"] || {},
    expires_at: h["expiresAt"] ? Time.parse(h["expiresAt"]) : nil,
    created_at: h["createdAt"] ? Time.parse(h["createdAt"]) : nil
  )
end