czech_post_b2b_client 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 195b8ec3ce8eb8a50a8e930a2629917fb7a452d9
4
- data.tar.gz: b78e4f92cc14b98265ab6d595fa7c2011ec32208
3
+ metadata.gz: 7bfcab9012bcc1bdb68a40691d169192bbe563e3
4
+ data.tar.gz: f8ab6f6daca0ef901e640b855e1525125b2e113c
5
5
  SHA512:
6
- metadata.gz: 54ef2187484cf754ee7fd92f903e3252472da1d30af90927ee64af447bea861df97581342af4dfe9d7193a123bd1a4c2d4f35ea2253836eb74bd2b4c1d05092b
7
- data.tar.gz: b72195f63bb3153ae95473211f68756ea162599e4f617e7b77d5e93ca35b3eb5eb5bfc4fa83cdd496a4a4b7d2b8bece76eb8b255e3f77c4a4bbe16510e3dd510
6
+ metadata.gz: 7d70c14295933177860de0d4b9ed845f479f64e28469cb13416152337c9e367eb1fb75337fbc8a3303446355765efbd184f6dcef0ecaf118387f05642a105ff2
7
+ data.tar.gz: cb1933bd56a3859fe895d4e4b4884f530e36b300a781219957f619e155e7ca5b0cac668ab8ac9b7c63a04f96cd9abfc2160203b5dd405aa205ae5f3247cee8fc
@@ -2,6 +2,12 @@
2
2
 
3
3
  All changes to the gem are documented here.
4
4
 
5
+ ## [1.2.2] - 2020-08-19
6
+
7
+ - Printing templates now include @page_dimensions
8
+ - Forced secure SSL ciphers for requests
9
+ - `examples/try_api_call.rb` refactored to be more versatile (download XSDs [:do not work], pritn_selected_combinations)
10
+
5
11
  ## [1.2.0] - 2020-06-07
6
12
 
7
13
  - **Breaking** Introducing new Printing templates, improved some template names and scopes
@@ -768,7 +768,8 @@ module CzechPostB2bClient
768
768
 
769
769
  # has to be at the end, to load all subcasses before
770
770
  def self.all_classes
771
- ObjectSpace.each_object(CzechPostB2bClient::PostServices::Base.singleton_class)
771
+ base_class = CzechPostB2bClient::PostServices::Base
772
+ ObjectSpace.each_object(base_class.singleton_class).reject { |c| c == base_class }
772
773
  end
773
774
  end
774
775
  end
@@ -10,70 +10,82 @@ module CzechPostB2bClient
10
10
  module PrintingTemplates
11
11
  class Base
12
12
  class << self
13
- attr_reader :id, :description
13
+ attr_reader :id, :description, :page_dimensions
14
14
  end
15
15
  end
16
16
 
17
17
  module AddressLabel
18
18
  class Simple < Base
19
19
  @id = 7
20
- @description = 'adresní štítek (alonž) - samostatný'
20
+ @description = 'adresní štítek (alonž) [1x1/4 A4'
21
+ @page_dimensions = 'A4 portrait (210 × 297 mm)'
21
22
  end
22
23
 
23
24
  class SimpleA6FourOnPage < Base
24
25
  @id = 103
25
- @description = 'Adresní štítek A6 4x'
26
+ @description = 'Adresní štítek A6 : 4x'
27
+ @page_dimensions = 'A4 portrait (210 × 297 mm)'
26
28
  end
27
29
 
28
30
  class SimpleWithCODVoucherA < Base
29
31
  @id = 8
30
- @description = 'adresní štítek (alonž) + dobírková poukázka A'
32
+ @description = 'adresní štítek (alonž) + dobírková poukázka A [(1x1/4 A4 + 1x1/2 A4)'
33
+ @page_dimensions = 'A4 portrait (210 × 297 mm)'
31
34
  end
32
35
 
33
36
  class BiancoFourOnPage < Base
34
37
  @id = 20
35
- @description = 'adresní štítek bianco - 4x (A4)'
38
+ @description = 'adresní štítek bianco : 4x'
39
+ @page_dimensions = 'A4 landscape (297 × 210 mm)'
36
40
  end
37
41
 
38
42
  class Bianco < Base
39
43
  @id = 21
40
- @description = 'adresní štítek bianco - samostatný'
44
+ @description = 'adresní štítek bianco'
45
+ @page_dimensions = 'A6 portrait (105 × 148 mm)'
41
46
  end
42
47
 
43
48
  class BiancoLandscape < Base
44
49
  @id = 39
45
- @description = 'adresní štítek bianco - samostatný (na šířku)'
50
+ @description = 'adresní štítek bianco - na šířku'
51
+ @page_dimensions = 'A6 landscape (148 × 105 mm)'
46
52
  end
47
53
 
48
54
  module ForeignPackage
49
55
  class Standard < Base
50
56
  @id = 58
51
57
  @description = 'CP72 - standardní balík do zahraničí' # or 'AŠ - samostatný Standardní balík do zahraničí'
58
+ @page_dimensions = 'A5 landscape (210 × 148 mm)'
52
59
  end
53
60
 
54
61
  class StandardTwoOnPage < Base
55
62
  @id = 59
56
- @description = 'CP72 - standardní balík do zahraničí (2x A4 )' # or 'AŠ - 4xA4 Standardní balík do zahraničí'
63
+ @description = 'CP72 - standardní balík do zahraničí : 2x' # or 'AŠ - 4xA4 Standardní balík do zahraničí'
64
+ @page_dimensions = 'A4 portrait (297 × 210 mm)'
57
65
  end
58
66
 
59
67
  class Insured < Base
60
68
  @id = 60
61
69
  @description = 'CP72 - cenný balík do zahraničí' # or 'AŠ - samostatný Cenný balík do zahraničí'
70
+ @page_dimensions = 'A5 landscape (210 × 148 mm)'
62
71
  end
63
72
 
64
73
  class InsuredFourOnPage < Base
65
74
  @id = 61
66
- @description = 'CP72 - cenný balík do zahraničí (2x A4)' # or '4xA4 Cenný balík do zahraničí'
75
+ @description = 'CP72 - cenný balík do zahraničí : 2x' # or '4xA4 Cenný balík do zahraničí'
76
+ @page_dimensions = 'A4 portrait (297 × 210 mm)'
67
77
  end
68
78
 
69
79
  class EMS < Base
70
80
  @id = 62
71
81
  @description = 'AŠ - samostatný EMS zahraničí'
82
+ @page_dimensions = 'unverified'
72
83
  end
73
84
 
74
85
  class EMSTwoOnPage < Base
75
86
  @id = 63
76
- @description = 'AŠ - 2xA4 EMS do zahraničí'
87
+ @description = 'AŠ - EMS do zahraničí : 2x'
88
+ @page_dimensions = 'unverified A4'
77
89
  end
78
90
  end
79
91
  end
@@ -82,94 +94,112 @@ module CzechPostB2bClient
82
94
  class EnvelopeC6 < Base
83
95
  @id = 22
84
96
  @description = 'obálka 1 - C6'
97
+ @page_dimensions = 'C6 portrait (114 × 162 mm)'
85
98
  end
86
99
 
87
100
  class EnvelopeC5 < Base
88
101
  @id = 23
89
102
  @description = 'obálka 2 - C5'
103
+ @page_dimensions = 'C5/prc7 portrait (162 × 229 mm)'
90
104
  end
91
105
 
92
106
  class EnvelopeB4 < Base
93
107
  @id = 24
94
108
  @description = 'obálka 3 - B4'
109
+ @page_dimensions = 'B4 portrait (250 × 353 mm)'
95
110
  end
96
111
 
97
112
  class EnvelopeDL < Base
98
113
  @id = 25
99
114
  @description = 'obálka 4 - DL bez okénka'
115
+ @page_dimensions = 'DL/prc5 portrait (109 × 219 mm)'
100
116
  end
101
117
  end
102
118
 
103
119
  class CODVoucherA < Base
104
120
  @id = 10
105
121
  @description = 'poštovní dobírková poukázka A - samostatná'
122
+ @page_dimensions = '102 × 210 mm'
106
123
  end
107
124
 
108
125
  class CODVoucherAThreeOnPage < Base
109
126
  @id = 11
110
- @description = 'poštovní dobírková poukázka A - 3x (A4)'
127
+ @description = 'poštovní dobírková poukázka A - 3x'
128
+ @page_dimensions = '210 × 306 mm'
111
129
  end
112
130
 
113
131
  class CODVoucherC < Base
114
132
  @id = 12
115
133
  @description = 'Poštovní dobírková poukázka C'
134
+ @page_dimensions = 'unverified'
116
135
  end
117
136
 
118
137
  class CODVoucherForCSOB < Base
119
138
  @id = 13
120
139
  @description = 'Dobírková složenka ČSOB'
140
+ @page_dimensions = 'unverified'
121
141
  end
122
142
 
123
143
  class RRLabels3x8 < Base
124
144
  @id = 26
125
- @description = 'štítky pro RR - 3x8 (A4)'
145
+ @description = 'štítky pro RR : 3x8'
146
+ @page_dimensions = 'A4 portrait (210 × 297 mm)'
126
147
  end
127
148
 
128
149
  class IntegratedDocument < Base
129
150
  @id = 38
130
151
  @description = 'Integrovaný doklad'
152
+ @page_dimensions = 'unverified'
131
153
  end
132
154
 
133
155
  class AddressData3x8 < Base
134
156
  @id = 40
135
- @description = 'Adresní údaje 3x8 (A4)'
157
+ @description = 'Adresní údaje : 3x8'
158
+ @page_dimensions = 'A4 portrait (210 × 297 mm)'
136
159
  end
137
160
 
138
161
  class DeliveryTicket < Base
139
162
  @id = 41
140
163
  @description = 'Dodejka'
164
+ @page_dimensions = 'unverified'
141
165
  end
142
166
 
143
167
  module CustomsDeclaration
144
168
  class CN22 < Base
145
169
  @id = 56
146
- @description = 'Celní prohlášení CN22 - 1x (A4)'
170
+ @description = 'Celní prohlášení CN22 [samotný tisk je velikosti cca A6 vlevo nahořu od středu]'
171
+ @page_dimensions = 'A4 portrait (210 × 297 mm)'
147
172
  end
148
173
 
149
174
  class CN23 < Base
150
175
  @id = 57
151
- @description = 'Celní prohlášení CN23 - 1x (A4)'
176
+ @description = 'Celní prohlášení CN23'
177
+ @page_dimensions = 'A5 landscape (210 × 148 mm)'
152
178
  end
153
179
 
154
180
  class CN22FourOnPage < Base
155
181
  @id = 74
156
- @description = 'Celní prohlášení CN22 - 4x (A4)'
182
+ @description = 'Celní prohlášení CN22 : 4x (A4)'
183
+ @page_dimensions = 'unverified A4'
157
184
  end
158
185
 
159
186
  class CN22WithCK < Base
160
187
  @id = 75
161
- @description = 'Celní prohlášení CN22 s ČK - 1x (A4)'
188
+ @description = 'Celní prohlášení CN22 s ČK (A4)'
189
+ @page_dimensions = 'unverified A4'
162
190
  end
163
191
 
164
192
  class CN22WithCKFourOnPage < Base
165
193
  @id = 76
166
- @description = 'Celní prohlášení CN22 s ČK - 4x (A4)'
194
+ @description = 'Celní prohlášení CN22 s ČK : 4x (A4)'
195
+ @page_dimensions = 'unverified A4'
167
196
  end
168
197
  end
169
198
 
170
199
  class CN22FourOnPage < Base
171
200
  @id = 74
172
- @description = 'Celní prohlášení CN22 - 4x (A4)'
201
+ @description = 'Celní prohlášení CN22 : 4x'
202
+ @page_dimensions = 'A4 portrait (210 × 297 mm)'
173
203
  end
174
204
 
175
205
  module HarmonizedLabel
@@ -177,48 +207,57 @@ module CzechPostB2bClient
177
207
  # do zemi AT, DE, FR, GR, HR, CH, IS, LU, LV, NO, PL, SK
178
208
  class Simple < Base
179
209
  @id = 72
180
- @description = 'Obchodní balík do zahraničí – samostatný' # or 'Harmonizovaný štítek pro MZ produkty-samostatný'
210
+ @description = 'Obchodní balík do zahraničí' # or 'Harmonizovaný štítek pro MZ produkty-samostatný'
211
+ @page_dimensions = 'unverified'
181
212
  end
182
213
 
183
214
  class SimpleFourOnPage < Base
184
215
  @id = 73
185
- @description = 'Obchodní balík do zahraničí 4x (A4)' # or 'Harmonizovaný štítek pro MZ produkty – 4x (A4)'
216
+ @description = 'Obchodní balík do zahraničí : 4x (A4)' # or 'Harmonizovaný štítek pro MZ produkty – 4x (A4)'
217
+ @page_dimensions = 'unverified A4'
186
218
  end
187
219
 
188
220
  class BiancoFourOnPage < Base
189
221
  @id = 100
190
- @description = 'Harmonizovaný štítek bianco 4x (A4)'
222
+ @description = 'Harmonizovaný štítek bianco : 4x'
223
+ @page_dimensions = 'A4 portrait (210 × 297 mm)'
191
224
  end
192
225
 
193
226
  class Bianco < Base
194
227
  @id = 101
195
- @description = 'Harmonizovaný štítek bianco – samostatný'
228
+ @description = 'Harmonizovaný štítek bianco'
229
+ @page_dimensions = 'A6 portrait (105 × 148 mm)'
196
230
  end
197
231
 
198
232
  class BiancoPortrait < Base
199
233
  @id = 102
200
- @description = 'Harmonizovaný štítek bianco samostatný (na výšku)'
234
+ @description = 'Harmonizovaný štítek bianco - na výšku'
235
+ @page_dimensions = 'A6 landscape (148 × 105 mm)'
201
236
  end
202
237
 
203
238
  class ZebraBianco105x148 < Base
204
239
  @id = 200
205
- @description = 'Harmonizovaný štítek bianco - (Zebra - 105x148)'
240
+ @description = 'Harmonizovaný štítek bianco - (Zebra - 105x148); nejde o PDF'
241
+ @page_dimensions = 'unverified 105 × 148 mm'
206
242
  end
207
243
 
208
244
  class ZebraBianco100x150 < Base
209
245
  @id = 201
210
- @description = 'Harmonizovaný štítek bianco - (Zebra - 100x150)'
246
+ @description = 'Harmonizovaný štítek bianco - (Zebra - 100x150); nejde o PDF'
247
+ @page_dimensions = 'unverified 100 × 150 mm'
211
248
  end
212
249
 
213
250
  class ZebraBianco100x125 < Base
214
251
  @id = 202
215
- @description = 'Harmonizovaný štítek bianco - (Zebra - 100x125)'
252
+ @description = 'Harmonizovaný štítek bianco - (Zebra - 100x125); nejde o PDF'
253
+ @page_dimensions = 'unverified 100 × 125 mm'
216
254
  end
217
255
  end
218
256
 
219
257
  # has to be at the end, to load all subcasses before
220
258
  def self.all_classes
221
- ObjectSpace.each_object(CzechPostB2bClient::PrintingTemplates::Base.singleton_class)
259
+ base_class = CzechPostB2bClient::PrintingTemplates::Base
260
+ ObjectSpace.each_object(base_class.singleton_class).reject { |c| c == base_class }
222
261
  end
223
262
  end
224
263
  end
@@ -1889,7 +1889,8 @@ module CzechPostB2bClient
1889
1889
 
1890
1890
  # must be at end to collect all classes defined before
1891
1891
  def self.all_classes
1892
- ObjectSpace.each_object(CzechPostB2bClient::ResponseCodes::BaseCode.singleton_class)
1892
+ base_class = CzechPostB2bClient::ResponseCodes::BaseCode
1893
+ ObjectSpace.each_object(base_class.singleton_class).reject { |c| c == base_class }
1893
1894
  end
1894
1895
 
1895
1896
  def self.new_by_code(code)
@@ -74,6 +74,7 @@ module CzechPostB2bClient
74
74
  use_ssl: true,
75
75
  verify_mode: OpenSSL::SSL::VERIFY_PEER,
76
76
  keep_alive_timeout: 30,
77
+ ciphers: secure_and_available_ciphers,
77
78
  cert: OpenSSL::X509::Certificate.new(File.read(configuration.certificate_path)),
78
79
  # cert_password: configuration.certificate_password,
79
80
  key: OpenSSL::PKey::RSA.new(File.read(configuration.private_key_path), configuration.private_key_password),
@@ -116,6 +117,15 @@ module CzechPostB2bClient
116
117
  errors.add(:connection, "#{error.class} > #{service_uri} - #{error}")
117
118
  fail!
118
119
  end
120
+
121
+ def secure_and_available_ciphers
122
+ # Available non-weak suites for b2b.postaonline.cz (https://www.ssllabs.com/ssltest/analyze.html?d=b2b.postaonline.cz)
123
+ # TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030) ECDH secp384r1 (eq. 7680 bits RSA) FS 256
124
+ # TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f) ECDH secp384r1 (eq. 7680 bits RSA) FS
125
+ # which have following names in OpenSSL (see `openssl ciphers`)
126
+
127
+ %w[ECDHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES128-GCM-SHA256]
128
+ end
119
129
  end
120
130
  end
121
131
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CzechPostB2bClient
4
- VERSION = '1.2.1'
4
+ VERSION = '1.2.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: czech_post_b2b_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Mlčoch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-07 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox