epics 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.semaphore/semaphore.yml +3 -12
  3. data/CHANGELOG.md +9 -0
  4. data/epics.gemspec +5 -4
  5. data/lib/epics/azv.rb +9 -26
  6. data/lib/epics/b2b.rb +11 -3
  7. data/lib/epics/c2s.rb +11 -7
  8. data/lib/epics/c52.rb +12 -37
  9. data/lib/epics/c53.rb +12 -37
  10. data/lib/epics/c54.rb +12 -37
  11. data/lib/epics/c5n.rb +17 -0
  12. data/lib/epics/ccs.rb +11 -7
  13. data/lib/epics/cct.rb +9 -34
  14. data/lib/epics/cd1.rb +9 -26
  15. data/lib/epics/cdb.rb +9 -34
  16. data/lib/epics/cdd.rb +9 -34
  17. data/lib/epics/cds.rb +11 -7
  18. data/lib/epics/cdz.rb +12 -41
  19. data/lib/epics/client.rb +36 -19
  20. data/lib/epics/crz.rb +12 -41
  21. data/lib/epics/generic_request.rb +8 -3
  22. data/lib/epics/generic_upload_request.rb +2 -2
  23. data/lib/epics/haa.rb +8 -25
  24. data/lib/epics/hac.rb +12 -41
  25. data/lib/epics/header_request.rb +60 -0
  26. data/lib/epics/hia.rb +6 -16
  27. data/lib/epics/hkd.rb +8 -25
  28. data/lib/epics/hpb.rb +8 -18
  29. data/lib/epics/hpd.rb +8 -25
  30. data/lib/epics/htd.rb +8 -25
  31. data/lib/epics/ini.rb +6 -16
  32. data/lib/epics/letter_renderer.rb +22 -0
  33. data/lib/epics/ptk.rb +12 -41
  34. data/lib/epics/sta.rb +12 -41
  35. data/lib/epics/version.rb +1 -1
  36. data/lib/epics/vmk.rb +12 -41
  37. data/lib/epics/wss.rb +13 -0
  38. data/lib/epics/xct.rb +9 -26
  39. data/lib/epics/xds.rb +11 -3
  40. data/lib/epics/xe2.rb +11 -3
  41. data/lib/epics/xe3.rb +11 -3
  42. data/lib/epics/z52.rb +12 -37
  43. data/lib/epics/z53.rb +12 -37
  44. data/lib/epics/z54.rb +12 -37
  45. data/lib/epics.rb +7 -0
  46. data/lib/letter/ini.erb +260 -150
  47. data/lib/letter/locales/de.yml +19 -0
  48. data/lib/letter/locales/en.yml +19 -0
  49. data/lib/letter/locales/fr.yml +19 -0
  50. data/spec/hpb_spec.rb +4 -4
  51. data/spec/orders/c52_spec.rb +1 -1
  52. data/spec/orders/c53_spec.rb +1 -1
  53. data/spec/orders/c54_spec.rb +1 -1
  54. data/spec/orders/c5n_spec.rb +9 -0
  55. data/spec/orders/cdz_spec.rb +1 -1
  56. data/spec/orders/crz_spec.rb +1 -1
  57. data/spec/orders/hac_spec.rb +1 -1
  58. data/spec/orders/ptk_spec.rb +1 -1
  59. data/spec/orders/sta_spec.rb +1 -1
  60. data/spec/orders/vmk_spec.rb +1 -1
  61. data/spec/orders/wss_spec.rb +9 -0
  62. data/spec/orders/z52_spec.rb +1 -1
  63. data/spec/orders/z53_spec.rb +1 -1
  64. data/spec/orders/z54_spec.rb +1 -1
  65. metadata +35 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cb98bb83470739103b20941fc4a5f636f57752d90941aa0ba9ac9e7c111503f
4
- data.tar.gz: 134ef14259b6e5728677f45dd21446fc642f8eca7c6641e7befd537936c406b6
3
+ metadata.gz: 7d2540241c26353b2e1134bfed820618ed1b8470790c66985cade8d306d49b3a
4
+ data.tar.gz: 6ece5e86fc70adecc140b5ed64d9d0e47c2d3c86619d5b20e9fd615bc33ded65
5
5
  SHA512:
6
- metadata.gz: 55ba0cecabed4d9397643b0fc7116c3675dc5bdc4d076e8599812338503061fb15521164b7ee02ce42cf7aa778fa3694c6ca0d0358dcbc2684cbffdfb9888374
7
- data.tar.gz: 1df6989cdc96ee6e68069a34bdd6496e8a739b9665ab1c68f1533dd247664a67452e0157c3b1ea6eb84e66868e7e94094c344229b598a7de862d702e46b99e86
6
+ metadata.gz: cead2ddb91fe295b3e6a7b25723d5eb6810f836c0e74cfb3f33e1717a9d023192d289706fb84ba01897a80a6c7420dca3ab767a5d5cdc897d74612b717e86199
7
+ data.tar.gz: 57a8513a4d9b6a373d8158e231779566363966a8ac6cc058a8151c6b70d905719bee7c4fa139c46d450e724da8cd372d93e68b96f45b87d21a249dbfbacdb41a
@@ -16,21 +16,12 @@ blocks:
16
16
  - name: Spec versions
17
17
  task:
18
18
  jobs:
19
- - name: "3.0"
20
- commands:
21
- - checkout
22
- - sem-version ruby 3.0
23
- - cache restore
24
- - gem install bundler:2.4.22
25
- - bundle install
26
- - cache store
27
- - bundle exec rspec
28
19
  - name: "3.1"
29
20
  commands:
30
21
  - checkout
31
22
  - sem-version ruby 3.1
32
23
  - cache restore
33
- - gem install bundler:2.4.22
24
+ - gem install bundler:2.5.19
34
25
  - bundle install
35
26
  - cache store
36
27
  - bundle exec rspec
@@ -39,7 +30,7 @@ blocks:
39
30
  - checkout
40
31
  - sem-version ruby 3.2
41
32
  - cache restore
42
- - gem install bundler:2.4.22
33
+ - gem install bundler:2.5.19
43
34
  - bundle install
44
35
  - cache store
45
36
  - bundle exec rspec
@@ -48,7 +39,7 @@ blocks:
48
39
  - checkout
49
40
  - sem-version ruby 3.3
50
41
  - cache restore
51
- - gem install bundler:2.4.22
42
+ - gem install bundler:2.5.19
52
43
  - bundle install
53
44
  - cache store
54
45
  - bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 2.5.0
4
+
5
+ - [HOUSEKEEPING] Bump XML dependency requirements to more recent versions
6
+ - [HOUSEKEEPING] Bump bundler version to 2.5.19
7
+ - [HOUSEKEEPING] Bump ruby required version from 2.7 to 3.1
8
+ - [ENHANCEMENT] Request Header generation more generalized (thanks to @jplot)
9
+ - [ENHANCEMENT] Multi language support for initialization letter (thanks to @jplot)
10
+ - [ENHANVEMENT] Added support for WSS and C5N order types (thanks to @kostja93)
11
+
3
12
  ### 2.4.0
4
13
 
5
14
  - [ENHANCEMENT] Adds XE2 and XE3 order type (CCT and CDD for swiss banks)
data/epics.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.homepage = 'https://github.com/railslove/epics'
27
27
  spec.license = 'LGPL-3.0'
28
28
 
29
- spec.required_ruby_version = '>= 2.7'
29
+ spec.required_ruby_version = '>= 3.1'
30
30
 
31
31
  spec.files = `git ls-files -z`.split("\x0")
32
32
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -41,11 +41,12 @@ Gem::Specification.new do |spec|
41
41
  spec.post_install_message += "\e[32m" + ('*' * 60) + "\n\e[0m"
42
42
 
43
43
  spec.add_dependency 'faraday', '>= 1.10.0'
44
- spec.add_dependency 'nokogiri', '>= 1.16.5'
44
+ spec.add_dependency 'i18n', '>= 1.1.0'
45
+ spec.add_dependency 'nokogiri', '>= 1.16.7'
45
46
  spec.add_dependency 'rubyzip', '>= 2.3.2'
46
- spec.add_dependency 'rexml', '>= 3.2.8'
47
+ spec.add_dependency 'rexml', '>= 3.3.7'
47
48
 
48
- spec.add_development_dependency 'bundler', '>= 2.4.12'
49
+ spec.add_development_dependency 'bundler', '>= 2.5.19'
49
50
  spec.add_development_dependency 'equivalent-xml'
50
51
  spec.add_development_dependency 'pry'
51
52
  spec.add_development_dependency 'rake', '~> 13.0'
data/lib/epics/azv.rb CHANGED
@@ -1,30 +1,13 @@
1
1
  class Epics::AZV < Epics::GenericUploadRequest
2
2
  def header
3
- Nokogiri::XML::Builder.new do |xml|
4
- xml.header(authenticate: true) {
5
- xml.static {
6
- xml.HostID host_id
7
- xml.Nonce nonce
8
- xml.Timestamp timestamp
9
- xml.PartnerID partner_id
10
- xml.UserID user_id
11
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
12
- xml.OrderDetails {
13
- xml.OrderType 'CD1'
14
- xml.OrderAttribute 'OZHNN'
15
- xml.StandardOrderParams
16
- }
17
- xml.BankPubKeyDigests {
18
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
19
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
20
- }
21
- xml.SecurityMedium '0000'
22
- xml.NumSegments 1
23
- }
24
- xml.mutable {
25
- xml.TransactionPhase 'Initialisation'
26
- }
27
- }
28
- end.doc.root
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'CD1',
7
+ order_attribute: 'OZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
29
12
  end
30
13
  end
data/lib/epics/b2b.rb CHANGED
@@ -1,5 +1,13 @@
1
- class Epics::B2B < Epics::CDD
2
- def order_type
3
- 'B2B'
1
+ class Epics::B2B < Epics::GenericUploadRequest
2
+ def header
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'B2B',
7
+ order_attribute: 'OZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
4
12
  end
5
13
  end
data/lib/epics/c2s.rb CHANGED
@@ -1,9 +1,13 @@
1
- class Epics::C2S < Epics::CDB
2
- def order_attribute
3
- "DZHNN"
4
- end
5
-
6
- def order_type
7
- 'C2S'
1
+ class Epics::C2S < Epics::GenericUploadRequest
2
+ def header
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'C2S',
7
+ order_attribute: 'DZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
8
12
  end
9
13
  end
data/lib/epics/c52.rb CHANGED
@@ -1,42 +1,17 @@
1
1
  class Epics::C52 < Epics::GenericRequest
2
- attr_accessor :from, :to
3
-
4
- def initialize(client, from, to)
5
- super(client)
6
- self.from = from
7
- self.to = to
8
- end
9
-
10
2
  def header
11
- Nokogiri::XML::Builder.new do |xml|
12
- xml.header(authenticate: true) {
13
- xml.static {
14
- xml.HostID host_id
15
- xml.Nonce nonce
16
- xml.Timestamp timestamp
17
- xml.PartnerID partner_id
18
- xml.UserID user_id
19
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
20
- xml.OrderDetails {
21
- xml.OrderType 'C52'
22
- xml.OrderAttribute 'DZHNN'
23
- xml.StandardOrderParams {
24
- xml.DateRange {
25
- xml.Start from
26
- xml.End to
27
- }
28
- }
29
- }
30
- xml.BankPubKeyDigests {
31
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
32
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
33
- }
34
- xml.SecurityMedium '0000'
35
- }
36
- xml.mutable {
37
- xml.TransactionPhase 'Initialisation'
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'C52',
7
+ order_attribute: 'DZHNN',
8
+ order_params: {
9
+ DateRange: {
10
+ Start: options[:from],
11
+ End: options[:to]
38
12
  }
39
- }
40
- end.doc.root
13
+ },
14
+ mutable: { TransactionPhase: 'Initialisation' }
15
+ )
41
16
  end
42
17
  end
data/lib/epics/c53.rb CHANGED
@@ -1,42 +1,17 @@
1
1
  class Epics::C53 < Epics::GenericRequest
2
- attr_accessor :from, :to
3
-
4
- def initialize(client, from, to)
5
- super(client)
6
- self.from = from
7
- self.to = to
8
- end
9
-
10
2
  def header
11
- Nokogiri::XML::Builder.new do |xml|
12
- xml.header(authenticate: true) {
13
- xml.static {
14
- xml.HostID host_id
15
- xml.Nonce nonce
16
- xml.Timestamp timestamp
17
- xml.PartnerID partner_id
18
- xml.UserID user_id
19
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
20
- xml.OrderDetails {
21
- xml.OrderType 'C53'
22
- xml.OrderAttribute 'DZHNN'
23
- xml.StandardOrderParams {
24
- xml.DateRange {
25
- xml.Start from
26
- xml.End to
27
- }
28
- }
29
- }
30
- xml.BankPubKeyDigests {
31
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
32
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
33
- }
34
- xml.SecurityMedium '0000'
35
- }
36
- xml.mutable {
37
- xml.TransactionPhase 'Initialisation'
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'C53',
7
+ order_attribute: 'DZHNN',
8
+ order_params: {
9
+ DateRange: {
10
+ Start: options[:from],
11
+ End: options[:to]
38
12
  }
39
- }
40
- end.doc.root
13
+ },
14
+ mutable: { TransactionPhase: 'Initialisation' }
15
+ )
41
16
  end
42
17
  end
data/lib/epics/c54.rb CHANGED
@@ -1,42 +1,17 @@
1
1
  class Epics::C54 < Epics::GenericRequest
2
- attr_accessor :from, :to
3
-
4
- def initialize(client, from, to)
5
- super(client)
6
- self.from = from
7
- self.to = to
8
- end
9
-
10
2
  def header
11
- Nokogiri::XML::Builder.new do |xml|
12
- xml.header(authenticate: true) {
13
- xml.static {
14
- xml.HostID host_id
15
- xml.Nonce nonce
16
- xml.Timestamp timestamp
17
- xml.PartnerID partner_id
18
- xml.UserID user_id
19
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
20
- xml.OrderDetails {
21
- xml.OrderType 'C54'
22
- xml.OrderAttribute 'DZHNN'
23
- xml.StandardOrderParams {
24
- xml.DateRange {
25
- xml.Start from
26
- xml.End to
27
- }
28
- }
29
- }
30
- xml.BankPubKeyDigests {
31
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
32
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
33
- }
34
- xml.SecurityMedium '0000'
35
- }
36
- xml.mutable {
37
- xml.TransactionPhase 'Initialisation'
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'C54',
7
+ order_attribute: 'DZHNN',
8
+ order_params: {
9
+ DateRange: {
10
+ Start: options[:from],
11
+ End: options[:to]
38
12
  }
39
- }
40
- end.doc.root
13
+ },
14
+ mutable: { TransactionPhase: 'Initialisation' }
15
+ )
41
16
  end
42
17
  end
data/lib/epics/c5n.rb ADDED
@@ -0,0 +1,17 @@
1
+ class Epics::C5N < Epics::GenericRequest
2
+ def header
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'C5N',
7
+ order_attribute: 'DZHNN',
8
+ order_params: {
9
+ DateRange: {
10
+ Start: options[:from],
11
+ End: options[:to]
12
+ }
13
+ },
14
+ mutable: { TransactionPhase: 'Initialisation' }
15
+ )
16
+ end
17
+ end
data/lib/epics/ccs.rb CHANGED
@@ -1,9 +1,13 @@
1
- class Epics::CCS < Epics::CCT
2
- def order_attribute
3
- 'DZHNN'
4
- end
5
-
6
- def order_type
7
- 'CCS'
1
+ class Epics::CCS < Epics::GenericUploadRequest
2
+ def header
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'CCS',
7
+ order_attribute: 'DZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
8
12
  end
9
13
  end
data/lib/epics/cct.rb CHANGED
@@ -1,38 +1,13 @@
1
1
  class Epics::CCT < Epics::GenericUploadRequest
2
- def order_attribute
3
- 'OZHNN'
4
- end
5
-
6
- def order_type
7
- 'CCT'
8
- end
9
-
10
2
  def header
11
- Nokogiri::XML::Builder.new do |xml|
12
- xml.header(authenticate: true) {
13
- xml.static {
14
- xml.HostID host_id
15
- xml.Nonce nonce
16
- xml.Timestamp timestamp
17
- xml.PartnerID partner_id
18
- xml.UserID user_id
19
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
20
- xml.OrderDetails {
21
- xml.OrderType order_type
22
- xml.OrderAttribute order_attribute
23
- xml.StandardOrderParams
24
- }
25
- xml.BankPubKeyDigests {
26
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
27
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
28
- }
29
- xml.SecurityMedium '0000'
30
- xml.NumSegments 1
31
- }
32
- xml.mutable {
33
- xml.TransactionPhase 'Initialisation'
34
- }
35
- }
36
- end.doc.root
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'CCT',
7
+ order_attribute: 'OZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
37
12
  end
38
13
  end
data/lib/epics/cd1.rb CHANGED
@@ -1,30 +1,13 @@
1
1
  class Epics::CD1 < Epics::GenericUploadRequest
2
2
  def header
3
- Nokogiri::XML::Builder.new do |xml|
4
- xml.header(authenticate: true) {
5
- xml.static {
6
- xml.HostID host_id
7
- xml.Nonce nonce
8
- xml.Timestamp timestamp
9
- xml.PartnerID partner_id
10
- xml.UserID user_id
11
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
12
- xml.OrderDetails {
13
- xml.OrderType 'CD1'
14
- xml.OrderAttribute 'OZHNN'
15
- xml.StandardOrderParams
16
- }
17
- xml.BankPubKeyDigests {
18
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
19
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
20
- }
21
- xml.SecurityMedium '0000'
22
- xml.NumSegments 1
23
- }
24
- xml.mutable {
25
- xml.TransactionPhase 'Initialisation'
26
- }
27
- }
28
- end.doc.root
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'CD1',
7
+ order_attribute: 'OZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
29
12
  end
30
13
  end
data/lib/epics/cdb.rb CHANGED
@@ -1,38 +1,13 @@
1
1
  class Epics::CDB < Epics::GenericUploadRequest
2
- def order_attribute
3
- 'OZHNN'
4
- end
5
-
6
- def order_type
7
- 'CDB'
8
- end
9
-
10
2
  def header
11
- Nokogiri::XML::Builder.new do |xml|
12
- xml.header(authenticate: true) {
13
- xml.static {
14
- xml.HostID host_id
15
- xml.Nonce nonce
16
- xml.Timestamp timestamp
17
- xml.PartnerID partner_id
18
- xml.UserID user_id
19
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
20
- xml.OrderDetails {
21
- xml.OrderType order_type
22
- xml.OrderAttribute order_attribute
23
- xml.StandardOrderParams
24
- }
25
- xml.BankPubKeyDigests {
26
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
27
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
28
- }
29
- xml.SecurityMedium '0000'
30
- xml.NumSegments 1
31
- }
32
- xml.mutable {
33
- xml.TransactionPhase 'Initialisation'
34
- }
35
- }
36
- end.doc.root
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'CDB',
7
+ order_attribute: 'OZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
37
12
  end
38
13
  end
data/lib/epics/cdd.rb CHANGED
@@ -1,38 +1,13 @@
1
1
  class Epics::CDD < Epics::GenericUploadRequest
2
- def order_attribute
3
- 'OZHNN'
4
- end
5
-
6
- def order_type
7
- 'CDD'
8
- end
9
-
10
2
  def header
11
- Nokogiri::XML::Builder.new do |xml|
12
- xml.header(authenticate: true) {
13
- xml.static {
14
- xml.HostID host_id
15
- xml.Nonce nonce
16
- xml.Timestamp timestamp
17
- xml.PartnerID partner_id
18
- xml.UserID user_id
19
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
20
- xml.OrderDetails {
21
- xml.OrderType order_type
22
- xml.OrderAttribute order_attribute
23
- xml.StandardOrderParams ''
24
- }
25
- xml.BankPubKeyDigests {
26
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
27
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
28
- }
29
- xml.SecurityMedium '0000'
30
- xml.NumSegments 1
31
- }
32
- xml.mutable {
33
- xml.TransactionPhase 'Initialisation'
34
- }
35
- }
36
- end.doc.root
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'CDD',
7
+ order_attribute: 'OZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
37
12
  end
38
13
  end
data/lib/epics/cds.rb CHANGED
@@ -1,9 +1,13 @@
1
- class Epics::CDS < Epics::CDD
2
- def order_attribute
3
- "DZHNN"
4
- end
5
-
6
- def order_type
7
- 'CDS'
1
+ class Epics::CDS < Epics::GenericUploadRequest
2
+ def header
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'CDS',
7
+ order_attribute: 'DZHNN',
8
+ order_params: {},
9
+ num_segments: 1,
10
+ mutable: { TransactionPhase: 'Initialisation' }
11
+ )
8
12
  end
9
13
  end
data/lib/epics/cdz.rb CHANGED
@@ -1,46 +1,17 @@
1
1
  class Epics::CDZ < Epics::GenericRequest
2
- attr_accessor :from, :to
3
-
4
- def initialize(client, from = nil, to = nil)
5
- super(client)
6
- self.from = from
7
- self.to = to
8
- end
9
-
10
2
  def header
11
- Nokogiri::XML::Builder.new do |xml|
12
- xml.header(authenticate: true) {
13
- xml.static {
14
- xml.HostID host_id
15
- xml.Nonce nonce
16
- xml.Timestamp timestamp
17
- xml.PartnerID partner_id
18
- xml.UserID user_id
19
- xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
20
- xml.OrderDetails {
21
- xml.OrderType 'CDZ'
22
- xml.OrderAttribute 'DZHNN'
23
- if !!from && !!to
24
- xml.StandardOrderParams {
25
- xml.DateRange {
26
- xml.Start from
27
- xml.End to
28
- }
29
- }
30
- else
31
- xml.StandardOrderParams
32
- end
33
- }
34
- xml.BankPubKeyDigests {
35
- xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
36
- xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
37
- }
38
- xml.SecurityMedium '0000'
39
- }
40
- xml.mutable {
41
- xml.TransactionPhase 'Initialisation'
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'CDZ',
7
+ order_attribute: 'DZHNN',
8
+ order_params: !!options[:from] && !!options[:to] ? {
9
+ DateRange: {
10
+ Start: options[:from],
11
+ End: options[:to]
42
12
  }
43
- }
44
- end.doc.root
13
+ } : {},
14
+ mutable: { TransactionPhase: 'Initialisation' }
15
+ )
45
16
  end
46
17
  end