Commit 2e83f8c

mokha <mo@mokhan.ca>
2019-01-26 17:06:03
move keyinfo classes under key info
1 parent 9804264
Changed files (2)
lib
spec
lib/xml/kit/key_info.rb
@@ -2,27 +2,27 @@
 
 module Xml
   module Kit
-    class RSAKeyValue
-      attr_accessor :modulus, :exponent
-    end
+    class KeyInfo
+      class RSAKeyValue
+        attr_accessor :modulus, :exponent
+      end
 
-    class KeyValue
-      include Templatable
+      class KeyValue
+        include Templatable
 
-      def rsa
-        @rsa ||= RSAKeyValue.new
+        def rsa
+          @rsa ||= RSAKeyValue.new
+        end
       end
-    end
 
-    class RetrievalMethod
-      attr_accessor :uri, :type
+      class RetrievalMethod
+        attr_accessor :uri, :type
 
-      def initialize
-        @type = 'http://www.w3.org/2001/04/xmlenc#EncryptedKey'
+        def initialize
+          @type = "#{Namespaces::XMLENC}EncryptedKey"
+        end
       end
-    end
 
-    class KeyInfo
       include Templatable
       attr_accessor :key_name
       attr_accessor :x509_data
spec/xml/kit/soap_spec.rb
@@ -7,10 +7,6 @@ RSpec.describe Soap do
     let(:key_pair) { ::Xml::Kit::KeyPair.generate(use: :encryption) }
     let(:result) { Hash.from_xml(subject.to_xml) }
 
-    before do
-      puts subject.to_xml(pretty: true)
-    end
-
     specify { expect(result['Envelope']).to be_present }
     specify { expect(result['Envelope']['Header']).to be_present }
     specify do