Class: MistApi::OspfArea

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

Overview

Property key is the OSPF Area (Area should be a number (0-255) / IP address)

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(include_loopback = false, networks = SKIP, type = OspfAreaTypeEnum::DEFAULT) ⇒ OspfArea

Returns a new instance of OspfArea.



47
48
49
50
51
52
# File 'lib/mist_api/models/ospf_area.rb', line 47

def initialize(include_loopback = false, networks = SKIP,
               type = OspfAreaTypeEnum::DEFAULT)
  @include_loopback = include_loopback unless include_loopback == SKIP
  @networks = networks unless networks == SKIP
  @type = type unless type == SKIP
end

Instance Attribute Details

#include_loopbackTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def include_loopback
  @include_loopback
end

#networksHash[String, OspfAreasNetwork]

TODO: Write general description for this method

Returns:



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

def networks
  @networks
end

#typeOspfAreaTypeEnum

OSPF type. enum: ‘default`, `nssa`, `stub`

Returns:



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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/mist_api/models/ospf_area.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  include_loopback = hash['include_loopback'] ||= false
  networks = OspfAreasNetwork.from_hash(hash['networks']) if hash['networks']

  networks = SKIP unless hash.key?('networks')
  type = hash['type'] ||= OspfAreaTypeEnum::DEFAULT

  # Create object from extracted values.
  OspfArea.new(include_loopback,
               networks,
               type)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['include_loopback'] = 'include_loopback'
  @_hash['networks'] = 'networks'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/mist_api/models/ospf_area.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    include_loopback
    networks
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



79
80
81
82
83
# File 'lib/mist_api/models/ospf_area.rb', line 79

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

#to_sObject

Provides a human-readable string representation of the object.



72
73
74
75
76
# File 'lib/mist_api/models/ospf_area.rb', line 72

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} include_loopback: #{@include_loopback}, networks: #{@networks}, type:"\
  " #{@type}>"
end