Class: MistApi::ResponseAsyncLicense

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

Overview

ResponseAsyncLicense 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(completed = SKIP, details = SKIP, failed = SKIP, incompleted = SKIP, processed = SKIP, scheduled_at = SKIP, status = SKIP, succeed = SKIP, timestamp = SKIP, total = SKIP) ⇒ ResponseAsyncLicense

Returns a new instance of ResponseAsyncLicense.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/mist_api/models/response_async_license.rb', line 89

def initialize(completed = SKIP, details = SKIP, failed = SKIP,
               incompleted = SKIP, processed = SKIP, scheduled_at = SKIP,
               status = SKIP, succeed = SKIP, timestamp = SKIP,
               total = SKIP)
  @completed = completed unless completed == SKIP
  @details = details unless details == SKIP
  @failed = failed unless failed == SKIP
  @incompleted = incompleted unless incompleted == SKIP
  @processed = processed unless processed == SKIP
  @scheduled_at = scheduled_at unless scheduled_at == SKIP
  @status = status unless status == SKIP
  @succeed = succeed unless succeed == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @total = total unless total == SKIP
end

Instance Attribute Details

#completedArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def completed
  @completed
end

#detailsArray[ResponseAsyncLicenseDetail]

TODO: Write general description for this method

Returns:



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

def details
  @details
end

#failedInteger

Current failed number of device

Returns:

  • (Integer)


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

def failed
  @failed
end

#incompletedArray[String]

Current incompleted lists (macs)

Returns:

  • (Array[String])


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

def incompleted
  @incompleted
end

#processedInteger

Current processed number of device

Returns:

  • (Integer)


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

def processed
  @processed
end

#scheduled_atInteger

epoch time of aysnc claim scheduled

Returns:

  • (Integer)


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

def scheduled_at
  @scheduled_at
end

#statusResponseAsyncLicenseStatusEnum

processing status of async. enum: ‘prepared`, `ongoing`, `done`



38
39
40
# File 'lib/mist_api/models/response_async_license.rb', line 38

def status
  @status
end

#succeedInteger

Current succeed number of device

Returns:

  • (Integer)


42
43
44
# File 'lib/mist_api/models/response_async_license.rb', line 42

def succeed
  @succeed
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


46
47
48
# File 'lib/mist_api/models/response_async_license.rb', line 46

def timestamp
  @timestamp
end

#totalInteger

total number of device included in claim

Returns:

  • (Integer)


50
51
52
# File 'lib/mist_api/models/response_async_license.rb', line 50

def total
  @total
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/mist_api/models/response_async_license.rb', line 106

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  completed = hash.key?('completed') ? hash['completed'] : SKIP
  # Parameter is an array, so we need to iterate through it
  details = nil
  unless hash['details'].nil?
    details = []
    hash['details'].each do |structure|
      details << (ResponseAsyncLicenseDetail.from_hash(structure) if structure)
    end
  end

  details = SKIP unless hash.key?('details')
  failed = hash.key?('failed') ? hash['failed'] : SKIP
  incompleted = hash.key?('incompleted') ? hash['incompleted'] : SKIP
  processed = hash.key?('processed') ? hash['processed'] : SKIP
  scheduled_at = hash.key?('scheduled_at') ? hash['scheduled_at'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  succeed = hash.key?('succeed') ? hash['succeed'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  total = hash.key?('total') ? hash['total'] : SKIP

  # Create object from extracted values.
  ResponseAsyncLicense.new(completed,
                           details,
                           failed,
                           incompleted,
                           processed,
                           scheduled_at,
                           status,
                           succeed,
                           timestamp,
                           total)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['completed'] = 'completed'
  @_hash['details'] = 'details'
  @_hash['failed'] = 'failed'
  @_hash['incompleted'] = 'incompleted'
  @_hash['processed'] = 'processed'
  @_hash['scheduled_at'] = 'scheduled_at'
  @_hash['status'] = 'status'
  @_hash['succeed'] = 'succeed'
  @_hash['timestamp'] = 'timestamp'
  @_hash['total'] = 'total'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/mist_api/models/response_async_license.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/mist_api/models/response_async_license.rb', line 69

def self.optionals
  %w[
    completed
    details
    failed
    incompleted
    processed
    scheduled_at
    status
    succeed
    timestamp
    total
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



152
153
154
155
156
157
158
# File 'lib/mist_api/models/response_async_license.rb', line 152

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} completed: #{@completed.inspect}, details: #{@details.inspect}, failed:"\
  " #{@failed.inspect}, incompleted: #{@incompleted.inspect}, processed:"\
  " #{@processed.inspect}, scheduled_at: #{@scheduled_at.inspect}, status: #{@status.inspect},"\
  " succeed: #{@succeed.inspect}, timestamp: #{@timestamp.inspect}, total: #{@total.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



144
145
146
147
148
149
# File 'lib/mist_api/models/response_async_license.rb', line 144

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} completed: #{@completed}, details: #{@details}, failed: #{@failed},"\
  " incompleted: #{@incompleted}, processed: #{@processed}, scheduled_at: #{@scheduled_at},"\
  " status: #{@status}, succeed: #{@succeed}, timestamp: #{@timestamp}, total: #{@total}>"
end