Class: Epics::GenericRequest
- Inherits:
-
Object
- Object
- Epics::GenericRequest
show all
- Extended by:
- Forwardable
- Defined in:
- lib/epics/generic_request.rb
Direct Known Subclasses
C52, C53, C54, CDZ, CRZ, GenericUploadRequest, HAA, HAC, HIA, HKD, HPB, HPD, HTD, INI, PTK, STA, VMK, Z52, Z53, Z54
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of GenericRequest.
6
7
8
|
# File 'lib/epics/generic_request.rb', line 6
def initialize(client)
self.client = client
end
|
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
3
4
5
|
# File 'lib/epics/generic_request.rb', line 3
def client
@client
end
|
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
4
5
6
|
# File 'lib/epics/generic_request.rb', line 4
def transaction_id
@transaction_id
end
|
Instance Method Details
#auth_signature ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/epics/generic_request.rb', line 30
def auth_signature
Nokogiri::XML::Builder.new do |xml|
xml.AuthSignature{
xml.send('ds:SignedInfo') {
xml.send('ds:CanonicalizationMethod', '', Algorithm: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315")
xml.send('ds:SignatureMethod', '', Algorithm: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256")
xml.send('ds:Reference', '', URI: "#xpointer(//*[@authenticate='true'])") {
xml.send('ds:Transforms') {
xml.send('ds:Transform', '', Algorithm: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315")
}
xml.send('ds:DigestMethod', '', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
xml.send('ds:DigestValue', '')
}
}
xml.send('ds:SignatureValue', '')
}
end.doc.root
end
|
#body ⇒ Object
24
25
26
27
28
|
# File 'lib/epics/generic_request.rb', line 24
def body
Nokogiri::XML::Builder.new do |xml|
xml.body
end.doc.root
end
|
#nonce ⇒ Object
10
11
12
|
# File 'lib/epics/generic_request.rb', line 10
def nonce
SecureRandom.hex(16)
end
|
#root ⇒ Object
20
21
22
|
# File 'lib/epics/generic_request.rb', line 20
def root
"ebicsRequest"
end
|
#timestamp ⇒ Object
14
15
16
|
# File 'lib/epics/generic_request.rb', line 14
def timestamp
Time.now.utc.iso8601
end
|
#to_receipt_xml ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/epics/generic_request.rb', line 72
def to_receipt_xml
Nokogiri::XML::Builder.new do |xml|
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => 'urn:org:ebics:H004', 'Version' => 'H004', 'Revision' => '1') {
xml.(authenticate: true) {
xml.static {
xml.HostID host_id
xml.TransactionID(transaction_id)
}
xml.mutable {
xml.TransactionPhase 'Receipt'
}
}
xml.parent.add_child(auth_signature)
xml.body {
xml.TransferReceipt(authenticate: true) {
xml.ReceiptCode 0
}
}
}
end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML, encoding: 'utf-8')
end
|
#to_transfer_xml ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/epics/generic_request.rb', line 49
def to_transfer_xml
Nokogiri::XML::Builder.new do |xml|
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => 'urn:org:ebics:H004', 'Version' => 'H004', 'Revision' => '1') {
xml.(authenticate: true) {
xml.static {
xml.HostID host_id
xml.TransactionID transaction_id
}
xml.mutable {
xml.TransactionPhase 'Transfer'
xml.SegmentNumber(1, lastSegment: true)
}
}
xml.parent.add_child(auth_signature)
xml.body {
xml.DataTransfer {
xml.OrderData encrypted_order_data
}
}
}
end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML, encoding: 'utf-8')
end
|
#to_xml ⇒ Object
94
95
96
97
98
99
100
101
102
|
# File 'lib/epics/generic_request.rb', line 94
def to_xml
Nokogiri::XML::Builder.new do |xml|
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => 'urn:org:ebics:H004', 'Version' => 'H004', 'Revision'=> '1') {
xml.parent.add_child()
xml.parent.add_child(auth_signature)
xml.parent.add_child(body)
}
end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML, encoding: 'utf-8')
end
|