epp-xml 0.8.1 → 0.8.2

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: 0affcb4ba624db32956fe64d97447a7bc2991112
4
- data.tar.gz: b5ba28d3204b826a1d1fe1b20458a147aee2d0c4
3
+ metadata.gz: a23536f18312c6ac888083f2a6f323ebf56f5618
4
+ data.tar.gz: bbad3eaadcc43b7b7e498c41c6030f41229f8d76
5
5
  SHA512:
6
- metadata.gz: 070bd7f04b7c83d0c21de1d87188fbc6ed2d68377521c7cd80f440f853de708b4d9f3da4e62fdab91fd5e72057f70d2dd5d89de3cdec054cabde2281bcd54728
7
- data.tar.gz: 3640147d7f9a1aef0ad70a017204bfe9dd0d27c1967d24e0c85dd423cfaa00146e515515def0c35d32342ae7e62fe83a3a44993f36ea1d1904e5570bb2e4cb7d
6
+ metadata.gz: 247a5c9e3d4097016bff74be2c4eabc680ee99109efac69fabde39d69da4870a91d164fed48249a2f57b90317ddc906c2ddce71494337a17fd9705373c6ef733
7
+ data.tar.gz: e8d745afee5e08b8e32fc24546d60f56ce0938532e40760bf22a8f653bff19f305f784eddd0ddcc7a042f6e66087ecb1787e3d74a2fbc3967604ee622511e9d1
@@ -31,7 +31,7 @@ module EppXmlCore
31
31
  EppXml.generate_xml_from_hash(xml_params, xml, 'contact:')
32
32
  end
33
33
  end
34
- xml.clTRID 'ABC-12345'
34
+ xml.clTRID("#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
35
35
  end
36
36
  end
37
37
  end
@@ -49,7 +49,7 @@ module EppXmlCore
49
49
  EppXml.generate_xml_from_hash(xml_params, xml, 'contact:')
50
50
  end
51
51
  end
52
- xml.clTRID 'ABC-12345'
52
+ xml.clTRID("#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
53
53
  end
54
54
  end
55
55
  end
@@ -32,7 +32,7 @@ module EppXmlCore
32
32
  EppXml.generate_xml_from_hash(dnssec_params, xml, 'secDNS:')
33
33
  end
34
34
  end if dnssec_params != false
35
- xml.clTRID 'ABC-12345'
35
+ xml.clTRID("#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
36
36
  end
37
37
  end
38
38
  end
@@ -54,7 +54,7 @@ module EppXmlCore
54
54
  EppXml.generate_xml_from_hash(dnssec_params, xml, 'secDNS:')
55
55
  end
56
56
  end if dnssec_params != false
57
- xml.clTRID 'ABC-12345'
57
+ xml.clTRID("#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
58
58
  end
59
59
  end
60
60
  end
@@ -70,7 +70,7 @@ module EppXmlCore
70
70
  EppXml.generate_xml_from_hash(xml_params, xml, 'domain:')
71
71
  end
72
72
  end
73
- xml.clTRID 'ABC-12345'
73
+ xml.clTRID("#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
74
74
  end
75
75
  end
76
76
  end
@@ -88,7 +88,7 @@ module EppXmlCore
88
88
  EppXml.generate_xml_from_hash(xml_params, xml, 'domain:')
89
89
  end
90
90
  end
91
- xml.clTRID 'ABC-12345'
91
+ xml.clTRID("#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
92
92
  end
93
93
  end
94
94
  end
@@ -28,7 +28,7 @@ module EppXmlCore
28
28
  end if xml_params[:expiry]
29
29
 
30
30
  end
31
- xml.tag!('ext:clTRID', 'ABC-12345')
31
+ xml.tag!('ext:clTRID', "#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
32
32
  end
33
33
  end
34
34
  end
@@ -29,7 +29,7 @@ module EppXmlCore
29
29
  xml.login do
30
30
  EppXml.generate_xml_from_hash(xml_params, xml)
31
31
  end
32
- xml.clTRID 'ABC-12345'
32
+ xml.clTRID("#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
33
33
  end
34
34
  end
35
35
  end
@@ -47,7 +47,7 @@ module EppXmlCore
47
47
  xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
48
48
  xml.command do
49
49
  EppXml.generate_xml_from_hash(xml_params, xml)
50
- xml.clTRID 'ABC-12345'
50
+ xml.clTRID("#{EppXml.cl_trid_prefix}#{Time.now.to_i}")
51
51
  end
52
52
  end
53
53
 
data/lib/epp-xml.rb CHANGED
@@ -22,29 +22,33 @@ module EppXml
22
22
  extend ::EppXmlCore::Keyrelay
23
23
  end
24
24
 
25
- def self.generate_xml_from_hash(xml_params, xml, ns = '')
26
- xml_params.each do |k, v|
27
- # Value is a hash which has string type value
28
- if v.is_a?(Hash) && v[:value].is_a?(String)
29
- xml.tag!("#{ns}#{k}", v[:value], v[:attrs])
30
- # Value is a hash which is nested
31
- elsif v.is_a?(Hash)
32
- attrs = v.delete(:attrs)
33
- value = v.delete(:value) || v
34
- xml.tag!("#{ns}#{k}", attrs) do
35
- generate_xml_from_hash(value, xml, ns)
36
- end
37
- # Value is an array
38
- elsif v.is_a?(Array)
39
- if k.to_s.start_with?('_')
40
- v.each do |x|
41
- generate_xml_from_hash(x, xml, ns)
25
+ class << self
26
+ attr_accessor :cl_trid_prefix
27
+
28
+ def generate_xml_from_hash(xml_params, xml, ns = '')
29
+ xml_params.each do |k, v|
30
+ # Value is a hash which has string type value
31
+ if v.is_a?(Hash) && v[:value].is_a?(String)
32
+ xml.tag!("#{ns}#{k}", v[:value], v[:attrs])
33
+ # Value is a hash which is nested
34
+ elsif v.is_a?(Hash)
35
+ attrs = v.delete(:attrs)
36
+ value = v.delete(:value) || v
37
+ xml.tag!("#{ns}#{k}", attrs) do
38
+ generate_xml_from_hash(value, xml, ns)
42
39
  end
43
- else
44
- xml.tag!("#{ns}#{k}") do
40
+ # Value is an array
41
+ elsif v.is_a?(Array)
42
+ if k.to_s.start_with?('_')
45
43
  v.each do |x|
46
44
  generate_xml_from_hash(x, xml, ns)
47
45
  end
46
+ else
47
+ xml.tag!("#{ns}#{k}") do
48
+ v.each do |x|
49
+ generate_xml_from_hash(x, xml, ns)
50
+ end
51
+ end
48
52
  end
49
53
  end
50
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epp-xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GiTLAB LTD