pdns_api 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc62c8d844cbb2661dc1f19f56e6a12b4f659095
4
- data.tar.gz: 28c1046f94f11236f1c4ab43ecce060976351104
3
+ metadata.gz: fa80cf3197ec8aadd0d2a93cf3cf0a1df581034c
4
+ data.tar.gz: 5c0e8f49631af8097165db914a239cc527033992
5
5
  SHA512:
6
- metadata.gz: 02ea243ba0cba7ea74b905c6b6475682e94227f0a97899a01d9a4167651440512e73d720baad8b5a804886e6f7c7c9cd4b43a9c1ae8f329b0e399526649b852d
7
- data.tar.gz: d069a42d616b1b48d65ca6a4f41bd31be5204284308545763b59dbecc982ca0a8c3afb8ba13fce0275e7729440b6c634f1841c328f449428c58987ae538978f2
6
+ metadata.gz: 533c9908e0d64d37594c683476009952606007ed065f5ff06f4ced79199eb5bb1bf88f739ad487982f6d9adb6eaabbe30654bff5e7378492f94ea2ed15f4e5c6
7
+ data.tar.gz: 52f239530706b483f0b21b55fc8c014a0e84c609ff0b51cd0dfda9403bc51d3b403123358c0ef858f62339a84edaa62b3eb6e993fd1ee7a1b026e2831e66e745
data/lib/pdns_api/api.rb CHANGED
@@ -32,10 +32,21 @@ module PDNS
32
32
  attr_reader :class
33
33
 
34
34
  ##
35
- # Gets the information of this object from the API and use it
36
- # to update the object's information.
37
- def get
38
- @info = @http.get @url
35
+ # Changes this object's information on the server.
36
+ #
37
+ # +rrsets+ is used as changeset for the update.
38
+ def change(rrsets)
39
+ @http.put(@url, rrsets)
40
+ end
41
+
42
+ ##
43
+ # Creates this object on the server
44
+ #
45
+ # If +info+ is set this method updates the current information.
46
+ # The current information is used to create the object.
47
+ def create(info = nil)
48
+ info(info)
49
+ @http.post("#{@parent.url}/#{@class}", @info)
39
50
  end
40
51
 
41
52
  ##
@@ -45,10 +56,10 @@ module PDNS
45
56
  end
46
57
 
47
58
  ##
48
- # Creates this object on the server
49
- def create(info = nil)
50
- info(info)
51
- @http.post("#{@parent.url}/#{@class}", @info)
59
+ # Gets the information of this object from the API and use it
60
+ # to update the object's information.
61
+ def get
62
+ @info = @http.get @url
52
63
  end
53
64
 
54
65
  ##
@@ -56,7 +67,6 @@ module PDNS
56
67
  # This does not cause an API request.
57
68
  #
58
69
  # If +info+ is set this method updates the current information.
59
- #
60
70
  def info(info = nil)
61
71
  return @info if info.nil?
62
72
 
@@ -65,7 +75,7 @@ module PDNS
65
75
 
66
76
  ##
67
77
  # Ensures the object is an array.
68
- # If it is not, an array containing the item is returned
78
+ # If it is not, an array containing the item is returned.
69
79
  def ensure_array(item)
70
80
  return item if item.is_a? Array
71
81
  [item]
@@ -29,6 +29,10 @@ module PDNS
29
29
  # The PowerDNS API version in use.
30
30
  attr_reader :version
31
31
 
32
+ ##
33
+ # Disabled common methods
34
+ undef_method :change, :create, :delete
35
+
32
36
  ##
33
37
  # Creates a client object.
34
38
  # +args+ is used to create an HTTP object,
@@ -29,6 +29,10 @@ module PDNS
29
29
  # The value of the configuration option.
30
30
  attr_accessor :value
31
31
 
32
+ ##
33
+ # Disabled common methods
34
+ undef_method :delete
35
+
32
36
  ##
33
37
  # Creates a configuration option object.
34
38
  #
@@ -42,7 +46,7 @@ module PDNS
42
46
  @parent = parent
43
47
  @name = name
44
48
  @url = "#{parent.url}/#{@class}/#{name}"
45
- @value = value.get if value.nil?
49
+ @value = get if value.nil?
46
50
  value(@value)
47
51
  end
48
52
 
@@ -21,6 +21,10 @@ module PDNS
21
21
  ##
22
22
  # Cryptokey for a zone.
23
23
  class CryptoKey < API
24
+ ##
25
+ # The ID of the cryptokey.
26
+ attr_reader :id
27
+
24
28
  ##
25
29
  # Creates a cryptokey object.
26
30
  #
@@ -36,13 +40,5 @@ module PDNS
36
40
  @info = info
37
41
  @url = "#{parent.url}/#{@class}/#{id}"
38
42
  end
39
-
40
- ##
41
- # Changes cryptokey information
42
- #
43
- # +rrset+ is used as changeset for the update.
44
- def change(rrsets)
45
- @http.put(@url, rrsets)
46
- end
47
43
  end
48
44
  end
data/lib/pdns_api/http.rb CHANGED
@@ -80,7 +80,7 @@ module PDNS
80
80
  # Returns the decoded response.
81
81
  def http(net, body = nil)
82
82
  # Debug output
83
- puts 'Body: ' + body.to_json if ENV['DEBUG']
83
+ puts "#{net.method}: #{net.path}\nBody: #{body.to_json}" if ENV['DEBUG']
84
84
 
85
85
  # Start an HTTP connection
86
86
  begin
@@ -42,7 +42,7 @@ module PDNS
42
42
  @parent = parent
43
43
  @kind = kind
44
44
  @url = "#{parent.url}/#{@class}/#{kind}"
45
- @value = value.get if value.empty?
45
+ @value = get if value.empty?
46
46
  value(@value)
47
47
  end
48
48
 
@@ -40,13 +40,5 @@ module PDNS
40
40
  @info = info
41
41
  @url = "#{parent.url}/#{@class}/#{id}"
42
42
  end
43
-
44
- ##
45
- # Changes override information.
46
- #
47
- # +rrset+ is used as changeset for the update.
48
- def change(rrsets)
49
- @http.put(@url, rrsets)
50
- end
51
43
  end
52
44
  end
@@ -20,5 +20,5 @@
20
20
  module PDNS
21
21
  ##
22
22
  # The version of +pdns_api+.
23
- VERSION = '0.1.0'.freeze
23
+ VERSION = '0.1.1'.freeze
24
24
  end
data/lib/pdns_api/zone.rb CHANGED
@@ -56,13 +56,6 @@ module PDNS
56
56
  @http.patch(@url, rrsets: rrsets)
57
57
  end
58
58
 
59
- ##
60
- # Modifies basic zone data (metadata).
61
- # +rrset+ is used as changeset for the update.
62
- def change(rrsets)
63
- @http.put(@url, rrsets)
64
- end
65
-
66
59
  ##
67
60
  # Notifies slaves for a zone.
68
61
  # Only works for domains for which the server is a master.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdns_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Silke Hofstra
@@ -11,7 +11,7 @@ cert_chain: []
11
11
  date: 2016-05-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem for manipulation of DNS through the PowerDNS API
14
- email: silke@slxh.eu
14
+ email: silke.ruby@slxh.nl
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
@@ -39,7 +39,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '0'
42
+ version: 1.9.1
43
43
  required_rubygems_version: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  version: '0'
48
48
  requirements: []
49
49
  rubyforge_project:
50
- rubygems_version: 2.4.5.1
50
+ rubygems_version: 2.2.2
51
51
  signing_key:
52
52
  specification_version: 4
53
53
  summary: PowerDNS API gem