infoblox 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -24,11 +24,17 @@ An instance of the `Infoblox::Connection` class is necessary:
24
24
  connection = Infoblox::Connection.new(:username => '', :password => '', :host => '')
25
25
 
26
26
  ## Querying
27
- Once a connection is made, one can use the resource class methods to query records:
27
+ Once a connection is made, one can use the resource class methods to query records. You can use the `_max_results` and `_return_fields` parameters for both `find` and `all`. See the Infoblox WAPI documentation on how to use these parameters.
28
28
 
29
+ # Find all networks. Note that this is limited to 1000 objects, as per the
30
+ # Infoblox WAPI documentation.
29
31
  Infoblox::Network.all(connection)
30
32
  # => [...]
33
+
34
+ # Find the first 7890 hosts
35
+ Infoblox::Network.all(connection, :_max_results => 7890)
31
36
 
37
+ # Find hosts that match a regular expression
32
38
  Infoblox::Host.find(connection, {"name~" => "demo[0-9]{1,}-web.domain"})
33
39
  # => [...]
34
40
 
@@ -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 CNAME, Host, HostIpv4addr, Ipv4addr, Network, and NewtorkContainer. }
12
+ spec.summary = %q{This gem is a Ruby interface to the Infoblox WAPI. Using the gem, you can query, create, update, and delete DNS records in your Infoblox instance.}
13
13
  spec.homepage = "https://github.com/govdelivery/infoblox"
14
14
  spec.license = "MIT"
15
15
 
@@ -64,22 +64,31 @@ module Infoblox
64
64
  end
65
65
 
66
66
  ##
67
- # Return an array of all records for this resource.
67
+ # Return an array of all records for this resource. You can use the default parameters
68
+ # _max_results an/or _return_fields as documented by Infoblox.
69
+ #
70
+ # Example: return only 70 results
71
+ # {"_max_results" => 70}
72
+ #
73
+ # Example: return only 100 results, throw an error if there are more
74
+ # {"_max_results" => -100}
68
75
  #
69
- def self.all(connection)
70
- JSON.parse(connection.get(resource_uri, default_params).body).map do |item|
76
+ def self.all(connection, params = {})
77
+ params = default_params.merge(params)
78
+ JSON.parse(connection.get(resource_uri, params).body).map do |item|
71
79
  new(item.merge({:connection => connection}))
72
80
  end
73
81
  end
74
82
 
75
83
  ##
76
- # Find resources with query parameters.
84
+ # Find resources with query parameters. You can use the default parameters
85
+ # _max_results an/or _return_fields as documented by Infoblox.
77
86
  #
78
87
  # Example: return extensible attributes for every resource.
79
88
  # {"_return_fields" => "extensible_attributes"}
80
89
  #
81
- # Example: filter resources by name.
82
- # {"name~" => "foo.*bar"}
90
+ # Example: filter resources by name, return 692 results or less
91
+ # {"name~" => "foo.*bar", "_max_results" => 692}
83
92
  #
84
93
  def self.find(connection, params)
85
94
  params = default_params.merge(params)
@@ -7,12 +7,12 @@ module Infoblox
7
7
 
8
8
  def ipv4addrs=(attrs=[])
9
9
  attrs.each do |att|
10
- ipv4addrs << Ipv4addr.new(att)
10
+ ipv4addrs << HostIpv4addr.new(att)
11
11
  end
12
12
  end
13
13
 
14
14
  def add_ipv4addr(address)
15
- ipv4addrs << Ipv4addr.new(:ipv4addr => address)
15
+ ipv4addrs << HostIpv4addr.new(:ipv4addr => address)
16
16
  end
17
17
 
18
18
  def ipv4addrs
@@ -1,17 +1,9 @@
1
1
  module Infoblox
2
2
  class HostIpv4addr < Resource
3
- remote_attr_accessor :network, :host, :ipv4addr
3
+ remote_attr_accessor :network, :host, :ipv4addr, :configure_for_dhcp
4
4
 
5
5
  wapi_object "record:host_ipv4addr"
6
6
 
7
- def post
8
- raise "Not supported"
9
- end
10
-
11
- def put
12
- raise "Not supported"
13
- end
14
-
15
7
  def delete
16
8
  raise "Not supported"
17
9
  end
@@ -1,3 +1,3 @@
1
1
  module Infoblox
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
@@ -5,7 +5,7 @@ describe Infoblox::Host, "#add_ipv4addr" do
5
5
  host = Infoblox::Host.new
6
6
  host.add_ipv4addr("10.10.10.10")
7
7
  host.add_ipv4addr("10.10.10.12")
8
- host.ipv4addrs[0].should be_a(Infoblox::Ipv4addr)
8
+ host.ipv4addrs[0].should be_a(Infoblox::HostIpv4addr)
9
9
  host.ipv4addrs[0].ipv4addr.should eq("10.10.10.10")
10
10
  end
11
11
 
@@ -35,6 +35,13 @@ describe Infoblox::Resource, "#add_ipv4addr" do
35
35
  FooResource.all(conn).should eq([])
36
36
  end
37
37
 
38
+ it "should allow .all with return fields or max results" do
39
+ conn = double
40
+ uri = Infoblox::BASE_PATH + "foo:animal"
41
+ allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction", :_max_results => -70}).and_return(FooResponse.new("[]"))
42
+ FooResource.all(conn, :_max_results => -70).should eq([])
43
+ end
44
+
38
45
  it "should put with the right attributes" do
39
46
  conn = double
40
47
  uri = Infoblox::BASE_PATH + "abcd"
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.2.6
4
+ version: 0.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-14 00:00:00.000000000 Z
12
+ date: 2014-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -128,7 +128,6 @@ files:
128
128
  - lib/infoblox/resource/cname.rb
129
129
  - lib/infoblox/resource/host.rb
130
130
  - lib/infoblox/resource/host_ipv4addr.rb
131
- - lib/infoblox/resource/ipv4addr.rb
132
131
  - lib/infoblox/resource/mx.rb
133
132
  - lib/infoblox/resource/network.rb
134
133
  - lib/infoblox/resource/network_container.rb
@@ -157,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
156
  version: '0'
158
157
  segments:
159
158
  - 0
160
- hash: -156332127227690039
159
+ hash: 3893532931780741839
161
160
  required_rubygems_version: !ruby/object:Gem::Requirement
162
161
  none: false
163
162
  requirements:
@@ -166,14 +165,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
165
  version: '0'
167
166
  segments:
168
167
  - 0
169
- hash: -156332127227690039
168
+ hash: 3893532931780741839
170
169
  requirements: []
171
170
  rubyforge_project:
172
171
  rubygems_version: 1.8.24
173
172
  signing_key:
174
173
  specification_version: 3
175
- summary: This gem is a Ruby interface to the Infoblox WAPI. Resources supported for
176
- REST operations include CNAME, Host, HostIpv4addr, Ipv4addr, Network, and NewtorkContainer.
174
+ summary: This gem is a Ruby interface to the Infoblox WAPI. Using the gem, you can
175
+ query, create, update, and delete DNS records in your Infoblox instance.
177
176
  test_files:
178
177
  - spec/connection_spec.rb
179
178
  - spec/host_spec.rb
@@ -1,8 +0,0 @@
1
- module Infoblox
2
- class Ipv4addr < Resource
3
- remote_attr_accessor :ipv4addr, :configure_for_dhcp
4
- attr_accessor :network, :host
5
-
6
- wapi_object "record:host_ipv4addr"
7
- end
8
- end