epp-client-secdns 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA512:
3
- data.tar.gz: a1ea9eee89730360b7cc8fa50aba54f22704d37b87a89e3d39a9184c3c81de57a7e5b32278222ad4b594e93a5880df63645b342e04a251bca07792e68f914e63
4
- metadata.gz: fb438b27e8a1cedd0169335318c80ac4bd4ec23bc9239fa0a7d56766cf09b3a0f35a22efa298d32ca2e5256f3ba6761ec341426cad794bf74a5d22bfc8dd4ed4
3
+ metadata.gz: 1650c6539c0e8047075211f9d8f934c521473d1657ffb7f300f1f8280ab003bdbe6843cb499453f0ffff6b1528edcfd002bff67512a5d36f16b081e4fa40bbcf
4
+ data.tar.gz: 48f56471cb4d15e7e42fa6783064d72ec266f177b7d132dbdf6c29dfa0cf41974a1171a8d7ec8c449e782853673dde6c4057436754d5541d281fcf42d09632a8
5
5
  SHA1:
6
- data.tar.gz: 32607b7e2652ce1351571eef9151f214b9aedf36
7
- metadata.gz: 04125363983cecefedfe63e6f68d50073187085d
6
+ metadata.gz: 388f0b7cd8556735afc356474070191e4267da30
7
+ data.tar.gz: 9399f224290ad9532045070f0f2e3e108db4c0fc
data/Rakefile CHANGED
@@ -2,9 +2,9 @@
2
2
  require 'rake'
3
3
  require 'rdoc/task'
4
4
  require 'rubygems/package_task'
5
- require "bundler/gem_helper"
5
+ require 'bundler/gem_helper'
6
6
 
7
- MY_GEMS = Dir['*.gemspec'].map {|g| g.sub(/.*-(.*)\.gemspec/, '\1')}
7
+ MY_GEMS = Dir['*.gemspec'].map { |g| g.sub(/.*-(.*)\.gemspec/, '\1') }
8
8
 
9
9
  MY_GEMS.each do |g|
10
10
  namespace g do
@@ -26,10 +26,10 @@ task :build => 'all:build'
26
26
  task :install => 'all:install'
27
27
  task :push => 'all:push'
28
28
 
29
- desc "Generate documentation for the Rails framework"
29
+ desc 'Generate documentation for the Rails framework'
30
30
  Rake::RDocTask.new do |rdoc|
31
31
  rdoc.rdoc_dir = 'doc/rdoc'
32
- rdoc.title = "Documentation"
32
+ rdoc.title = 'Documentation'
33
33
 
34
34
  rdoc.options << '--line-numbers' << '--inline-source'
35
35
  rdoc.options << '--charset' << 'utf-8'
@@ -38,4 +38,3 @@ Rake::RDocTask.new do |rdoc|
38
38
  rdoc.rdoc_files.include('ChangeLog')
39
39
  rdoc.rdoc_files.include('lib/**/*.rb')
40
40
  end
41
-
@@ -8,12 +8,12 @@ Gem::Specification.new do |gem|
8
8
  gem.email = ['m@absolight.fr']
9
9
  gem.description = 'SecDNS EPP client library.'
10
10
  gem.summary = 'SecDNS EPP client library'
11
- gem.homepage = "https://github.com/Absolight/epp-client"
11
+ gem.homepage = 'https://github.com/Absolight/epp-client'
12
12
 
13
13
  gem.required_ruby_version = '>= 1.8.7'
14
- gem.required_rubygems_version = ">= 1.3.6"
14
+ gem.required_rubygems_version = '>= 1.3.6'
15
15
 
16
- gem.files = [
16
+ gem.files = [
17
17
  'ChangeLog',
18
18
  'Gemfile',
19
19
  'MIT-LICENSE',
@@ -30,7 +30,7 @@ Gem::Specification.new do |gem|
30
30
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
31
31
  gem.require_paths = ['lib']
32
32
 
33
- gem.add_development_dependency "bundler", ">= 1.0.0"
33
+ gem.add_development_dependency 'bundler', '>= 1.0.0'
34
34
  gem.add_dependency('nokogiri', '~> 1.4')
35
35
  gem.add_dependency('builder', '>= 2.1.2')
36
36
  end
@@ -1,10 +1,11 @@
1
1
  module EPPClient
2
+ # This implements the DNSSEC bits.
2
3
  module SecDNS
3
- SCHEMAS_SECDNS = %w[
4
+ SCHEMAS_SECDNS = %w(
4
5
  secDNS-1.1
5
- ]
6
+ ).freeze
6
7
 
7
- EPPClient::SCHEMAS_URL.merge!(SCHEMAS_SECDNS.inject({}) do |a,s|
8
+ EPPClient::SCHEMAS_URL.merge!(SCHEMAS_SECDNS.inject({}) do |a, s|
8
9
  a[s.sub(/-1\.1$/, '')] = "urn:ietf:params:xml:ns:#{s}" if s =~ /-1\.1$/
9
10
  a[s] = "urn:ietf:params:xml:ns:#{s}"
10
11
  a
@@ -65,16 +66,16 @@ module EPPClient
65
66
  ret = super
66
67
  ret_secdns = {}
67
68
  if (maxSigLife = xml.xpath('epp:extension/secDNS:infData/secDNS:maxSigLife', EPPClient::SCHEMAS_URL)).size > 0
68
- ret_secdns[:maxSigLife] = maxSigLife.text
69
+ ret_secdns[:maxSigLife] = maxSigLife.text
69
70
  end
70
71
  ret_secdns[:dsData] = xml.xpath('epp:extension/secDNS:infData/secDNS:dsData', EPPClient::SCHEMAS_URL).map do |s|
71
- parse_ds_data(s)
72
+ parse_ds_data(s)
72
73
  end
73
74
  ret_secdns[:keyData] = xml.xpath('epp:extension/secDNS:infData/secDNS:keyData', EPPClient::SCHEMAS_URL).map do |s|
74
- parse_key_data(s)
75
+ parse_key_data(s)
75
76
  end
76
77
 
77
- ret[:secDNS] = ret_secdns unless ret_secdns.values.reject {|v| v.nil?}.size == 0
78
+ ret[:secDNS] = ret_secdns unless ret_secdns.values.count(&:nil?) == 0
78
79
  ret
79
80
  end
80
81
 
@@ -97,27 +98,24 @@ module EPPClient
97
98
  def domain_create_xml(domain) #:nodoc:
98
99
  ret = super
99
100
 
100
- if domain.key?(:maxSigLife) || domain.key?(:dsData) || domain.key?(:keyData)
101
- ext = extension do |xml|
102
- xml.create( :xmlns => EPPClient::SCHEMAS_URL['secDNS']) do
103
- if domain.key?(:maxSigLife)
104
- xml.maxSigLife(domain[:maxSigLife])
105
- end
106
- if domain.key?(:dsData)
107
- domain[:dsData].each do |ds|
108
- make_ds_data(xml, ds)
109
- end
110
- elsif domain.key?(:keyData)
111
- domain[:keyData].each do |key|
112
- make_key_data(xml, key)
113
- end
114
- end
115
- end
116
- end
117
- return insert_extension(ret, ext)
118
- else
119
- return ret
101
+ return ret unless domain.key?(:maxSigLife) || domain.key?(:dsData) || domain.key?(:keyData)
102
+
103
+ ext = extension do |xml|
104
+ xml.create(:xmlns => EPPClient::SCHEMAS_URL['secDNS']) do
105
+ xml.maxSigLife(domain[:maxSigLife]) if domain.key?(:maxSigLife)
106
+ if domain.key?(:dsData)
107
+ domain[:dsData].each do |ds|
108
+ make_ds_data(xml, ds)
109
+ end
110
+ elsif domain.key?(:keyData)
111
+ domain[:keyData].each do |key|
112
+ make_key_data(xml, key)
113
+ end
114
+ end
115
+ end
120
116
  end
117
+
118
+ insert_extension(ret, ext)
121
119
  end
122
120
 
123
121
  # Extends the EPPClient::Domain#domain_update so that secDNS informations
@@ -156,89 +154,92 @@ module EPPClient
156
154
  def domain_update_xml(domain) #:nodoc:
157
155
  ret = super
158
156
 
159
- if domain.key?(:secDNS)
160
- sd = domain[:secDNS]
161
- ext = extension do |xml|
162
- xml.update(sd[:urgent] == true ? {:urgent => true}: {}, {:xmlns => EPPClient::SCHEMAS_URL['secDNS']}) do
163
- if sd.key?(:rem)
164
- xml.rem do
165
- if sd[:rem].key?(:all) && sd[:rem][:all] == true
166
- xml.all true
167
- elsif sd[:rem].key?(:dsData)
168
- sd[:rem][:dsData].each do |ds|
169
- make_ds_data(xml, ds)
170
- end
171
- elsif sd[:rem].key?(:keyData)
172
- sd[:rem][:keyData].each do |key|
173
- make_key_data(xml, key)
174
- end
175
- end
176
- end
177
- end
178
- if sd.key?(:add)
179
- xml.add do
180
- if sd[:add].key?(:dsData)
181
- sd[:add][:dsData].each do |ds|
182
- make_ds_data(xml, ds)
183
- end
184
- elsif sd[:add].key?(:keyData)
185
- sd[:add][:keyData].each do |key|
186
- make_key_data(xml, key)
187
- end
188
- end
189
- end
190
- end
191
- if sd.key?(:chg) && sd[:chg].key?(:maxSigLife)
192
- xml.chg do
193
- xml.maxSigLife sd[:chg][:maxSigLife]
194
- end
195
- end
196
- end
197
- end
198
- return insert_extension(ret, ext)
199
- else
200
- return ret
157
+ return ret unless domain.key?(:secDNS)
158
+
159
+ sd = domain[:secDNS]
160
+
161
+ ext = extension do |xml|
162
+ xml.update(sd[:urgent] == true ? { :urgent => true } : {}, :xmlns => EPPClient::SCHEMAS_URL['secDNS']) do
163
+ if sd.key?(:rem)
164
+ xml.rem do
165
+ if sd[:rem].key?(:all) && sd[:rem][:all] == true
166
+ xml.all true
167
+ elsif sd[:rem].key?(:dsData)
168
+ sd[:rem][:dsData].each do |ds|
169
+ make_ds_data(xml, ds)
170
+ end
171
+ elsif sd[:rem].key?(:keyData)
172
+ sd[:rem][:keyData].each do |key|
173
+ make_key_data(xml, key)
174
+ end
175
+ end
176
+ end
177
+ end
178
+ if sd.key?(:add)
179
+ xml.add do
180
+ if sd[:add].key?(:dsData)
181
+ sd[:add][:dsData].each do |ds|
182
+ make_ds_data(xml, ds)
183
+ end
184
+ elsif sd[:add].key?(:keyData)
185
+ sd[:add][:keyData].each do |key|
186
+ make_key_data(xml, key)
187
+ end
188
+ end
189
+ end
190
+ end
191
+ if sd.key?(:chg) && sd[:chg].key?(:maxSigLife)
192
+ xml.chg do
193
+ xml.maxSigLife sd[:chg][:maxSigLife]
194
+ end
195
+ end
196
+ end
201
197
  end
198
+
199
+ insert_extension(ret, ext)
202
200
  end
203
201
 
204
202
  private
203
+
205
204
  def make_key_data(xml, key)
206
205
  xml.keyData do
207
- xml.flags key[:flags]
208
- xml.protocol key[:protocol]
209
- xml.alg key[:alg]
210
- xml.pubKey key[:pubKey]
206
+ xml.flags key[:flags]
207
+ xml.protocol key[:protocol]
208
+ xml.alg key[:alg]
209
+ xml.pubKey key[:pubKey]
211
210
  end
212
211
  end
212
+
213
213
  def make_ds_data(xml, ds)
214
214
  xml.dsData do
215
- xml.keyTag ds[:keyTag]
216
- xml.alg ds[:alg]
217
- xml.digestType ds[:digestType]
218
- xml.digest ds[:digest]
219
- make_key_data(xml, ds[:keyData]) if ds.key?(:keyData)
215
+ xml.keyTag ds[:keyTag]
216
+ xml.alg ds[:alg]
217
+ xml.digestType ds[:digestType]
218
+ xml.digest ds[:digest]
219
+ make_key_data(xml, ds[:keyData]) if ds.key?(:keyData)
220
220
  end
221
221
  end
222
+
222
223
  def parse_key_data(xml)
223
224
  {
224
- :flags => xml.xpath("secDNS:flags", EPPClient::SCHEMAS_URL).text.to_i,
225
- :protocol => xml.xpath("secDNS:protocol", EPPClient::SCHEMAS_URL).text.to_i,
226
- :alg => xml.xpath("secDNS:alg", EPPClient::SCHEMAS_URL).text.to_i,
227
- :pubKey => xml.xpath("secDNS:pubKey", EPPClient::SCHEMAS_URL).text,
225
+ :flags => xml.xpath('secDNS:flags', EPPClient::SCHEMAS_URL).text.to_i,
226
+ :protocol => xml.xpath('secDNS:protocol', EPPClient::SCHEMAS_URL).text.to_i,
227
+ :alg => xml.xpath('secDNS:alg', EPPClient::SCHEMAS_URL).text.to_i,
228
+ :pubKey => xml.xpath('secDNS:pubKey', EPPClient::SCHEMAS_URL).text,
228
229
  }
229
230
  end
231
+
230
232
  def parse_ds_data(xml)
231
233
  ret = {
232
- :keyTag => xml.xpath("secDNS:keyTag", EPPClient::SCHEMAS_URL).text.to_i,
233
- :alg => xml.xpath("secDNS:alg", EPPClient::SCHEMAS_URL).text.to_i,
234
- :digestType => xml.xpath("secDNS:digestType", EPPClient::SCHEMAS_URL).text.to_i,
235
- :digest => xml.xpath("secDNS:digest", EPPClient::SCHEMAS_URL).text
234
+ :keyTag => xml.xpath('secDNS:keyTag', EPPClient::SCHEMAS_URL).text.to_i,
235
+ :alg => xml.xpath('secDNS:alg', EPPClient::SCHEMAS_URL).text.to_i,
236
+ :digestType => xml.xpath('secDNS:digestType', EPPClient::SCHEMAS_URL).text.to_i,
237
+ :digest => xml.xpath('secDNS:digest', EPPClient::SCHEMAS_URL).text,
236
238
  }
237
239
  if (keyData = xml.xpath('secDNS:keyData', EPPClient::SCHEMAS_URL)).size > 0
238
- ret[:keyData] = parse_key_data(keyData)
240
+ ret[:keyData] = parse_key_data(keyData)
239
241
  end
240
242
  ret
241
243
  end
242
-
243
244
  end
244
245
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epp-client-secdns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathieu Arnold
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2016-02-10 00:00:00 Z
12
+ date: 2016-02-17 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler