Class: RubyPhpipam::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_phpipam/section.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Section

Returns a new instance of Section.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ruby_phpipam/section.rb', line 7

def initialize(json)
  @id = RubyPhpipam::Helper.to_type(json[:id], :int)
  @name = json[:name]
  @description = json[:description]
  @masterSection = RubyPhpipam::Helper.to_type(json[:masterSection], :int)
  @permissions = RubyPhpipam::Helper.to_type(json[:permissions], :json)
  @strictMode = RubyPhpipam::Helper.to_type(json[:strictMode], :binary)
  @subnetOrdering = json[:subnetOrdering]
  @order = RubyPhpipam::Helper.to_type(json[:order], :int)
  @editDate = RubyPhpipam::Helper.to_type(json[:editDate], :date)
  @showVLAN = RubyPhpipam::Helper.to_type(json[:showVLAN], :binary)
  @showVRF = RubyPhpipam::Helper.to_type(json[:showVRF], :binary)
  @showSupernetOnly = RubyPhpipam::Helper.to_type(json[:showSupernetOnly], :binary)
  @DNS = json[:DNS]
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def description
  @description
end

#DNSObject (readonly)

Returns the value of attribute DNS.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def DNS
  @DNS
end

#editDateObject (readonly)

Returns the value of attribute editDate.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def editDate
  @editDate
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def id
  @id
end

#masterSectionObject (readonly)

Returns the value of attribute masterSection.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def masterSection
  @masterSection
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def name
  @name
end

#orderObject (readonly)

Returns the value of attribute order.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def order
  @order
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def permissions
  @permissions
end

#showSupernetOnlyObject (readonly)

Returns the value of attribute showSupernetOnly.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def showSupernetOnly
  @showSupernetOnly
end

#showVLANObject (readonly)

Returns the value of attribute showVLAN.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def showVLAN
  @showVLAN
end

#showVRFObject (readonly)

Returns the value of attribute showVRF.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def showVRF
  @showVRF
end

#strictModeObject (readonly)

Returns the value of attribute strictMode.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def strictMode
  @strictMode
end

#subnetOrderingObject (readonly)

Returns the value of attribute subnetOrdering.



3
4
5
# File 'lib/ruby_phpipam/section.rb', line 3

def subnetOrdering
  @subnetOrdering
end

Class Method Details

.get(id_or_name) ⇒ Object



23
24
25
# File 'lib/ruby_phpipam/section.rb', line 23

def self.get(id_or_name)
  Section.new(RubyPhpipam::Query.get("/sections/#{id_or_name}/"))
end

.get_allObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/ruby_phpipam/section.rb', line 27

def self.get_all
  data = RubyPhpipam::Query.get("/sections/")

  sections = []
  data.each do |section|
    sections << Section.new(section)
  end

  return sections
end

Instance Method Details

#subnetsObject



38
39
40
41
42
43
44
# File 'lib/ruby_phpipam/section.rb', line 38

def subnets
  data = RubyPhpipam::Query.get_array("/sections/#{@id}/subnets/")

  data.map do |subnet|
    RubyPhpipam::Subnet.new(subnet)
  end
end