Class: MistApi::ConstEvent

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

Overview

ConstEvent 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(display = nil, key = nil, description = SKIP, example = SKIP, group = SKIP) ⇒ ConstEvent

Returns a new instance of ConstEvent.



57
58
59
60
61
62
63
64
# File 'lib/mist_api/models/const_event.rb', line 57

def initialize(display = nil, key = nil, description = SKIP, example = SKIP,
               group = SKIP)
  @description = description unless description == SKIP
  @display = display
  @example = example unless example == SKIP
  @group = group unless group == SKIP
  @key = key
end

Instance Attribute Details

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#displayString

TODO: Write general description for this method

Returns:

  • (String)


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

def display
  @display
end

#exampleObject

TODO: Write general description for this method

Returns:

  • (Object)


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

def example
  @example
end

#groupString

TODO: Write general description for this method

Returns:

  • (String)


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

def group
  @group
end

#keyString

TODO: Write general description for this method

Returns:

  • (String)


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

def key
  @key
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  display = hash.key?('display') ? hash['display'] : nil
  key = hash.key?('key') ? hash['key'] : nil
  description = hash.key?('description') ? hash['description'] : SKIP
  example = hash.key?('example') ? hash['example'] : SKIP
  group = hash.key?('group') ? hash['group'] : SKIP

  # Create object from extracted values.
  ConstEvent.new(display,
                 key,
                 description,
                 example,
                 group)
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/const_event.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['description'] = 'description'
  @_hash['display'] = 'display'
  @_hash['example'] = 'example'
  @_hash['group'] = 'group'
  @_hash['key'] = 'key'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
# File 'lib/mist_api/models/const_event.rb', line 53

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    description
    example
    group
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



93
94
95
96
97
# File 'lib/mist_api/models/const_event.rb', line 93

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description.inspect}, display: #{@display.inspect},"\
  " example: #{@example.inspect}, group: #{@group.inspect}, key: #{@key.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



86
87
88
89
90
# File 'lib/mist_api/models/const_event.rb', line 86

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description}, display: #{@display}, example: #{@example},"\
  " group: #{@group}, key: #{@key}>"
end