class RubyPhpipam::Section

Attributes

DNS[R]
description[R]
editDate[R]
id[R]
masterSection[R]
name[R]
order[R]
permissions[R]
showSupernetOnly[R]
showVLAN[R]
showVRF[R]
strictMode[R]
subnetOrdering[R]

Public Class Methods

get(id_or_name) click to toggle source
# 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_all() click to toggle source
# 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
new(json) click to toggle source
# 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

Public Instance Methods

subnets() click to toggle source
# 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