Class: MistApi::AlarmSearchResult

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

Overview

AlarmSearchResult 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(mend = nil, limit = nil, results = nil, start = nil, total = nil, component = SKIP, mnext = SKIP, page = SKIP) ⇒ AlarmSearchResult

Returns a new instance of AlarmSearchResult.



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

def initialize(mend = nil, limit = nil, results = nil, start = nil,
               total = nil, component = SKIP, mnext = SKIP, page = SKIP)
  @component = component unless component == SKIP
  @mend = mend
  @limit = limit
  @mnext = mnext unless mnext == SKIP
  @page = page unless page == SKIP
  @results = results
  @start = start
  @total = total
end

Instance Attribute Details

#componentString

Component of the alarm

Returns:

  • (String)


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

def component
  @component
end

#limitInteger

Component of the alarm

Returns:

  • (Integer)


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

def limit
  @limit
end

#mendInteger

Component of the alarm

Returns:

  • (Integer)


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

def mend
  @mend
end

#mnextString

Component of the alarm

Returns:

  • (String)


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

def mnext
  @mnext
end

#pageInteger

Component of the alarm

Returns:

  • (Integer)


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

def page
  @page
end

#resultsArray[Alarm]

Component of the alarm

Returns:



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

def results
  @results
end

#startInteger

Component of the alarm

Returns:

  • (Integer)


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

def start
  @start
end

#totalInteger

Component of the alarm

Returns:

  • (Integer)


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

def total
  @total
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/mist_api/models/alarm_search_result.rb', line 85

def self.from_hash(hash)
  return nil unless hash

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

  results = nil unless hash.key?('results')
  start = hash.key?('start') ? hash['start'] : nil
  total = hash.key?('total') ? hash['total'] : nil
  component = hash.key?('component') ? hash['component'] : SKIP
  mnext = hash.key?('next') ? hash['next'] : SKIP
  page = hash.key?('page') ? hash['page'] : SKIP

  # Create object from extracted values.
  AlarmSearchResult.new(mend,
                        limit,
                        results,
                        start,
                        total,
                        component,
                        mnext,
                        page)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/mist_api/models/alarm_search_result.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['component'] = 'component'
  @_hash['mend'] = 'end'
  @_hash['limit'] = 'limit'
  @_hash['mnext'] = 'next'
  @_hash['page'] = 'page'
  @_hash['results'] = 'results'
  @_hash['start'] = 'start'
  @_hash['total'] = 'total'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/mist_api/models/alarm_search_result.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
# File 'lib/mist_api/models/alarm_search_result.rb', line 59

def self.optionals
  %w[
    component
    mnext
    page
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



126
127
128
129
130
131
# File 'lib/mist_api/models/alarm_search_result.rb', line 126

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} component: #{@component.inspect}, mend: #{@mend.inspect}, limit:"\
  " #{@limit.inspect}, mnext: #{@mnext.inspect}, page: #{@page.inspect}, results:"\
  " #{@results.inspect}, start: #{@start.inspect}, total: #{@total.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
# File 'lib/mist_api/models/alarm_search_result.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} component: #{@component}, mend: #{@mend}, limit: #{@limit}, mnext:"\
  " #{@mnext}, page: #{@page}, results: #{@results}, start: #{@start}, total: #{@total}>"
end