Class: MistApi::SleClassifierSamples

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/sle_classifier_samples.rb

Overview

SleClassifierSamples Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(degraded = nil, duration = nil, total = nil) ⇒ SleClassifierSamples

Returns a new instance of SleClassifierSamples.



43
44
45
46
47
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 43

def initialize(degraded = nil, duration = nil, total = nil)
  @degraded = degraded
  @duration = duration
  @total = total
end

Instance Attribute Details

#degradedArray[Float]

TODO: Write general description for this method

Returns:

  • (Array[Float])


14
15
16
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 14

def degraded
  @degraded
end

#durationArray[Float]

TODO: Write general description for this method

Returns:

  • (Array[Float])


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

def duration
  @duration
end

#totalArray[Float]

TODO: Write general description for this method

Returns:

  • (Array[Float])


22
23
24
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 22

def total
  @total
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 50

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  degraded = hash.key?('degraded') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:NumberOrNull), hash['degraded']
  ) : nil
  duration = hash.key?('duration') ? hash['duration'] : nil
  total = hash.key?('total') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:NumberOrNull), hash['total']
  ) : nil

  # Create object from extracted values.
  SleClassifierSamples.new(degraded,
                           duration,
                           total)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['degraded'] = 'degraded'
  @_hash['duration'] = 'duration'
  @_hash['total'] = 'total'
  @_hash
end

.nullablesObject

An array for nullable fields



39
40
41
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 39

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 34

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 70

def self.validate(value)
  if value.instance_of? self
    return (
      UnionTypeLookUp.get(:NumberOrNull)
                     .validate(value.degraded) and
        APIHelper.valid_type?(value.duration,
                              ->(val) { val.instance_of? Float }) and
        UnionTypeLookUp.get(:NumberOrNull)
                       .validate(value.total)
    )
  end

  return false unless value.instance_of? Hash

  (
    UnionTypeLookUp.get(:NumberOrNull)
                   .validate(value['degraded']) and
      APIHelper.valid_type?(value['duration'],
                            ->(val) { val.instance_of? Float }) and
      UnionTypeLookUp.get(:NumberOrNull)
                     .validate(value['total'])
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



101
102
103
104
105
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 101

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} degraded: #{@degraded.inspect}, duration: #{@duration.inspect}, total:"\
  " #{@total.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
# File 'lib/mist_api/models/sle_classifier_samples.rb', line 95

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} degraded: #{@degraded}, duration: #{@duration}, total: #{@total}>"
end