infoblox 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/infoblox.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Billy Reisinger"]
10
10
  spec.email = ["billy.reisinger@govdelivery.com"]
11
11
  spec.description = %q{A Ruby wrapper to the Infoblox WAPI}
12
- spec.summary = %q{This gem is a Ruby interface to the Infoblox WAPI. Resources supported for REST operations include IPv4Addr, Network, and Host. }
12
+ spec.summary = %q{This gem is a Ruby interface to the Infoblox WAPI. Resources supported for REST operations include CNAME, Host, HostIpv4addr, Ipv4addr, Network, and NewtorkContainer. }
13
13
  spec.homepage = "https://github.com/govdelivery/infoblox"
14
14
  spec.license = "MIT"
15
15
 
data/lib/infoblox.rb CHANGED
@@ -13,6 +13,7 @@ require 'infoblox/resource/host_ipv4addr'
13
13
  require 'infoblox/resource/ipv4addr'
14
14
  require 'infoblox/resource/network'
15
15
  require 'infoblox/resource/network_container'
16
+ require 'infoblox/resource/ptr'
16
17
 
17
18
  module Infoblox
18
19
  WAPI_VERSION = '1.0'
@@ -19,5 +19,11 @@ module Infoblox
19
19
  def ipv4addrs
20
20
  @ipv4addrs ||= []
21
21
  end
22
+
23
+ def remote_attribute_hash(write=false, post=false)
24
+ super.tap do |hsh|
25
+ hsh[:ipv4addrs] = ipv4addrs.map{|i| {:ipv4addr => i.ipv4addr}}
26
+ end
27
+ end
22
28
  end
23
29
  end
@@ -0,0 +1,9 @@
1
+ module Infoblox
2
+ class Ptr < Resource
3
+ remote_attr_accessor :ipv4addr, :name, :ptrdname,
4
+ :extensible_attributes
5
+ attr_accessor :view
6
+
7
+ wapi_object "record:ptr"
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Infoblox
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/spec/host_spec.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ HostResponse = Struct.new(:body)
2
3
  describe Infoblox::Host, "#add_ipv4addr" do
3
4
  it "adds an address correctly" do
4
5
  host = Infoblox::Host.new
@@ -7,5 +8,22 @@ describe Infoblox::Host, "#add_ipv4addr" do
7
8
  host.ipv4addrs[0].should be_a(Infoblox::Ipv4addr)
8
9
  host.ipv4addrs[0].ipv4addr.should eq("10.10.10.10")
9
10
  end
11
+
12
+ it "posts correctly" do
13
+ conn = double
14
+ uri = Infoblox::BASE_PATH + Infoblox::Host.wapi_object
15
+
16
+ allow(conn).to receive(:post).with(uri, {
17
+ :ipv4addrs => [{:ipv4addr => "10.10.10.10"}],
18
+ :name => "test-server.test.ing",
19
+ :configure_for_dns => nil,
20
+ :extensible_attributes => nil}).and_return(HostResponse.new("hey"))
21
+
22
+ Infoblox::Host.connection = conn
23
+ h = Infoblox::Host.new
24
+ h.add_ipv4addr("10.10.10.10")
25
+ h.name = "test-server.test.ing"
26
+ h.post
27
+ end
10
28
  end
11
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infoblox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -133,6 +133,7 @@ files:
133
133
  - lib/infoblox/resource/ipv4addr.rb
134
134
  - lib/infoblox/resource/network.rb
135
135
  - lib/infoblox/resource/network_container.rb
136
+ - lib/infoblox/resource/ptr.rb
136
137
  - lib/infoblox/version.rb
137
138
  - spec/host_spec.rb
138
139
  - spec/resource_spec.rb
@@ -162,7 +163,7 @@ rubygems_version: 1.8.25
162
163
  signing_key:
163
164
  specification_version: 3
164
165
  summary: This gem is a Ruby interface to the Infoblox WAPI. Resources supported for
165
- REST operations include IPv4Addr, Network, and Host.
166
+ REST operations include CNAME, Host, HostIpv4addr, Ipv4addr, Network, and NewtorkContainer.
166
167
  test_files:
167
168
  - spec/host_spec.rb
168
169
  - spec/resource_spec.rb