helo-email-sdk 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63282f0b8d0d5cafd4d1d147d861fba45702b20828e1d98813f36bb7a82de4c5
4
- data.tar.gz: cb9f8a9732bc517d7f5ef5ce288025833955add3872cba15aa4177272bafcc8f
3
+ metadata.gz: f7a6aed6efad7398a95797b7e9fc53c03e2d8a1ce111fd0a2db2c08690f3657e
4
+ data.tar.gz: 1846b059a58aadba3f2c2f8fb1d9b9f4e238921d20e8b0335012d44449d550db
5
5
  SHA512:
6
- metadata.gz: 5103b924c9bda3235dc11373c549b2e260ec7ffcaada3ea48493c661c7f9bb87725b50599c59da753a7109e14bc1f47a5409d1445c659a9af0d28f1f0a733031
7
- data.tar.gz: dd999d86b4e388c46cce2a12d5f0fb5421db3f34a75c96d0739f16036ba1174a6917ba1cb71e1d6f4d02c71bdcd1be6c297d4a531866d51f20d2c250b3c42f5b
6
+ metadata.gz: 002b7f03d1cf4c6b4bceda0439b9fbfc3a8ab7108134356cbedd25109d4e75a9f0dcbae22bde080e353e48f4a01ae881dea8d5c30ccdf9d6b9bc1de47b7ee552
7
+ data.tar.gz: 33a4520906168a841abf7183673783a5cfedc7ccaeb3ef3d7958e54c659dd53425655969b52122a57b829e30ea6711bf2ee35f5d036114058fac4461c799e6e7
data/README.md CHANGED
@@ -28,30 +28,6 @@ Helo.configure do |config|
28
28
  end
29
29
  ```
30
30
 
31
- ## Automatic retries
32
-
33
- A request that fails with a network error, a timeout, or a `408`, `429`, `500`, `502`, `503` or
34
- `504` response is retried up to 2 times, with exponential backoff and jitter. It
35
- is only retried when sending it again can't do anything twice: a `GET`, `PUT` or `DELETE`,
36
- or a request carrying an idempotency key. A `429` is always retried, since the server
37
- refused the request without acting on it. A `Retry-After` header is honoured; one asking
38
- for more than 8 seconds is not retried early, and the error is returned instead.
39
-
40
- Operations that take an idempotency key generate one for each call when you don't pass
41
- one, and send it on every retry, so a send whose response was lost is never sent twice.
42
- Pass your own key to make your own retries (a background job run again, say) safe too.
43
-
44
- Retries are done by [faraday-retry](https://github.com/lostisland/faraday-retry), and
45
- `config.retry_options` is merged over the options the SDK gives it: `max:` changes how many
46
- (`0` disables them), `interval:` the first wait, and `retry_block:` can log each retry.
47
-
48
- ```ruby
49
- Helo.configure do |config|
50
- config.api_key = ENV.fetch("HELO_API_KEY")
51
- config.retry_options = { max: 0 }
52
- end
53
- ```
54
-
55
31
  ## Usage
56
32
 
57
33
  Each API is a class with class-level methods. Responses come back as model objects with
@@ -69,20 +45,6 @@ result = Helo::Channels.list(limit: 10)
69
45
 
70
46
  See the [API docs](#apis) for every method, with a runnable example each.
71
47
 
72
- ### Errors
73
-
74
- Failed requests raise `Helo::APIError`:
75
-
76
- ```ruby
77
- begin
78
- Helo::Channels.list
79
- rescue Helo::APIError => e
80
- e.code # HTTP status
81
- e.detail # human-readable detail from the API
82
- e.errors # field-level validation errors, when present
83
- end
84
- ```
85
-
86
48
  ## Rails (ActionMailer)
87
49
 
88
50
  The gem registers a `:helo` delivery method with ActionMailer, so existing
@@ -129,6 +91,35 @@ end
129
91
  After delivery, `message[:helo_message_id].value` is the id the API assigned the
130
92
  message, and failed requests raise `Helo::APIError` (subject to `config.action_mailer.raise_delivery_errors`).
131
93
 
94
+ ## Errors
95
+
96
+ Failed requests raise `Helo::APIError`:
97
+
98
+ ```ruby
99
+ begin
100
+ Helo::Channels.list
101
+ rescue Helo::APIError => e
102
+ e.code # HTTP status
103
+ e.detail # human-readable detail from the API
104
+ e.errors # field-level validation errors, when present
105
+ end
106
+ ```
107
+
108
+ ## Automatic retries
109
+
110
+ A request that fails with a network error, a timeout, or a `408`, `429` or `5xx` response is
111
+ retried up to 2 times with backoff, when sending it again is safe. Operations that take an
112
+ idempotency key generate one if you don't pass it, so a retried send is never delivered twice.
113
+
114
+ Retries use [faraday-retry](https://github.com/lostisland/faraday-retry); `config.retry_options`
115
+ overrides its options:
116
+
117
+ ```ruby
118
+ Helo.configure do |config|
119
+ config.retry_options = { max: 0 } # no retries
120
+ end
121
+ ```
122
+
132
123
  ## Webhook signature verification
133
124
 
134
125
  Webhook deliveries are signed with the endpoint's signing key. Verify every delivery before
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class BatchValidationMode
5
+ STRICT = "strict"
6
+ RELAXED = "relaxed"
7
+
8
+ def self.all
9
+ [STRICT, RELAXED].freeze
10
+ end
11
+ end
12
+ end
@@ -4,6 +4,7 @@ module Helo
4
4
  class SendMessageBatchRequest
5
5
  include Helo::Core::Model
6
6
 
7
+ api_attribute :validation, :string, key: "validation"
7
8
  api_attribute :requests, Helo::Core::ArrayType.new("Helo::SendMessageRequest"), key: "requests"
8
9
  end
9
10
  end
@@ -7,5 +7,6 @@ module Helo
7
7
  api_attribute :status, :string, key: "status"
8
8
  api_attribute :error_code, :string, key: "errorCode"
9
9
  api_attribute :error_message, :string, key: "errorMessage"
10
+ api_attribute :errors, key: "errors"
10
11
  end
11
12
  end
data/lib/helo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Helo
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helo-email-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Helo Email
@@ -137,6 +137,7 @@ files:
137
137
  - lib/helo/core/model.rb
138
138
  - lib/helo/core/model_type.rb
139
139
  - lib/helo/enums/attachment_disposition.rb
140
+ - lib/helo/enums/batch_validation_mode.rb
140
141
  - lib/helo/enums/broadcast_status.rb
141
142
  - lib/helo/enums/delivery_type.rb
142
143
  - lib/helo/enums/dns_record_status.rb