Class: RubyPhpipam::Section
- Inherits:
-
Object
- Object
- RubyPhpipam::Section
- Defined in:
- lib/ruby_phpipam/section.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#DNS ⇒ Object
readonly
Returns the value of attribute DNS.
-
#editDate ⇒ Object
readonly
Returns the value of attribute editDate.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#masterSection ⇒ Object
readonly
Returns the value of attribute masterSection.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
-
#showSupernetOnly ⇒ Object
readonly
Returns the value of attribute showSupernetOnly.
-
#showVLAN ⇒ Object
readonly
Returns the value of attribute showVLAN.
-
#showVRF ⇒ Object
readonly
Returns the value of attribute showVRF.
-
#strictMode ⇒ Object
readonly
Returns the value of attribute strictMode.
-
#subnetOrdering ⇒ Object
readonly
Returns the value of attribute subnetOrdering.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ Section
constructor
A new instance of Section.
- #subnets ⇒ Object
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
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def description @description end |
#DNS ⇒ Object (readonly)
Returns the value of attribute DNS.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def DNS @DNS end |
#editDate ⇒ Object (readonly)
Returns the value of attribute editDate.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def editDate @editDate end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def id @id end |
#masterSection ⇒ Object (readonly)
Returns the value of attribute masterSection.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def masterSection @masterSection end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def name @name end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def order @order end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def @permissions end |
#showSupernetOnly ⇒ Object (readonly)
Returns the value of attribute showSupernetOnly.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def showSupernetOnly @showSupernetOnly end |
#showVLAN ⇒ Object (readonly)
Returns the value of attribute showVLAN.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def showVLAN @showVLAN end |
#showVRF ⇒ Object (readonly)
Returns the value of attribute showVRF.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def showVRF @showVRF end |
#strictMode ⇒ Object (readonly)
Returns the value of attribute strictMode.
3 4 5 |
# File 'lib/ruby_phpipam/section.rb', line 3 def strictMode @strictMode end |
#subnetOrdering ⇒ Object (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_all ⇒ Object
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
#subnets ⇒ Object
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 |