postmark 1.23.0 → 1.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +3 -0
- data/README.md +9 -0
- data/VERSION +1 -1
- data/lib/postmark/deprecations.rb +35 -0
- data/lib/postmark/error.rb +8 -4
- data/lib/postmark/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36d183adb014f24f30c12f04f65d01d9a4565e46bac544fcf499f1834d98b15f
|
4
|
+
data.tar.gz: 23d80a64a061b7bce98a7040a0b64b7e56611aea995894764d201e5ee71fdf69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a132d891995e587fc6324cbed9626799a7919f0314b4402910593e47afb02281b25fd6b8971a20197774dd37d48c7221389047699b9cbf98a2cdfecce3e247b6
|
7
|
+
data.tar.gz: 26b78de0eefb4c6055e2edee3f787ddab17c49f49fbbd4e8bf02100f85202cc46d57ff4c140617f0c1cd7c325875e602fc952c8b9a528a9ad9feed25ee9d76b1
|
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
@@ -48,6 +48,15 @@ Without Bundler:
|
|
48
48
|
gem install postmark
|
49
49
|
```
|
50
50
|
|
51
|
+
## Deprecations
|
52
|
+
|
53
|
+
Deprecations can be either silenced or set to raise using:
|
54
|
+
|
55
|
+
```rb
|
56
|
+
Postmark::Deprecations.behavior = :silence
|
57
|
+
Postmark::Deprecations.behavior = :raise
|
58
|
+
```
|
59
|
+
|
51
60
|
## Note on Patches/Pull Requests
|
52
61
|
|
53
62
|
See [CONTRIBUTING.md](CONTRIBUTING.md) file for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.24.0
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Postmark
|
2
|
+
def self.const_missing(const_name)
|
3
|
+
replacement = Deprecations.deprecated_constants.fetch(const_name, nil) || super
|
4
|
+
Deprecations.report("DEPRECATION WARNING: the class #{const_name} is deprecated. Use #{replacement} instead.")
|
5
|
+
replacement
|
6
|
+
end
|
7
|
+
|
8
|
+
module Deprecations
|
9
|
+
DEFAULT_BEHAVIORS = {
|
10
|
+
:raise => lambda { |message| raise message },
|
11
|
+
:log => lambda { |message| warn message },
|
12
|
+
:silence => lambda { |message| },
|
13
|
+
}
|
14
|
+
|
15
|
+
def self.report(message)
|
16
|
+
DEFAULT_BEHAVIORS.fetch(behavior).call(message)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.deprecated_constants
|
20
|
+
@deprecated_constants ||= {}
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.behavior
|
24
|
+
@behavior ||= :log
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.behavior=(behavior)
|
28
|
+
@behavior = behavior
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.add_constants(mappings)
|
32
|
+
deprecated_constants.merge!(mappings)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/postmark/error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'postmark/deprecations'
|
2
|
+
|
1
3
|
module Postmark
|
2
4
|
class Error < ::StandardError; end
|
3
5
|
|
@@ -126,8 +128,10 @@ module Postmark
|
|
126
128
|
class UnexpectedHttpResponseError < HttpServerError; end
|
127
129
|
|
128
130
|
# Backwards compatible aliases
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
131
|
+
Deprecations.add_constants(
|
132
|
+
:DeliveryError => Error,
|
133
|
+
:InvalidMessageError => ApiInputError,
|
134
|
+
:UnknownError => UnexpectedHttpResponseError,
|
135
|
+
:InvalidEmailAddressError => InvalidEmailRequestError
|
136
|
+
)
|
133
137
|
end
|
data/lib/postmark/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -15,6 +15,8 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'shared_e
|
|
15
15
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'custom_matchers.rb')
|
16
16
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'helpers.rb')
|
17
17
|
|
18
|
+
Postmark::Deprecations.behavior = :silence
|
19
|
+
|
18
20
|
if ENV['JSONGEM']
|
19
21
|
# `JSONGEM=Yajl rake spec`
|
20
22
|
Postmark.response_parser_class = ENV['JSONGEM'].to_sym
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomek Maszkowski
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2023-
|
16
|
+
date: 2023-04-07 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: json
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/postmark/api_client.rb
|
89
89
|
- lib/postmark/bounce.rb
|
90
90
|
- lib/postmark/client.rb
|
91
|
+
- lib/postmark/deprecations.rb
|
91
92
|
- lib/postmark/error.rb
|
92
93
|
- lib/postmark/handlers/mail.rb
|
93
94
|
- lib/postmark/helpers/hash_helper.rb
|