Class: Whitebox::Decision

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#confidenceObject (readonly)

Returns the value of attribute confidence

Returns:

  • (Object)

    the current value of confidence



13
14
15
# File 'lib/whitebox/models.rb', line 13

def confidence
  @confidence
end

#cost_usdObject (readonly)

Returns the value of attribute cost_usd

Returns:

  • (Object)

    the current value of cost_usd



13
14
15
# File 'lib/whitebox/models.rb', line 13

def cost_usd
  @cost_usd
end

#created_atObject (readonly)

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



13
14
15
# File 'lib/whitebox/models.rb', line 13

def created_at
  @created_at
end

#escalatedObject (readonly)

Returns the value of attribute escalated

Returns:

  • (Object)

    the current value of escalated



13
14
15
# File 'lib/whitebox/models.rb', line 13

def escalated
  @escalated
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



13
14
15
# File 'lib/whitebox/models.rb', line 13

def id
  @id
end

#latency_msObject (readonly)

Returns the value of attribute latency_ms

Returns:

  • (Object)

    the current value of latency_ms



13
14
15
# File 'lib/whitebox/models.rb', line 13

def latency_ms
  @latency_ms
end

#modeObject (readonly)

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



13
14
15
# File 'lib/whitebox/models.rb', line 13

def mode
  @mode
end

#runsObject (readonly)

Returns the value of attribute runs

Returns:

  • (Object)

    the current value of runs



13
14
15
# File 'lib/whitebox/models.rb', line 13

def runs
  @runs
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



13
14
15
# File 'lib/whitebox/models.rb', line 13

def status
  @status
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



13
14
15
# File 'lib/whitebox/models.rb', line 13

def value
  @value
end

#verdictObject (readonly)

Returns the value of attribute verdict

Returns:

  • (Object)

    the current value of verdict



13
14
15
# File 'lib/whitebox/models.rb', line 13

def verdict
  @verdict
end

Class Method Details

.from_hash(h) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/whitebox/models.rb', line 14

def self.from_hash(h)
  new(
    id: h["id"],
    status: h["status"],
    value: h["value"],
    confidence: h["confidence"],
    verdict: h["verdict"],
    escalated: h["escalated"],
    runs: (h["runs"] || []).map { |r| Run.from_hash(r) },
    latency_ms: h["latency_ms"],
    cost_usd: h["cost_usd"],
    created_at: h["created_at"],
    mode: h["mode"]
  )
end

Instance Method Details

#escalated?Boolean

Returns:

  • (Boolean)


31
# File 'lib/whitebox/models.rb', line 31

def escalated? = escalated == true

#shipped?Boolean

Returns:

  • (Boolean)


30
# File 'lib/whitebox/models.rb', line 30

def shipped? = verdict == "ship"