czech_post_b2b_client 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -23
- data/README.md +4 -0
- data/lib/czech_post_b2b_client/configuration.rb +3 -1
- data/lib/czech_post_b2b_client/services/api_caller.rb +10 -2
- data/lib/czech_post_b2b_client/services/orchestrator.rb +2 -1
- data/lib/czech_post_b2b_client/version.rb +1 -1
- data/lib/stepped_service/base.rb +7 -1
- metadata +39 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4966f6b2ba55ab0f3d48abcdadff8d56ca1fdd8208d830a37d803b05a0017329
|
4
|
+
data.tar.gz: 47585947e57849957b8770d28d1814cc1f4d0fd425c38e2213fe98dce4c0ff15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2581677a5993c5f053d0cac45da5d6352406f7e368c5181621740d625eaa3f6440d3066493886e9758b443a05c83982855574bf82c7fb572c92e802e06acce8
|
7
|
+
data.tar.gz: 176dc98628cec8bd7e0aa5cfcfb32d130ffec49d2ec19d6661f78b01c7fd8b4b0c2f6467fef2de0c413a1a4e0d14fed2ba8670437777739d260cc93d6a1bf203
|
data/CHANGELOG.md
CHANGED
@@ -2,66 +2,75 @@
|
|
2
2
|
|
3
3
|
All changes to the gem are documented here.
|
4
4
|
|
5
|
+
## [1.4.0] - 2022-10-20
|
6
|
+
|
7
|
+
- upgrade of all required gems to handle ruby 3
|
8
|
+
- CP cert can be passed by file path or content
|
9
|
+
|
5
10
|
## [1.3.0] - 2022-04-07
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
11
|
+
|
12
|
+
- checked currently available Print Templates codes
|
13
|
+
- enhanced address sheet printing with ability to print ZPL sheets (templates 200, 201 and 202).
|
14
|
+
Result of `AddressSheetGenerator` now have `pdf_content` and `zpl_content`.
|
15
|
+
- found new(?) API from Czech Post , see `documents/B2B-ZSKService-1.4.0.yaml` and <https://www.ceskaposta.cz/napi/b2b>.
|
10
16
|
|
11
17
|
## [1.2.8] - 2022-03-22
|
12
|
-
|
18
|
+
|
19
|
+
- added new response codes
|
13
20
|
|
14
21
|
## [1.2.6] - 2020-10-27
|
15
22
|
|
16
|
-
|
23
|
+
- fixed passing all errors from `parcelsServiceSync` response.
|
17
24
|
|
18
25
|
## [1.2.5] - 2020-10-06
|
19
26
|
|
20
|
-
|
27
|
+
- `errorDescription` from `B2BError` response is now merged into error message.
|
21
28
|
|
22
29
|
## [1.2.4] - 2020-10-06
|
23
30
|
|
24
|
-
|
31
|
+
- Added `configuration.log_messages_at_least_as` option, to be able debug client behaviour when app log level is higher (eg. production)
|
25
32
|
|
26
33
|
## [1.2.3] - 2020-08-21
|
27
34
|
|
28
|
-
|
29
|
-
|
35
|
+
- Corrected order in XML `sequence` elements
|
36
|
+
- Added `schemaLocation` to root element and placed publicly accessible XSDs into Github repo
|
30
37
|
|
31
38
|
## [1.2.2] - 2020-08-19
|
32
39
|
|
33
|
-
|
34
|
-
|
35
|
-
|
40
|
+
- Printing templates now include @page_dimensions
|
41
|
+
- Forced secure SSL ciphers for requests
|
42
|
+
- `examples/try_api_call.rb` refactored to be more versatile (download XSDs [:do not work], pritn_selected_combinations)
|
36
43
|
|
37
44
|
## [1.2.0] - 2020-06-07
|
38
45
|
|
39
|
-
|
40
|
-
|
46
|
+
- **Breaking** Introducing new Printing templates, improved some template names and scopes
|
47
|
+
- Added options `custom_card_number` and `print_options` to `Configuration`
|
41
48
|
|
42
49
|
## [1.1.0] - 2020-05-28
|
43
50
|
|
44
|
-
|
45
|
-
|
46
|
-
|
51
|
+
- Introducing new API documentation from Czech Post
|
52
|
+
- Added service `ParcelSyncSender` service which uses newly discovered `parcelsServiceSync` API endpoint
|
53
|
+
- Renamed `ParcelSender` to `ParcelAsyncSender` . And created deprecating clone `ParcelSender`, so no Breaking change! If You usit it calls `ParcelAsyncSender` and displays deprecation message.
|
47
54
|
|
48
55
|
## [1.0.3] - 2020-05-20
|
49
56
|
|
50
|
-
|
51
|
-
|
57
|
+
- Added Czech Post service DiscountForOnlinePosting.
|
58
|
+
- **Breaking**: Renamed Post service "Size" classes `CzechPostB2bClient::PostServices::Size???` to `CzechPostB2bClient::PostServices::ParcelSize???` (eg. : `CzechPostB2bClient::PostServices::ParcelSizeXL`)
|
52
59
|
I know, that I have **breaking** in every new version, I hope You are not fast enough.
|
53
60
|
|
54
61
|
## [1.0.2] - 2020-05-08
|
55
62
|
|
56
|
-
|
57
|
-
|
63
|
+
- Added Czech Post services as classes, not just list in docs.
|
64
|
+
- **Breaking**: Renamed methods `CzechPostB2bClient::PrintingTemplate.all_template_classes` and `CzechPostB2bClient::ResponseCodes.all_code_classes` to `CzechPostB2bClient::PrintingTemplate.all_classes` , and `CzechPostB2bClient::ResponseCodes.all_classes`
|
58
65
|
|
59
66
|
## [1.0.0] - 2020-03-19
|
60
67
|
|
61
68
|
Production ready release
|
62
69
|
|
63
70
|
### Fixed
|
71
|
+
|
64
72
|
### Changed
|
73
|
+
|
65
74
|
### Added
|
66
|
-
- All the stuff
|
67
75
|
|
76
|
+
- All the stuff
|
data/README.md
CHANGED
@@ -97,7 +97,11 @@ CzechPostB2bClient.configure do |config|
|
|
97
97
|
config.contract_id = 'contract_id'
|
98
98
|
config.customer_id = 'customer_id'
|
99
99
|
config.certificate_path = 'full_path/to/your/postsignum_certificate.pem'
|
100
|
+
# or you can use cert directly from env
|
101
|
+
config.certificate = ENC['CP_CRT_CONTENT']
|
102
|
+
|
100
103
|
config.private_key_path = 'full_path/to/your/postsignum_private.key'
|
104
|
+
# same here, filepath or content directly
|
101
105
|
config.private_key_password = 'your_password or nil'
|
102
106
|
|
103
107
|
# these two just save Your time, can be overwritten for each call
|
@@ -9,8 +9,10 @@ module CzechPostB2bClient
|
|
9
9
|
:sending_post_office_code,
|
10
10
|
:sending_post_office_location_number,
|
11
11
|
:certificate_path,
|
12
|
+
:certificate,
|
12
13
|
:private_key_password,
|
13
14
|
:private_key_path,
|
15
|
+
:private_key,
|
14
16
|
:namespaces,
|
15
17
|
:language,
|
16
18
|
:logger,
|
@@ -32,7 +34,7 @@ module CzechPostB2bClient
|
|
32
34
|
}
|
33
35
|
|
34
36
|
@language = :cs
|
35
|
-
@logger = defined?(Rails) ? ::Rails.logger : ::Logger.new($stdout)
|
37
|
+
@logger = defined?(Rails::Logger) ? ::Rails.logger : ::Logger.new($stdout)
|
36
38
|
@b2b_api_base_uri = 'https://b2b.postaonline.cz/services/POLService/v1'
|
37
39
|
@sending_post_office_location_number = 1
|
38
40
|
|
@@ -73,15 +73,23 @@ module CzechPostB2bClient
|
|
73
73
|
{ 'Content-Type': 'text/xml' }
|
74
74
|
end
|
75
75
|
|
76
|
+
def certificate
|
77
|
+
configuration.certificate || File.read(configuration.certificate_path)
|
78
|
+
end
|
79
|
+
|
80
|
+
def private_key
|
81
|
+
configuration.private_key || File.read(configuration.private_key_path)
|
82
|
+
end
|
83
|
+
|
76
84
|
def connection_options
|
77
85
|
{
|
78
86
|
use_ssl: true,
|
79
87
|
verify_mode: OpenSSL::SSL::VERIFY_PEER,
|
80
88
|
keep_alive_timeout: 30,
|
81
89
|
ciphers: secure_and_available_ciphers,
|
82
|
-
cert: OpenSSL::X509::Certificate.new(
|
90
|
+
cert: OpenSSL::X509::Certificate.new(certificate),
|
83
91
|
# cert_password: configuration.certificate_password,
|
84
|
-
key: OpenSSL::PKey::RSA.new(
|
92
|
+
key: OpenSSL::PKey::RSA.new(private_key, configuration.private_key_password),
|
85
93
|
cert_store: post_signum_ca_store
|
86
94
|
}
|
87
95
|
end
|
@@ -8,7 +8,8 @@ module CzechPostB2bClient
|
|
8
8
|
def result_of_subservice(service_hash)
|
9
9
|
service_name = service_hash.keys.first
|
10
10
|
service_class = send("#{service_name}_class")
|
11
|
-
|
11
|
+
|
12
|
+
service = service_class.call(**service_hash.values.first)
|
12
13
|
|
13
14
|
if service.failed?
|
14
15
|
errors.add_from_hash({ service_name => service.errors.full_messages })
|
data/lib/stepped_service/base.rb
CHANGED
@@ -87,7 +87,13 @@ module SteppedService
|
|
87
87
|
attr_reader :result
|
88
88
|
|
89
89
|
def self.call(*args, **keyword_args)
|
90
|
-
|
90
|
+
if args.blank?
|
91
|
+
new(**keyword_args).call
|
92
|
+
elsif keyword_args.blank?
|
93
|
+
new(*args).call
|
94
|
+
else
|
95
|
+
new(*args, **keyword_args).call
|
96
|
+
end
|
91
97
|
end
|
92
98
|
|
93
99
|
# You can override it, to not use steps
|
metadata
CHANGED
@@ -1,141 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: czech_post_b2b_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
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: 2022-
|
11
|
+
date: 2022-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ox
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest-reporters
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry-byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop-minitest
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0
|
124
|
+
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: webmock
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '0'
|
139
139
|
description:
|
140
140
|
email:
|
141
141
|
- foton@centrum.cz
|
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
- !ruby/object:Gem::Version
|
219
219
|
version: '0'
|
220
220
|
requirements: []
|
221
|
-
rubygems_version: 3.
|
221
|
+
rubygems_version: 3.3.7
|
222
222
|
signing_key:
|
223
223
|
specification_version: 4
|
224
224
|
summary: Accessing B2B API of Czech Post for bulk processing of packages ("B2B - WS
|