thousandmails 1.0.0 → 1.0.1

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: 5b4a4b596ac5abce715b93136c69714c6020c3cb5c0fe5e3ef85309784171c7a
4
- data.tar.gz: 1ac22010648ed66129b927163f5cc1b0c2e20584a461527c548ef9069e3609ff
3
+ metadata.gz: 707e6c371afa7c43c8c2d07a848d32c6a0cba35696c4a97eec1797acc7fa6551
4
+ data.tar.gz: f82bcaad5bdfec218122b52f142ad4daae249999a72dfaac6a507ec788a903ca
5
5
  SHA512:
6
- metadata.gz: b3b86c412bdf3ea27f520f7c285d0bb3f2f317a0bfce50f9ce93528e14fea27946c86bc5cb62e4e2128e85dfef2db54e7855d7d8f7bb967716b63f7de82d840f
7
- data.tar.gz: d1be573a21663fbea2de6d6f7b78ec8b7785e1034f92aeb3da8a69de51ce49df9f87385975dfe6fc1a24a8e5d7af6ba3fb098e94d050b8f97c3cd7b41852417e
6
+ metadata.gz: e13ef9869ef6b3f6d95d637ee451c6c4f2474f74a405290a41209bad10665955c1c9f44d9849033558671419161f374e36bfc8fcf91add54f89aa0769c220962
7
+ data.tar.gz: 747e380db3076640dfc790b283e2be61e552ee3c7f9a7ed8e6d0b93f8faa1dfaacf475d59c2146844dd79fd0aab9df38425984d2f3329471f4af9ffc1b91963e
@@ -1,100 +1,100 @@
1
- # frozen_string_literal: true
2
-
3
- module ThousandMails
4
- # Values mirrored from the server so the SDK can reject a bad request locally
5
- # instead of spending a round trip on it.
6
- #
7
- # Every constant here has a counterpart in src/backend/client. When the server
8
- # changes a limit, change it here too — the pairs are called out per entry.
9
- module Constants
10
- # Every client endpoint hangs off this prefix (backend/client/routes/sendmail.routes.js).
11
- CLIENT_PREFIX = "/client"
12
-
13
- # Milliseconds, not seconds, so the Node, PHP, Python and Ruby SDKs
14
- # configure identically.
15
- DEFAULT_TIMEOUT_MS = 30_000
16
- DEFAULT_MAX_RETRIES = 2
17
-
18
- # The host used when nothing overrides it.
19
- FALLBACK_BASE_URL = "https://beta.thousandmails.com/mailerapi"
20
-
21
- # --- send limits ---------------------------------------------------------
22
-
23
- # Sendpipeline.MAX_BATCH
24
- MAX_BATCH = 100
25
- # middleware/Attachment.MAX_ATTACHMENT_BATCH
26
- MAX_ATTACHMENT_BATCH = 20
27
- # middleware/Attachment.MAX_ATTACHMENTS_PER_MESSAGE
28
- MAX_ATTACHMENTS_PER_MESSAGE = 5
29
- # middleware/Attachment.MAX_FILE_BYTES
30
- MAX_FILE_BYTES = 5 * 1024 * 1024
31
- # middleware/Attachment.MAX_REQUEST_BYTES
32
- MAX_REQUEST_BYTES = 20 * 1024 * 1024
33
- # middleware/Attachment.MAX_FILES_PER_BATCH_REQUEST
34
- MAX_FILES_PER_BATCH_REQUEST = 20
35
- # middleware/Attachment.MAX_FILENAME_LENGTH
36
- MAX_FILENAME_LENGTH = 200
37
-
38
- # middleware/Attachment.ALLOWED_TYPES — extension => Content-Type. The server
39
- # re-derives the type from the extension and sniffs the bytes, so the type we
40
- # put on the multipart part is a courtesy, not a claim it trusts.
41
- ATTACHMENT_TYPES = {
42
- "csv" => "text/csv",
43
- "xls" => "application/vnd.ms-excel",
44
- "xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
45
- "doc" => "application/msword",
46
- "docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
47
- "pdf" => "application/pdf",
48
- "jpg" => "image/jpeg",
49
- "jpeg" => "image/jpeg",
50
- "png" => "image/png"
51
- }.freeze
52
-
53
- ALLOWED_EXTENSIONS = ATTACHMENT_TYPES.keys.freeze
54
-
55
- # --- analytics -----------------------------------------------------------
56
-
57
- # client/utils/Analytics.METRIC_FIELDS
58
- METRIC_FIELDS = %w[
59
- sent delivered deferred bounced opened clicked spam unsubscribed failed
60
- ].freeze
61
-
62
- # client/utils/Analytics.METRIC_BY_TYPE keys — the `type` on a log event.
63
- EVENT_TYPES = %w[
64
- queued delivered deferred bounced opened clicked spam unsubscribed failed
65
- ].freeze
66
-
67
- INTERVALS = %w[day week month].freeze
68
-
69
- # Query-param ceilings enforced by the controllers. The server clamps rather
70
- # than rejects, so these are used for documentation and local clamping only.
71
- LIMITS = {
72
- "realtimeMinutes" => { min: 1, max: 120, default: 60 },
73
- "realtimeSeconds" => { min: 1, max: 600, default: 120 },
74
- "activityLimit" => { min: 1, max: 100, default: 20 },
75
- "logPageSize" => { min: 1, max: 200, default: 50 }
76
- }.freeze
77
-
78
- # The row ceiling on GET /client/logs/export.
79
- LOG_EXPORT_ROWS = 5000
80
-
81
- # Sendpipeline.EMAIL_PATTERN, character for character. \A and \z rather than
82
- # ^ and $, because Ruby's anchors match at a line break and JavaScript's do
83
- # not — the server would refuse "a@b.com\n", so this has to as well.
84
- EMAIL_PATTERN = /\A[^\s@]+@(?!-)[a-z0-9-]{1,63}(?<!-)(\.(?!-)[a-z0-9-]{1,63}(?<!-))+\z/i
85
-
86
- # Sendpipeline.PLACEHOLDER_PATTERN.
87
- PLACEHOLDER_PATTERN = /\{\{\s*([\w.-]+)\s*\}\}/
88
-
89
- # Where the API lives. Callers configure nothing but their API key, so this
90
- # has to be the real host — override it only to point at a different
91
- # deployment, with `ThousandMails::Client.new(base_url:)` or THOUSANDMAILS_BASE_URL.
92
- #
93
- # Read on each call rather than captured at load, so setting the variable
94
- # after the gem has been required still takes effect.
95
- def self.default_base_url
96
- from_env = ENV["THOUSANDMAILS_BASE_URL"]
97
- from_env.nil? || from_env.empty? ? FALLBACK_BASE_URL : from_env
98
- end
99
- end
100
- end
1
+ # frozen_string_literal: true
2
+
3
+ module ThousandMails
4
+ # Values mirrored from the server so the SDK can reject a bad request locally
5
+ # instead of spending a round trip on it.
6
+ #
7
+ # Every constant here has a counterpart in src/backend/client. When the server
8
+ # changes a limit, change it here too — the pairs are called out per entry.
9
+ module Constants
10
+ # Every client endpoint hangs off this prefix (backend/client/routes/sendmail.routes.js).
11
+ CLIENT_PREFIX = "/client"
12
+
13
+ # Milliseconds, not seconds, so the Node, PHP, Python and Ruby SDKs
14
+ # configure identically.
15
+ DEFAULT_TIMEOUT_MS = 30_000
16
+ DEFAULT_MAX_RETRIES = 2
17
+
18
+ # The host used when nothing overrides it.
19
+ FALLBACK_BASE_URL = "https://service.thousandmails.com/mailerapi"
20
+
21
+ # --- send limits ---------------------------------------------------------
22
+
23
+ # Sendpipeline.MAX_BATCH
24
+ MAX_BATCH = 100
25
+ # middleware/Attachment.MAX_ATTACHMENT_BATCH
26
+ MAX_ATTACHMENT_BATCH = 20
27
+ # middleware/Attachment.MAX_ATTACHMENTS_PER_MESSAGE
28
+ MAX_ATTACHMENTS_PER_MESSAGE = 5
29
+ # middleware/Attachment.MAX_FILE_BYTES
30
+ MAX_FILE_BYTES = 5 * 1024 * 1024
31
+ # middleware/Attachment.MAX_REQUEST_BYTES
32
+ MAX_REQUEST_BYTES = 20 * 1024 * 1024
33
+ # middleware/Attachment.MAX_FILES_PER_BATCH_REQUEST
34
+ MAX_FILES_PER_BATCH_REQUEST = 20
35
+ # middleware/Attachment.MAX_FILENAME_LENGTH
36
+ MAX_FILENAME_LENGTH = 200
37
+
38
+ # middleware/Attachment.ALLOWED_TYPES — extension => Content-Type. The server
39
+ # re-derives the type from the extension and sniffs the bytes, so the type we
40
+ # put on the multipart part is a courtesy, not a claim it trusts.
41
+ ATTACHMENT_TYPES = {
42
+ "csv" => "text/csv",
43
+ "xls" => "application/vnd.ms-excel",
44
+ "xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
45
+ "doc" => "application/msword",
46
+ "docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
47
+ "pdf" => "application/pdf",
48
+ "jpg" => "image/jpeg",
49
+ "jpeg" => "image/jpeg",
50
+ "png" => "image/png"
51
+ }.freeze
52
+
53
+ ALLOWED_EXTENSIONS = ATTACHMENT_TYPES.keys.freeze
54
+
55
+ # --- analytics -----------------------------------------------------------
56
+
57
+ # client/utils/Analytics.METRIC_FIELDS
58
+ METRIC_FIELDS = %w[
59
+ sent delivered deferred bounced opened clicked spam unsubscribed failed
60
+ ].freeze
61
+
62
+ # client/utils/Analytics.METRIC_BY_TYPE keys — the `type` on a log event.
63
+ EVENT_TYPES = %w[
64
+ queued delivered deferred bounced opened clicked spam unsubscribed failed
65
+ ].freeze
66
+
67
+ INTERVALS = %w[day week month].freeze
68
+
69
+ # Query-param ceilings enforced by the controllers. The server clamps rather
70
+ # than rejects, so these are used for documentation and local clamping only.
71
+ LIMITS = {
72
+ "realtimeMinutes" => { min: 1, max: 120, default: 60 },
73
+ "realtimeSeconds" => { min: 1, max: 600, default: 120 },
74
+ "activityLimit" => { min: 1, max: 100, default: 20 },
75
+ "logPageSize" => { min: 1, max: 200, default: 50 }
76
+ }.freeze
77
+
78
+ # The row ceiling on GET /client/logs/export.
79
+ LOG_EXPORT_ROWS = 5000
80
+
81
+ # Sendpipeline.EMAIL_PATTERN, character for character. \A and \z rather than
82
+ # ^ and $, because Ruby's anchors match at a line break and JavaScript's do
83
+ # not — the server would refuse "a@b.com\n", so this has to as well.
84
+ EMAIL_PATTERN = /\A[^\s@]+@(?!-)[a-z0-9-]{1,63}(?<!-)(\.(?!-)[a-z0-9-]{1,63}(?<!-))+\z/i
85
+
86
+ # Sendpipeline.PLACEHOLDER_PATTERN.
87
+ PLACEHOLDER_PATTERN = /\{\{\s*([\w.-]+)\s*\}\}/
88
+
89
+ # Where the API lives. Callers configure nothing but their API key, so this
90
+ # has to be the real host — override it only to point at a different
91
+ # deployment, with `ThousandMails::Client.new(base_url:)` or THOUSANDMAILS_BASE_URL.
92
+ #
93
+ # Read on each call rather than captured at load, so setting the variable
94
+ # after the gem has been required still takes effect.
95
+ def self.default_base_url
96
+ from_env = ENV["THOUSANDMAILS_BASE_URL"]
97
+ from_env.nil? || from_env.empty? ? FALLBACK_BASE_URL : from_env
98
+ end
99
+ end
100
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module ThousandMails
4
4
  # The SDK version, sent on the User-Agent.
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thousandmails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hariraghav.S