-
Notifications
You must be signed in to change notification settings - Fork 1
/
printing_templates.rb
268 lines (226 loc) · 7.83 KB
/
printing_templates.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# frozen_string_literal: true
# Available printing templates, which can be used in AdressSheetsGenerator `options[:template_id]`
#
# Do not miss `CzechPostB2bClient::PrintingTemplates.all_classes` method,
# it has to be at end of module to work properly
module CzechPostB2bClient
module PrintingTemplates
class Base
class << self
attr_reader :id, :description, :page_dimensions
def content_type
:pdf
end
end
end
module AddressLabel
class Simple < Base
@id = 7
@description = 'adresní štítek (alonž) [1x1/4 A4'
@page_dimensions = 'A4 portrait (210 × 297 mm)'
end
class SimpleA6FourOnPage < Base
@id = 103
@description = 'Adresní štítek A6 : 4x'
@page_dimensions = 'A4 portrait (210 × 297 mm)'
end
class SimpleWithCODVoucherA < Base
@id = 8
@description = 'adresní štítek (alonž) + dobírková poukázka A [(1x1/4 A4 + 1x1/2 A4)'
@page_dimensions = 'A4 portrait (210 × 297 mm)'
end
class BiancoFourOnPage < Base
@id = 20
@description = 'adresní štítek bianco : 4x'
@page_dimensions = 'A4 landscape (297 × 210 mm)'
end
class Bianco < Base
@id = 21
@description = 'adresní štítek bianco'
@page_dimensions = 'A6 portrait (105 × 148 mm)'
end
class BiancoLandscape < Base
@id = 39
@description = 'adresní štítek bianco - na šířku'
@page_dimensions = 'A6 landscape (148 × 105 mm)'
end
module ForeignPackage
class Standard < Base
@id = 58
@description = 'CP72 - standardní balík do zahraničí' # or 'AŠ - samostatný Standardní balík do zahraničí'
@page_dimensions = 'A5 landscape (210 × 148 mm)'
end
class StandardTwoOnPage < Base
@id = 59
@description = 'CP72 - standardní balík do zahraničí : 2x' # or 'AŠ - 4xA4 Standardní balík do zahraničí'
@page_dimensions = 'A4 portrait (297 × 210 mm)'
end
class Insured < Base
@id = 60
@description = 'CP72 - cenný balík do zahraničí' # or 'AŠ - samostatný Cenný balík do zahraničí'
@page_dimensions = 'A5 landscape (210 × 148 mm)'
end
class InsuredFourOnPage < Base
@id = 61
@description = 'CP72 - cenný balík do zahraničí : 2x' # or '4xA4 Cenný balík do zahraničí'
@page_dimensions = 'A4 portrait (297 × 210 mm)'
end
class EMS < Base
@id = 62
@description = 'AŠ - samostatný EMS zahraničí'
@page_dimensions = 'unverified'
end
class EMSTwoOnPage < Base
@id = 63
@description = 'AŠ - EMS do zahraničí : 2x'
@page_dimensions = 'unverified A4'
end
end
end
module Envelope
class EnvelopeC6 < Base
@id = 22
@description = 'obálka 1 - C6'
@page_dimensions = 'C6 portrait (114 × 162 mm)'
end
class EnvelopeC5 < Base
@id = 23
@description = 'obálka 2 - C5'
@page_dimensions = 'C5/prc7 portrait (162 × 229 mm)'
end
class EnvelopeB4 < Base
@id = 24
@description = 'obálka 3 - B4'
@page_dimensions = 'B4 portrait (250 × 353 mm)'
end
class EnvelopeDL < Base
@id = 25
@description = 'obálka 4 - DL bez okénka'
@page_dimensions = 'DL/prc5 portrait (109 × 219 mm)'
end
end
class CODVoucherA < Base
@id = 10
@description = 'poštovní dobírková poukázka A - samostatná'
@page_dimensions = '102 × 210 mm'
end
class CODVoucherAThreeOnPage < Base
@id = 11
@description = 'poštovní dobírková poukázka A - 3x'
@page_dimensions = '210 × 306 mm'
end
class CODVoucherC < Base
@id = 12
@description = 'Poštovní dobírková poukázka C'
@page_dimensions = 'unverified'
end
class RRLabels3x8 < Base
@id = 26
@description = 'štítky pro RR : 3x8'
@page_dimensions = 'A4 portrait (210 × 297 mm)'
end
class IntegratedDocument < Base
@id = 38
@description = 'Integrovaný doklad'
@page_dimensions = 'unverified'
end
class AddressData3x8 < Base
@id = 40
@description = 'Adresní údaje : 3x8'
@page_dimensions = 'A4 portrait (210 × 297 mm)'
end
class DeliveryTicket < Base
@id = 41
@description = 'Dodejka'
@page_dimensions = 'unverified'
end
module CustomsDeclaration
class CN22 < Base
@id = 56
@description = 'Celní prohlášení CN22 [samotný tisk je velikosti cca A6 vlevo nahořu od středu]'
@page_dimensions = 'A4 portrait (210 × 297 mm)'
end
class CN23 < Base
@id = 57
@description = 'Celní prohlášení CN23'
@page_dimensions = 'A5 landscape (210 × 148 mm)'
end
# class CN22FourOnPage < Base
# @id = 74
# @description = 'Celní prohlášení CN22 : 4x (A4)'
# @page_dimensions = 'unverified A4'
# end
# class CN22WithCK < Base
# @id = 75
# @description = 'Celní prohlášení CN22 s ČK (A4)'
# @page_dimensions = 'unverified A4'
# end
# class CN22WithCKFourOnPage < Base
# @id = 76
# @description = 'Celní prohlášení CN22 s ČK : 4x (A4)'
# @page_dimensions = 'unverified A4'
# end
end
module HarmonizedLabel
# Formulare ID 72 a 73 je mozno pouzit pouze pro zasilky s prefixem CE
# do zemi AT, DE, FR, GR, HR, CH, IS, LU, LV, NO, PL, SK
class Simple < Base
@id = 72
@description = 'Obchodní balík do zahraničí' # or 'Harmonizovaný štítek pro MZ produkty-samostatný'
@page_dimensions = 'unverified'
end
class SimpleFourOnPage < Base
@id = 73
@description = 'Obchodní balík do zahraničí : 4x (A4)' # or 'Harmonizovaný štítek pro MZ produkty – 4x (A4)'
@page_dimensions = 'unverified A4'
end
class BiancoFourOnPage < Base
@id = 100
@description = 'Harmonizovaný štítek bianco : 4x'
@page_dimensions = 'A4 portrait (210 × 297 mm)'
end
class Bianco < Base
@id = 101
@description = 'Harmonizovaný štítek bianco'
@page_dimensions = 'A6 portrait (105 × 148 mm)'
end
class BiancoPortrait < Base
@id = 102
@description = 'Harmonizovaný štítek bianco - na výšku'
@page_dimensions = 'A6 landscape (148 × 105 mm)'
end
end
module ZebraLabel
class Base < CzechPostB2bClient::PrintingTemplates::Base
def self.content_type
:zpl
end
end
class Bianco105x148 < ZebraLabel::Base
@id = 200
@description = 'Harmonizovaný štítek bianco - (Zebra - 105x148); nejde o PDF'
@page_dimensions = 'unverified 105 × 148 mm'
end
class Bianco100x150 < ZebraLabel::Base
@id = 201
@description = 'Harmonizovaný štítek bianco - (Zebra - 100x150); nejde o PDF'
@page_dimensions = 'unverified 100 × 150 mm'
end
class Bianco100x125 < ZebraLabel::Base
@id = 202
@description = 'Harmonizovaný štítek bianco - (Zebra - 100x125); nejde o PDF'
@page_dimensions = 'unverified 100 × 125 mm'
end
end
# has to be at the end, to load all subcasses before
def self.all_classes
base_class = CzechPostB2bClient::PrintingTemplates::Base
ObjectSpace.each_object(base_class.singleton_class).reject { |c| c == base_class }
end
def self.find(id)
klass = all_classes.detect { |k| k.id == id }
raise "PrintingTemplate with id: #{id} is unknown!" unless klass
klass
end
end
end