Class: MistApi::FwupdateStat

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

Overview

FwupdateStat 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(progress = SKIP, status = SKIP, status_id = SKIP, timestamp = SKIP, will_retry = SKIP) ⇒ FwupdateStat

Returns a new instance of FwupdateStat.



64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/fwupdate_stat.rb', line 64

def initialize(progress = SKIP, status = SKIP, status_id = SKIP,
               timestamp = SKIP, will_retry = SKIP)
  @progress = progress unless progress == SKIP
  @status = status unless status == SKIP
  @status_id = status_id unless status_id == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @will_retry = will_retry unless will_retry == SKIP
end

Instance Attribute Details

#progressInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def progress
  @progress
end

#statusFwupdateStatStatusEnum

enum: ‘inprogress`, `failed`, `upgraded`, `success`, `scheduled`, `error`



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

def status
  @status
end

#status_idInteger

enum: ‘inprogress`, `failed`, `upgraded`, `success`, `scheduled`, `error`

Returns:

  • (Integer)


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

def status_id
  @status_id
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


26
27
28
# File 'lib/mist_api/models/fwupdate_stat.rb', line 26

def timestamp
  @timestamp
end

#will_retryTrueClass | FalseClass

Epoch (seconds)

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/mist_api/models/fwupdate_stat.rb', line 30

def will_retry
  @will_retry
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mist_api/models/fwupdate_stat.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  progress = hash.key?('progress') ? hash['progress'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  status_id = hash.key?('status_id') ? hash['status_id'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  will_retry = hash.key?('will_retry') ? hash['will_retry'] : SKIP

  # Create object from extracted values.
  FwupdateStat.new(progress,
                   status,
                   status_id,
                   timestamp,
                   will_retry)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/mist_api/models/fwupdate_stat.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['progress'] = 'progress'
  @_hash['status'] = 'status'
  @_hash['status_id'] = 'status_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash['will_retry'] = 'will_retry'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
58
59
60
61
62
# File 'lib/mist_api/models/fwupdate_stat.rb', line 55

def self.nullables
  %w[
    progress
    status
    status_id
    will_retry
  ]
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/mist_api/models/fwupdate_stat.rb', line 44

def self.optionals
  %w[
    progress
    status
    status_id
    timestamp
    will_retry
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (FwupdateStat | Hash)

    value against the validation is performed.



94
95
96
97
98
99
100
# File 'lib/mist_api/models/fwupdate_stat.rb', line 94

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
115
# File 'lib/mist_api/models/fwupdate_stat.rb', line 110

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} progress: #{@progress.inspect}, status: #{@status.inspect}, status_id:"\
  " #{@status_id.inspect}, timestamp: #{@timestamp.inspect}, will_retry:"\
  " #{@will_retry.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
# File 'lib/mist_api/models/fwupdate_stat.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} progress: #{@progress}, status: #{@status}, status_id: #{@status_id},"\
  " timestamp: #{@timestamp}, will_retry: #{@will_retry}>"
end