Class: MistApi::MapNode

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

Overview

Nodes on maps

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(name = nil, edges = SKIP, position = SKIP) ⇒ MapNode

Returns a new instance of MapNode.



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

def initialize(name = nil, edges = SKIP, position = SKIP)
  @edges = edges unless edges == SKIP
  @name = name
  @position = position unless position == SKIP
end

Instance Attribute Details

#edgesHash[String, String]

TODO: Write general description for this method

Returns:

  • (Hash[String, String])


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

def edges
  @edges
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#positionMapNodePosition

TODO: Write general description for this method

Returns:



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

def position
  @position
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  edges = hash.key?('edges') ? hash['edges'] : SKIP
  position = MapNodePosition.from_hash(hash['position']) if hash['position']

  # Create object from extracted values.
  MapNode.new(name,
              edges,
              position)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['edges'] = 'edges'
  @_hash['name'] = 'name'
  @_hash['position'] = 'position'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
# File 'lib/mist_api/models/map_node.rb', line 34

def self.optionals
  %w[
    edges
    position
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



74
75
76
77
78
# File 'lib/mist_api/models/map_node.rb', line 74

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

#to_sObject

Provides a human-readable string representation of the object.



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

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