Skip to content

Commit

Permalink
Improves root tag attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
jplot committed Sep 26, 2024
1 parent 41c1d83 commit ddcff85
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 7 deletions.
9 changes: 9 additions & 0 deletions lib/epics/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ def urn_schema
end
end

def schema_location
case version
when VERSION_H3
"#{urn_schema} http://www.ebics.org/#{version}/ebics_request.xsd"
when VERSION_H4, VERSION_H5
"#{urn_schema} ebics_keymgmt_request_#{version}.xsd"
end
end

def inspect
"#<#{self.class}:#{self.object_id}
@keys=#{self.keys.keys},
Expand Down
27 changes: 24 additions & 3 deletions lib/epics/generic_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ def auth_signature

def to_transfer_xml
Nokogiri::XML::Builder.new do |xml|
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => client.urn_schema, 'Version' => client.version, 'Revision' => '1') {
xml.send(root,
'xmlns' => client.urn_schema,
'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => client.schema_location,
'Version' => client.version,
'Revision' => '1'
) {
xml.header(authenticate: true) {
xml.static {
xml.HostID host_id
Expand All @@ -76,7 +83,14 @@ def to_transfer_xml

def to_receipt_xml
Nokogiri::XML::Builder.new do |xml|
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => client.urn_schema, 'Version' => client.version, 'Revision' => '1') {
xml.send(root,
'xmlns' => client.urn_schema,
'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => client.schema_location,
'Version' => client.version,
'Revision' => '1'
) {
xml.header(authenticate: true) {
xml.static {
xml.HostID host_id
Expand All @@ -98,7 +112,14 @@ def to_receipt_xml

def to_xml
Nokogiri::XML::Builder.new do |xml|
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => client.urn_schema, 'Version' => client.version, 'Revision'=> '1') {
xml.send(root,
'xmlns' => client.urn_schema,
'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => client.schema_location,
'Version' => client.version,
'Revision'=> '1'
) {
xml.parent.add_child(header)
xml.parent.add_child(auth_signature)
xml.parent.add_child(body)
Expand Down
14 changes: 12 additions & 2 deletions lib/epics/hia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def body

def order_data
Nokogiri::XML::Builder.new do |xml|
xml.HIARequestOrderData('xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => client.urn_schema) {
xml.HIARequestOrderData(
'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
'xmlns' => client.urn_schema
) {
xml.AuthenticationPubKeyInfo {
xml.PubKeyValue {
xml.send('ds:RSAKeyValue') {
Expand All @@ -51,7 +54,14 @@ def order_data

def to_xml
Nokogiri::XML::Builder.new do |xml|
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => client.urn_schema, 'Version' => client.version, 'Revision' => '1') {
xml.send(root,
'xmlns' => client.urn_schema,
'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => client.schema_location,
'Version' => client.version,
'Revision' => '1'
) {
xml.parent.add_child(header)
xml.parent.add_child(body)
}
Expand Down
15 changes: 13 additions & 2 deletions lib/epics/ini.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def body

def key_signature
Nokogiri::XML::Builder.new do |xml|
xml.SignaturePubKeyOrderData('xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => 'http://www.ebics.org/S001') {
xml.SignaturePubKeyOrderData(
'xmlns' => 'http://www.ebics.org/S001',
'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
'xsi:schemaLocation' => 'http://www.ebics.org/S001 http://www.ebics.org/S001/ebics_signature.xsd'
) {
xml.SignaturePubKeyInfo {
xml.PubKeyValue {
xml.send('ds:RSAKeyValue') {
Expand All @@ -43,7 +47,14 @@ def key_signature

def to_xml
Nokogiri::XML::Builder.new do |xml|
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => client.urn_schema, 'Version' => client.version, 'Revision' => '1') {
xml.send(root,
'xmlns' => client.urn_schema,
'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => client.schema_location,
'Version' => client.version,
'Revision' => '1'
) {
xml.parent.add_child(header)
xml.parent.add_child(body)
}
Expand Down

0 comments on commit ddcff85

Please sign in to comment.