unisender-ruby 0.1.1 → 0.2.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 +4 -4
- data/CHANGELOG.md +89 -0
- data/CONTRIBUTING.md +10 -1
- data/README.md +55 -112
- data/docs/api.md +395 -210
- data/docs/execution.md +89 -0
- data/docs/import-recovery.md +41 -0
- data/docs/live-contracts.md +34 -0
- data/docs/migration-0.2.md +129 -0
- data/docs/rails.md +248 -0
- data/docs/releases.md +4 -4
- data/docs/testing.md +83 -0
- data/docs/usage.md +144 -0
- data/docs/webhooks.md +41 -0
- data/examples/campaign.rb +5 -6
- data/examples/campaign_lifecycle.rb +28 -0
- data/examples/check_connection.rb +1 -1
- data/examples/events.rb +1 -1
- data/examples/export.rb +20 -6
- data/examples/import.rb +3 -2
- data/examples/import_recovery.rb +70 -0
- data/examples/quickstart.rb +1 -1
- data/examples/subscribe.rb +2 -2
- data/lib/unisender/acceptance.rb +104 -0
- data/lib/unisender/attachment.rb +47 -0
- data/lib/unisender/batch_report.rb +115 -0
- data/lib/unisender/batch_summary.rb +87 -0
- data/lib/unisender/batches.rb +41 -12
- data/lib/unisender/campaign_workflow.rb +72 -0
- data/lib/unisender/client.rb +65 -33
- data/lib/unisender/client_configuration.rb +50 -0
- data/lib/unisender/client_execution.rb +43 -0
- data/lib/unisender/client_state.rb +31 -0
- data/lib/unisender/client_validation.rb +97 -0
- data/lib/unisender/configuration.rb +151 -0
- data/lib/unisender/contact_records.rb +251 -0
- data/lib/unisender/diagnostic_urls.rb +68 -0
- data/lib/unisender/diagnostics.rb +83 -0
- data/lib/unisender/download_target.rb +61 -0
- data/lib/unisender/download_transfer.rb +43 -0
- data/lib/unisender/downloader.rb +99 -0
- data/lib/unisender/error_diagnostics.rb +83 -0
- data/lib/unisender/errors.rb +125 -8
- data/lib/unisender/event_batches.rb +40 -0
- data/lib/unisender/event_payload.rb +50 -22
- data/lib/unisender/events.rb +21 -5
- data/lib/unisender/execution_context.rb +114 -0
- data/lib/unisender/form.rb +20 -12
- data/lib/unisender/helpers.rb +70 -10
- data/lib/unisender/hooks.rb +79 -0
- data/lib/unisender/import_cells.rb +62 -0
- data/lib/unisender/input_types.rb +30 -0
- data/lib/unisender/inputs.rb +262 -0
- data/lib/unisender/iteration.rb +15 -0
- data/lib/unisender/iterators.rb +60 -0
- data/lib/unisender/mail_inputs.rb +37 -0
- data/lib/unisender/named_inputs.rb +52 -0
- data/lib/unisender/observation.rb +30 -0
- data/lib/unisender/operation_contracts.rb +106 -0
- data/lib/unisender/operations/contacts_1.rb +4 -3
- data/lib/unisender/operations/contacts_2.rb +23 -4
- data/lib/unisender/operations/messages_1.rb +7 -4
- data/lib/unisender/operations/messages_2.rb +8 -3
- data/lib/unisender/operations/messages_3.rb +1 -1
- data/lib/unisender/operations/notes_1.rb +1 -1
- data/lib/unisender/operations/statistics_1.rb +3 -3
- data/lib/unisender/operations/templates_1.rb +2 -2
- data/lib/unisender/outcomes.rb +320 -0
- data/lib/unisender/page_response.rb +48 -0
- data/lib/unisender/paginated_operations.rb +43 -2
- data/lib/unisender/pagination.rb +53 -20
- data/lib/unisender/persistent_transport.rb +104 -0
- data/lib/unisender/rate_limiter.rb +72 -0
- data/lib/unisender/record.rb +210 -0
- data/lib/unisender/record_rows.rb +69 -0
- data/lib/unisender/records.rb +614 -0
- data/lib/unisender/request_execution.rb +108 -0
- data/lib/unisender/response.rb +13 -10
- data/lib/unisender/result_registry.rb +72 -0
- data/lib/unisender/results.rb +105 -0
- data/lib/unisender/retry_policy.rb +10 -16
- data/lib/unisender/serialization.rb +54 -0
- data/lib/unisender/statistic_records.rb +129 -0
- data/lib/unisender/task_response.rb +85 -0
- data/lib/unisender/task_waiter.rb +25 -11
- data/lib/unisender/testing/assertions.rb +48 -0
- data/lib/unisender/testing/fixtures.rb +24 -0
- data/lib/unisender/testing.rb +91 -0
- data/lib/unisender/transport.rb +17 -9
- data/lib/unisender/validation.rb +11 -9
- data/lib/unisender/version.rb +1 -1
- data/lib/unisender/webhooks/tokens.rb +38 -0
- data/lib/unisender/webhooks.rb +230 -0
- data/lib/unisender.rb +42 -0
- data/sig/acceptance.rbs +30 -0
- data/sig/attachment.rbs +15 -0
- data/sig/batch_summary.rbs +38 -0
- data/sig/campaign_workflow.rbs +20 -0
- data/sig/configuration.rbs +62 -0
- data/sig/connection_controls.rbs +55 -0
- data/sig/diagnostics.rbs +37 -0
- data/sig/domain_records.rbs +96 -0
- data/sig/downloads.rbs +53 -0
- data/sig/execution.rbs +52 -0
- data/sig/execution_context.rbs +46 -0
- data/sig/hooks.rbs +18 -0
- data/sig/inputs.rbs +84 -0
- data/sig/iterators.rbs +11 -0
- data/sig/mail_inputs.rbs +8 -0
- data/sig/manifest.yaml +11 -0
- data/sig/operation_contracts.rbs +28 -0
- data/sig/operations.rbs +73 -69
- data/sig/outcomes.rbs +90 -0
- data/sig/record.rbs +77 -0
- data/sig/records.rbs +182 -0
- data/sig/serialization.rbs +13 -0
- data/sig/tasks.rbs +26 -0
- data/sig/testing.rbs +54 -0
- data/sig/unisender.rbs +128 -39
- data/sig/webhooks.rbs +55 -0
- metadata +84 -3
data/sig/unisender.rbs
CHANGED
|
@@ -2,9 +2,10 @@ module Unisender
|
|
|
2
2
|
VERSION: String
|
|
3
3
|
|
|
4
4
|
type json = nil | bool | Integer | Float | String | Array[json] | Hash[String, json]
|
|
5
|
-
type parameter = nil | bool | Integer | Float | String | Array[parameter] | Hash[String | Symbol | Integer, parameter]
|
|
5
|
+
type parameter = nil | bool | Integer | Float | String | Symbol | Time | Attachment | Array[parameter] | Hash[String | Symbol | Integer, parameter]
|
|
6
6
|
type params = Hash[String | Symbol | Integer, parameter]
|
|
7
7
|
type duration = Integer | Float
|
|
8
|
+
type value = json | Record | Array[value]
|
|
8
9
|
|
|
9
10
|
class HTTPResponse < Data
|
|
10
11
|
attr_reader status: Integer
|
|
@@ -15,17 +16,20 @@ module Unisender
|
|
|
15
16
|
alias to_s inspect
|
|
16
17
|
end
|
|
17
18
|
|
|
18
|
-
class Response[out Result =
|
|
19
|
+
class Response[out Result = value]
|
|
19
20
|
EMPTY_WARNINGS: Array[json]
|
|
20
21
|
@data: Hash[String, json]
|
|
21
|
-
@
|
|
22
|
+
@http_status: Integer
|
|
23
|
+
@result: json | value
|
|
22
24
|
@headers: Hash[String, String]
|
|
23
25
|
attr_reader data: Hash[String, json]
|
|
24
|
-
attr_reader
|
|
26
|
+
attr_reader http_status: Integer
|
|
25
27
|
attr_reader headers: Hash[String, String]
|
|
26
|
-
def initialize: (data: Hash[String, json], status: Integer, headers: Hash[String, String]) -> void
|
|
28
|
+
def initialize: (data: Hash[String, json], status: Integer, headers: Hash[String, String], ?result: value) -> void
|
|
27
29
|
def result: () -> Result
|
|
28
30
|
def warnings: () -> json
|
|
31
|
+
def as_json: (?serialization_options?) -> json
|
|
32
|
+
def to_json: (?(serialization_options | JSON::State)?) -> String
|
|
29
33
|
def inspect: () -> String
|
|
30
34
|
private
|
|
31
35
|
def immutable: (json) -> json
|
|
@@ -33,10 +37,33 @@ module Unisender
|
|
|
33
37
|
end
|
|
34
38
|
|
|
35
39
|
class Error < StandardError
|
|
40
|
+
HINTS: Hash[Symbol, String]
|
|
36
41
|
OPERATIONS: Array[String]
|
|
37
42
|
@operation: String?
|
|
38
43
|
attr_reader operation: String?
|
|
44
|
+
@next_offset: Integer?
|
|
45
|
+
@completed_pages: Integer?
|
|
46
|
+
attr_reader next_offset: Integer?
|
|
47
|
+
attr_reader completed_pages: Integer?
|
|
48
|
+
@polling_task_uuid: String?
|
|
49
|
+
attr_reader last_response: TaskResponse?
|
|
50
|
+
@download_bytes_written: Integer?
|
|
51
|
+
def bytes_written: () -> Integer?
|
|
52
|
+
def with_download: (bytes_written: Integer) -> self
|
|
53
|
+
def task_uuid: () -> String?
|
|
54
|
+
def with_task: (task_uuid: String, last_response: TaskResponse?) -> self
|
|
55
|
+
def with_pagination: (next_offset: Integer, completed_pages: Integer) -> self
|
|
39
56
|
def with_operation: (String) -> self
|
|
57
|
+
def self.safe_operation: (String) -> String?
|
|
58
|
+
def category: () -> Symbol
|
|
59
|
+
def transient?: () -> bool
|
|
60
|
+
def safe_to_retry?: () -> bool
|
|
61
|
+
def request_id: () -> String?
|
|
62
|
+
def recovery_hint: () -> String
|
|
63
|
+
private
|
|
64
|
+
def api_category: (json) -> Symbol
|
|
65
|
+
def http_category: (Integer) -> Symbol
|
|
66
|
+
public
|
|
40
67
|
def to_s: () -> String
|
|
41
68
|
def inspect: () -> String
|
|
42
69
|
end
|
|
@@ -61,18 +88,25 @@ module Unisender
|
|
|
61
88
|
class TimeoutError < TransportError
|
|
62
89
|
end
|
|
63
90
|
class EventError < HTTPError
|
|
91
|
+
def report: () -> EventResult
|
|
64
92
|
def code: () -> json
|
|
65
93
|
def details: () -> json
|
|
66
94
|
def possibly_partially_accepted?: () -> bool
|
|
67
95
|
end
|
|
68
96
|
|
|
69
97
|
class BatchError < Error
|
|
98
|
+
attr_reader report: BatchReport | BatchSummary
|
|
70
99
|
attr_reader completed_responses: Array[Response]
|
|
71
100
|
attr_reader failed_range: Range[Integer]
|
|
72
101
|
attr_reader error: StandardError
|
|
73
|
-
def initialize: (completed_responses: Array[Response], failed_range: Range[Integer], error: StandardError) -> void
|
|
102
|
+
def initialize: (completed_responses: Array[Response], failed_range: Range[Integer], error: StandardError, ?report: (BatchReport | BatchSummary)?) -> void
|
|
103
|
+
end
|
|
104
|
+
class NotFoundError < Error
|
|
74
105
|
end
|
|
75
106
|
class PaginationError < Error
|
|
107
|
+
def next_offset: () -> Integer
|
|
108
|
+
def completed_pages: () -> Integer
|
|
109
|
+
def initialize: (operation: String, next_offset: Integer, completed_pages: Integer) -> void
|
|
76
110
|
end
|
|
77
111
|
class PartialFailure < Error
|
|
78
112
|
attr_reader response: Response
|
|
@@ -84,9 +118,14 @@ module Unisender
|
|
|
84
118
|
end
|
|
85
119
|
|
|
86
120
|
module PaginatedOperations
|
|
121
|
+
def self.supports?: (String | Symbol) -> bool
|
|
87
122
|
DEFINITIONS: Hash[String, [String, Array[Symbol], Array[Symbol], Integer?]]
|
|
88
|
-
def self.call: (Client, String | Symbol, params) ->
|
|
123
|
+
def self.call: (Client, String | Symbol, params) -> PageResponse[Record]
|
|
124
|
+
def self.prepare: (String | Symbol, params) -> params
|
|
125
|
+
def self.validate: (String | Symbol, params) -> String
|
|
89
126
|
def self.page_limit: (String | Symbol) -> Integer?
|
|
127
|
+
def self.wire_name: (String | Symbol) -> String
|
|
128
|
+
def self.validate_controls: (String | Symbol, params) -> void
|
|
90
129
|
def self.definition: (String | Symbol) -> [String, Array[Symbol], Array[Symbol], Integer?]
|
|
91
130
|
end
|
|
92
131
|
|
|
@@ -96,19 +135,28 @@ module Unisender
|
|
|
96
135
|
@page_size: Integer
|
|
97
136
|
@max_pages: Integer
|
|
98
137
|
@params: params
|
|
99
|
-
|
|
100
|
-
def
|
|
138
|
+
@first_page: PageResponse[Record]?
|
|
139
|
+
def initialize: (Client, String | Symbol, Integer, Integer, params, ?first_page: PageResponse[Record]?) -> void
|
|
140
|
+
def initialize_params: () -> void
|
|
141
|
+
def each: () -> Enumerator[PageResponse[Record], void]
|
|
142
|
+
def self.snapshot: (params) -> params
|
|
143
|
+
def self.copy: (parameter) -> parameter
|
|
101
144
|
private
|
|
102
145
|
def validate!: (Integer?) -> void
|
|
103
146
|
def validate_limit!: (Integer?) -> void
|
|
104
147
|
def page_length: (Response) -> Integer
|
|
105
148
|
def initial_offset: () -> Integer
|
|
106
149
|
def fetch_pages: (_ResponseSink, Integer) -> void
|
|
150
|
+
def fetch_page: (Integer, Integer) -> PageResponse[Record]
|
|
107
151
|
end
|
|
108
152
|
|
|
109
153
|
module Batches
|
|
110
|
-
def self.each: [T] (Enumerable[T], Integer, Integer) { (Array[T]) -> Response } -> Enumerator[Response, void]
|
|
111
|
-
def self.execute: [T] (Array[T], Integer,
|
|
154
|
+
def self.each: [T] (Enumerable[T], Integer, Integer, ?accumulator: BatchAccumulator?, ?retention: :full | :summary, ?on_progress: (^(BatchProgress) -> void)?, ?execution: ExecutionContext?) { (Array[T]) -> Response } -> Enumerator[Response, void]
|
|
155
|
+
def self.execute: [T] (Array[T], Integer, BatchAccumulator) { (Array[T]) -> Response } -> Response
|
|
156
|
+
def self.each_chunks: [T] (Enumerator[Array[T], void], ?accumulator: BatchAccumulator?, ?retention: :full | :summary, ?on_progress: (^(BatchProgress) -> void)?, ?execution: ExecutionContext?) { (Array[T]) -> Response } -> Enumerator[Response, void]
|
|
157
|
+
def self.validate_size: (Integer, Integer) -> void
|
|
158
|
+
def self.next_chunk: [T] (Enumerator[Array[T], void], Integer, BatchAccumulator, ExecutionContext?) -> Array[T]?
|
|
159
|
+
def self.progress: ((^(BatchProgress) -> void)?, BatchAccumulator, Integer, Response) -> void
|
|
112
160
|
end
|
|
113
161
|
|
|
114
162
|
class TaskWaiter
|
|
@@ -116,21 +164,27 @@ module Unisender
|
|
|
116
164
|
@client: Client
|
|
117
165
|
@clock: ^() -> Float
|
|
118
166
|
@sleeper: ^(duration) -> void
|
|
119
|
-
|
|
120
|
-
def
|
|
167
|
+
@progress: (^(TaskResponse) -> void)?
|
|
168
|
+
def initialize: (Client, clock: ^() -> Float, sleeper: ^(duration) -> void, ?progress: (^(TaskResponse) -> void)?) -> void
|
|
169
|
+
def call: (String, duration, duration) -> TaskResponse
|
|
121
170
|
private
|
|
122
171
|
def validate!: (duration, duration) -> void
|
|
123
|
-
def
|
|
124
|
-
def
|
|
172
|
+
def deadline_for: (duration, duration) -> Float
|
|
173
|
+
def poll: (String, duration, Float) -> TaskResponse
|
|
174
|
+
def complete?: (TaskResponse) -> bool
|
|
175
|
+
def wait: (duration, Float, TaskResponse) -> void
|
|
125
176
|
end
|
|
126
177
|
|
|
127
178
|
module EventPayload
|
|
128
|
-
|
|
129
|
-
def self.
|
|
130
|
-
def self.
|
|
131
|
-
def self.
|
|
132
|
-
def self.
|
|
133
|
-
def self.
|
|
179
|
+
MAX_BYTES: Integer
|
|
180
|
+
def self.encode: (parameter) -> String
|
|
181
|
+
def self.serialize: (Array[parameter]) -> String
|
|
182
|
+
def self.with_timestamp: (parameter) -> parameter
|
|
183
|
+
def self.validate: (json, String) -> Hash[String, json]
|
|
184
|
+
def self.validate_name: (json, String) -> void
|
|
185
|
+
def self.validate_email: (json, String) -> void
|
|
186
|
+
def self.normalize: (parameter, Integer, String) -> json
|
|
187
|
+
def self.normalize_hash: (params, Integer, String) -> Hash[String, json]
|
|
134
188
|
end
|
|
135
189
|
|
|
136
190
|
class RetryPolicy
|
|
@@ -142,16 +196,15 @@ module Unisender
|
|
|
142
196
|
@sleeper: ^(Float) -> void
|
|
143
197
|
@random: ^() -> Float
|
|
144
198
|
def initialize: (?max_retries: Integer, ?max_elapsed: duration, ?clock: ( ^() -> Float)?, ?sleeper: ( ^(Float) -> void)?, ?random: ( ^() -> Float)?) -> void
|
|
145
|
-
def call: [T] (String) { () -> T } -> T
|
|
199
|
+
def call: [T] (String, ?execution: ExecutionContext?) { () -> T } -> T
|
|
146
200
|
private
|
|
147
|
-
def transient?: (Error) -> bool
|
|
148
201
|
def retry_after: (Error) -> Float
|
|
149
202
|
def validate!: (Integer, duration) -> void
|
|
150
|
-
def wait?: (Error, Integer, Float) -> bool
|
|
203
|
+
def wait?: (Error, Integer, Float, ExecutionContext?, String) -> bool
|
|
151
204
|
end
|
|
152
205
|
|
|
153
206
|
module Protocol
|
|
154
|
-
def self.parse: (HTTPResponse, ?method: String?) -> Response
|
|
207
|
+
def self.parse: (HTTPResponse, ?method: String?) -> Response[json]
|
|
155
208
|
def self.result?: (Hash[String, json], String?) -> bool
|
|
156
209
|
def self.decode: (HTTPResponse) -> Hash[String, json]
|
|
157
210
|
end
|
|
@@ -160,9 +213,10 @@ module Unisender
|
|
|
160
213
|
def self.encode: (params) -> String
|
|
161
214
|
def self.pairs: (parameter, String?, Integer) -> Array[[String, String]]
|
|
162
215
|
def self.hash_pairs: (params, String?, Integer) -> Array[[String, String]]
|
|
216
|
+
def self.key_name: (String | Symbol | Integer) -> String
|
|
163
217
|
def self.scalar: (parameter, String) -> String
|
|
164
|
-
def self.numeric: (parameter) -> String
|
|
165
|
-
def self.text: (String) -> String
|
|
218
|
+
def self.numeric: (parameter, ?String) -> String
|
|
219
|
+
def self.text: (String, ?String) -> String
|
|
166
220
|
end
|
|
167
221
|
|
|
168
222
|
module Validation
|
|
@@ -174,7 +228,7 @@ module Unisender
|
|
|
174
228
|
def self.rows!: (parameter, Integer) -> void
|
|
175
229
|
def self.required!: (params, Array[String]) -> void
|
|
176
230
|
def self.missing?: (parameter) -> bool
|
|
177
|
-
def self.comma_list: (Array[parameter]) -> String
|
|
231
|
+
def self.comma_list: (Array[parameter], ?field: String) -> String
|
|
178
232
|
end
|
|
179
233
|
|
|
180
234
|
interface _Transport
|
|
@@ -191,28 +245,63 @@ module Unisender
|
|
|
191
245
|
@write_timeout: duration
|
|
192
246
|
@http_factory: ^(URI::Generic) -> Net::HTTP
|
|
193
247
|
def initialize: (?open_timeout: duration, ?read_timeout: duration, ?write_timeout: duration, ?http_factory: (^(URI::Generic) -> Net::HTTP)?) -> void
|
|
194
|
-
def post: (URI::Generic, headers: Hash[String, String], body: String) -> HTTPResponse
|
|
248
|
+
def post: (URI::Generic, headers: Hash[String, String], body: String, ?execution: ExecutionContext?) -> HTTPResponse
|
|
195
249
|
private
|
|
196
|
-
def configured_http: (URI::Generic) -> Net::HTTP
|
|
197
|
-
def
|
|
250
|
+
def configured_http: (URI::Generic, ?execution: ExecutionContext?) -> Net::HTTP
|
|
251
|
+
def configure_timeouts: (Net::HTTP, ExecutionContext?) -> duration
|
|
252
|
+
def exchange: (URI::Generic, headers: Hash[String, String], body: String, execution: ExecutionContext?) -> HTTPResponse
|
|
253
|
+
def perform: (URI::Generic, Net::HTTPRequest, execution: ExecutionContext?) -> Net::HTTPResponse
|
|
198
254
|
end
|
|
199
255
|
|
|
200
256
|
class Client
|
|
201
257
|
RESERVED_PARAMETERS: Array[String]
|
|
258
|
+
TASK_METHODS: Array[String]
|
|
259
|
+
UNSET: Symbol
|
|
260
|
+
EMAIL_REQUIRED: Array[String]
|
|
261
|
+
CAMPAIGN_REQUIRED: Array[String]
|
|
262
|
+
@configuration: Configuration
|
|
202
263
|
@api_key: String
|
|
203
264
|
@language: String
|
|
204
265
|
@transport: _Transport
|
|
205
266
|
@retry_policy: RetryPolicy
|
|
206
|
-
def initialize: (api_key: String, ?transport: _Transport
|
|
207
|
-
def
|
|
208
|
-
def
|
|
209
|
-
def
|
|
210
|
-
def
|
|
211
|
-
def
|
|
212
|
-
def
|
|
267
|
+
def initialize: (api_key: String, ?language: String | Symbol, ?transport: _Transport?, ?retry_policy: RetryPolicy?, ?open_timeout: duration?, ?read_timeout: duration?, ?write_timeout: duration?, ?max_retries: Integer?, ?max_elapsed: duration?, ?message_defaults: Hash[String | Symbol, String?], ?instrumentation: (^(RequestEvent) -> void)?, ?persistent: bool, ?rate_limiter: RateLimiter?, ?event_rate_limiter: RateLimiter?, ?acceptance_instrumentation: (^(AcceptanceEvent) -> void)?) -> void
|
|
268
|
+
def self.from_env: (?env: _Environment, ?language: String | Symbol, ?transport: _Transport?, ?retry_policy: RetryPolicy?, ?open_timeout: duration?, ?read_timeout: duration?, ?write_timeout: duration?, ?max_retries: Integer?, ?max_elapsed: duration?, ?message_defaults: Hash[String | Symbol, String?], ?instrumentation: (^(RequestEvent) -> void)?, ?persistent: bool, ?rate_limiter: RateLimiter?, ?event_rate_limiter: RateLimiter?, ?acceptance_instrumentation: (^(AcceptanceEvent) -> void)?) -> Client
|
|
269
|
+
def close: () -> void
|
|
270
|
+
def self.open: [Result] (api_key: String, **config_value) { (Client) -> Result } -> Result
|
|
271
|
+
def with: (?api_key: String, ?language: String | Symbol, ?transport: _Transport?, ?retry_policy: RetryPolicy?, ?open_timeout: duration?, ?read_timeout: duration?, ?write_timeout: duration?, ?max_retries: Integer?, ?max_elapsed: duration?, ?message_defaults: Hash[String | Symbol, String?], ?instrumentation: (^(RequestEvent) -> void)?, ?persistent: bool, ?rate_limiter: RateLimiter?, ?event_rate_limiter: RateLimiter?, ?acceptance_instrumentation: (^(AcceptanceEvent) -> void)?) -> Client
|
|
272
|
+
def request: (String, ?params: params) -> Response[json]
|
|
273
|
+
def track_events: (events: Array[params]) -> EventResponse
|
|
274
|
+
def each_page: (String | Symbol, ?page_size: Integer, ?max_pages: Integer, **parameter) ?{ (PageResponse[Record]) -> void } -> Enumerator[PageResponse[Record], void]
|
|
275
|
+
def import_contacts_in_batches: (?field_names: Array[String]?, ?data: Enumerable[Array[parameter]]?, ?records: Enumerable[params]?, ?batch_size: Integer, ?overwrite_tags: flag?, ?overwrite_lists: flag?, ?telegram_bot_channel_id: String?, ?retention: :full, ?on_progress: (^(BatchProgress) -> void)?) -> BatchReport
|
|
276
|
+
| (?field_names: Array[String]?, ?data: Enumerable[Array[parameter]]?, ?records: Enumerable[params]?, ?batch_size: Integer, ?overwrite_tags: flag?, ?overwrite_lists: flag?, ?telegram_bot_channel_id: String?, retention: :summary, ?on_progress: (^(BatchProgress) -> void)?) -> BatchSummary
|
|
277
|
+
def each_import_batch: (?field_names: Array[String]?, ?data: Enumerable[Array[parameter]]?, ?records: Enumerable[params]?, ?batch_size: Integer, ?overwrite_tags: flag?, ?overwrite_lists: flag?, ?telegram_bot_channel_id: String?, ?retention: :full | :summary, ?on_progress: (^(BatchProgress) -> void)?) ?{ (Response) -> void } -> Enumerator[Response, void]
|
|
278
|
+
def track_events_in_batches: (events: Enumerable[params], ?batch_size: Integer, ?retention: :full, ?on_progress: (^(BatchProgress) -> void)?) -> BatchReport
|
|
279
|
+
| (events: Enumerable[params], ?batch_size: Integer, retention: :summary, ?on_progress: (^(BatchProgress) -> void)?) -> BatchSummary
|
|
280
|
+
def each_event_batch: (events: Enumerable[params], ?batch_size: Integer, ?retention: :full | :summary, ?on_progress: (^(BatchProgress) -> void)?) ?{ (Response) -> void } -> Enumerator[Response, void]
|
|
281
|
+
def wait_for_task: (task_uuid: String, ?interval: duration, ?timeout: duration, ?clock: ( ^() -> Float)?, ?sleeper: ( ^(duration) -> void)?) ?{ (TaskResponse) -> void } -> TaskResponse
|
|
282
|
+
def contact_in_lists?: (email: String, list_ids: String | Array[id], condition: :any | :all) -> bool
|
|
213
283
|
def inspect: () -> String
|
|
214
284
|
private
|
|
215
|
-
def
|
|
285
|
+
def import_batches: (field_names: Array[String]?, data: Enumerable[Array[parameter]]?, records: Enumerable[params]?, batch_size: Integer, overwrite_tags: flag?, overwrite_lists: flag?, telegram_bot_channel_id: String?, ?accumulator: BatchAccumulator?, ?retention: :full | :summary, ?on_progress: (^(BatchProgress) -> void)?) -> Enumerator[Response, void]
|
|
286
|
+
def event_batches: (Enumerable[params], Integer, ?accumulator: BatchAccumulator?, ?retention: :full | :summary, ?on_progress: (^(BatchProgress) -> void)?) -> Enumerator[Response, void]
|
|
287
|
+
def message_defaults: (params) -> params
|
|
288
|
+
def post_request: (URI::Generic, Hash[String, String], String) -> HTTPResponse
|
|
289
|
+
def request_values: (String, params) -> [URI::Generic, Hash[String, String], String]
|
|
290
|
+
def perform_request: (String, params, named: bool) -> Response
|
|
291
|
+
def with_retries: [Result] (String) { () -> Result } -> Result
|
|
292
|
+
def acquire_limit: (String) -> void
|
|
293
|
+
def decode_response: (HTTPResponse, String, params, bool) -> Response
|
|
294
|
+
def observe: (String, Integer, Float, HTTPResponse?, Exception?) -> void
|
|
295
|
+
def exchange: [Result] (String, URI::Generic, headers: Hash[String, String], body: String, ?attempt: Integer, ?input_count: Integer?) { (HTTPResponse) -> Result } -> Result
|
|
296
|
+
def bind_task: (String, Response, params) -> Response
|
|
297
|
+
def import_source: (Array[String]?, Enumerable[Array[parameter]]?, Enumerable[params]?) -> (RecordRows | Enumerable[Array[parameter]])
|
|
298
|
+
def parse_event_response: (HTTPResponse) -> EventResponse
|
|
299
|
+
def decode_event_response: (HTTPResponse, Integer) -> EventResponse
|
|
300
|
+
def prepare: (String, params, ?required: Array[String], ?comma: Array[String]) -> params
|
|
301
|
+
def comma_parameters: (params, Array[String]) -> params
|
|
302
|
+
public
|
|
303
|
+
def invoke: [Result] (String, params, ?required: Array[String], ?comma: Array[String]) -> Result
|
|
304
|
+
private
|
|
216
305
|
def validate_request: (String, params) -> void
|
|
217
306
|
end
|
|
218
307
|
end
|
data/sig/webhooks.rbs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Unisender
|
|
2
|
+
class WebhookError < Error
|
|
3
|
+
attr_reader reason: Symbol
|
|
4
|
+
def initialize: (Symbol) -> void
|
|
5
|
+
end
|
|
6
|
+
class WebhookEvent < Record
|
|
7
|
+
def event_name: () -> String
|
|
8
|
+
def event_time: () -> String
|
|
9
|
+
def event_data: () -> Record
|
|
10
|
+
def normalize: () -> void
|
|
11
|
+
end
|
|
12
|
+
class WebhookUser < Record
|
|
13
|
+
def login: () -> String
|
|
14
|
+
def events: () -> Array[WebhookEvent]
|
|
15
|
+
def normalize: () -> void
|
|
16
|
+
end
|
|
17
|
+
class WebhookNotification < Record
|
|
18
|
+
def users: () -> Array[WebhookUser]
|
|
19
|
+
def events: () -> Array[WebhookEvent]
|
|
20
|
+
def normalize: () -> void
|
|
21
|
+
end
|
|
22
|
+
module Webhooks
|
|
23
|
+
class ObjectKeys
|
|
24
|
+
@seen: Hash[String, bool]
|
|
25
|
+
attr_reader key: String?
|
|
26
|
+
def initialize: () -> void
|
|
27
|
+
def register: (String) -> void
|
|
28
|
+
def next_key: () -> nil
|
|
29
|
+
end
|
|
30
|
+
def self.verify: (body: String, api_key: String, ?content_encoding: String?, ?max_bytes: Integer, ?max_decompressed_bytes: Integer, ?max_events: Integer) -> WebhookNotification
|
|
31
|
+
def self.validate_limits: (*Integer) -> void
|
|
32
|
+
def self.decompress: (String, String?, Integer) -> String
|
|
33
|
+
def self.bounded: (String, Integer) -> String
|
|
34
|
+
def self.inflate: (String, Integer) -> String
|
|
35
|
+
def self.decode: (String) -> Hash[String, json]
|
|
36
|
+
def self.authenticate: (String, Hash[String, json], String) -> void
|
|
37
|
+
def self.auth_value: (Hash[String, json]) -> String
|
|
38
|
+
def self.secure_equal?: (String, String) -> bool
|
|
39
|
+
def self.auth_span: (String) -> [Integer, Integer]
|
|
40
|
+
def self.register_string: (Array[ObjectKeys?], String, Integer, Integer) -> [Integer, Integer]?
|
|
41
|
+
class Tokens
|
|
42
|
+
@text: String
|
|
43
|
+
def initialize: (String) -> void
|
|
44
|
+
def each: () { (String, Integer, Integer) -> void } -> void
|
|
45
|
+
private
|
|
46
|
+
def read: (Integer) -> [String, Integer]
|
|
47
|
+
def string_end: (Integer) -> Integer
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# GzipReader accepts a read-compatible StringIO in the Ruby standard library.
|
|
53
|
+
class Zlib::GzipReader
|
|
54
|
+
def self.new: (StringIO) -> Zlib::GzipReader
|
|
55
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unisender-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Leonid Svyatov
|
|
@@ -23,23 +23,62 @@ files:
|
|
|
23
23
|
- README.md
|
|
24
24
|
- SECURITY.md
|
|
25
25
|
- docs/api.md
|
|
26
|
+
- docs/execution.md
|
|
27
|
+
- docs/import-recovery.md
|
|
28
|
+
- docs/live-contracts.md
|
|
29
|
+
- docs/migration-0.2.md
|
|
30
|
+
- docs/rails.md
|
|
26
31
|
- docs/releases.md
|
|
32
|
+
- docs/testing.md
|
|
33
|
+
- docs/usage.md
|
|
34
|
+
- docs/webhooks.md
|
|
27
35
|
- examples/campaign.rb
|
|
36
|
+
- examples/campaign_lifecycle.rb
|
|
28
37
|
- examples/check_connection.rb
|
|
29
38
|
- examples/events.rb
|
|
30
39
|
- examples/export.rb
|
|
31
40
|
- examples/import.rb
|
|
41
|
+
- examples/import_recovery.rb
|
|
32
42
|
- examples/offline.rb
|
|
33
43
|
- examples/quickstart.rb
|
|
34
44
|
- examples/subscribe.rb
|
|
35
45
|
- lib/unisender.rb
|
|
46
|
+
- lib/unisender/acceptance.rb
|
|
47
|
+
- lib/unisender/attachment.rb
|
|
48
|
+
- lib/unisender/batch_report.rb
|
|
49
|
+
- lib/unisender/batch_summary.rb
|
|
36
50
|
- lib/unisender/batches.rb
|
|
51
|
+
- lib/unisender/campaign_workflow.rb
|
|
37
52
|
- lib/unisender/client.rb
|
|
53
|
+
- lib/unisender/client_configuration.rb
|
|
54
|
+
- lib/unisender/client_execution.rb
|
|
55
|
+
- lib/unisender/client_state.rb
|
|
56
|
+
- lib/unisender/client_validation.rb
|
|
57
|
+
- lib/unisender/configuration.rb
|
|
58
|
+
- lib/unisender/contact_records.rb
|
|
59
|
+
- lib/unisender/diagnostic_urls.rb
|
|
60
|
+
- lib/unisender/diagnostics.rb
|
|
61
|
+
- lib/unisender/download_target.rb
|
|
62
|
+
- lib/unisender/download_transfer.rb
|
|
63
|
+
- lib/unisender/downloader.rb
|
|
64
|
+
- lib/unisender/error_diagnostics.rb
|
|
38
65
|
- lib/unisender/errors.rb
|
|
66
|
+
- lib/unisender/event_batches.rb
|
|
39
67
|
- lib/unisender/event_payload.rb
|
|
40
68
|
- lib/unisender/events.rb
|
|
69
|
+
- lib/unisender/execution_context.rb
|
|
41
70
|
- lib/unisender/form.rb
|
|
42
71
|
- lib/unisender/helpers.rb
|
|
72
|
+
- lib/unisender/hooks.rb
|
|
73
|
+
- lib/unisender/import_cells.rb
|
|
74
|
+
- lib/unisender/input_types.rb
|
|
75
|
+
- lib/unisender/inputs.rb
|
|
76
|
+
- lib/unisender/iteration.rb
|
|
77
|
+
- lib/unisender/iterators.rb
|
|
78
|
+
- lib/unisender/mail_inputs.rb
|
|
79
|
+
- lib/unisender/named_inputs.rb
|
|
80
|
+
- lib/unisender/observation.rb
|
|
81
|
+
- lib/unisender/operation_contracts.rb
|
|
43
82
|
- lib/unisender/operations/contacts_1.rb
|
|
44
83
|
- lib/unisender/operations/contacts_2.rb
|
|
45
84
|
- lib/unisender/operations/inputs_1.rb
|
|
@@ -50,17 +89,59 @@ files:
|
|
|
50
89
|
- lib/unisender/operations/statistics_1.rb
|
|
51
90
|
- lib/unisender/operations/statistics_2.rb
|
|
52
91
|
- lib/unisender/operations/templates_1.rb
|
|
92
|
+
- lib/unisender/outcomes.rb
|
|
93
|
+
- lib/unisender/page_response.rb
|
|
53
94
|
- lib/unisender/paginated_operations.rb
|
|
54
95
|
- lib/unisender/pagination.rb
|
|
96
|
+
- lib/unisender/persistent_transport.rb
|
|
55
97
|
- lib/unisender/protocol.rb
|
|
98
|
+
- lib/unisender/rate_limiter.rb
|
|
99
|
+
- lib/unisender/record.rb
|
|
100
|
+
- lib/unisender/record_rows.rb
|
|
101
|
+
- lib/unisender/records.rb
|
|
102
|
+
- lib/unisender/request_execution.rb
|
|
56
103
|
- lib/unisender/response.rb
|
|
104
|
+
- lib/unisender/result_registry.rb
|
|
105
|
+
- lib/unisender/results.rb
|
|
57
106
|
- lib/unisender/retry_policy.rb
|
|
107
|
+
- lib/unisender/serialization.rb
|
|
108
|
+
- lib/unisender/statistic_records.rb
|
|
109
|
+
- lib/unisender/task_response.rb
|
|
58
110
|
- lib/unisender/task_waiter.rb
|
|
111
|
+
- lib/unisender/testing.rb
|
|
112
|
+
- lib/unisender/testing/assertions.rb
|
|
113
|
+
- lib/unisender/testing/fixtures.rb
|
|
59
114
|
- lib/unisender/transport.rb
|
|
60
115
|
- lib/unisender/validation.rb
|
|
61
116
|
- lib/unisender/version.rb
|
|
117
|
+
- lib/unisender/webhooks.rb
|
|
118
|
+
- lib/unisender/webhooks/tokens.rb
|
|
119
|
+
- sig/acceptance.rbs
|
|
120
|
+
- sig/attachment.rbs
|
|
121
|
+
- sig/batch_summary.rbs
|
|
122
|
+
- sig/campaign_workflow.rbs
|
|
123
|
+
- sig/configuration.rbs
|
|
124
|
+
- sig/connection_controls.rbs
|
|
125
|
+
- sig/diagnostics.rbs
|
|
126
|
+
- sig/domain_records.rbs
|
|
127
|
+
- sig/downloads.rbs
|
|
128
|
+
- sig/execution.rbs
|
|
129
|
+
- sig/execution_context.rbs
|
|
130
|
+
- sig/hooks.rbs
|
|
131
|
+
- sig/inputs.rbs
|
|
132
|
+
- sig/iterators.rbs
|
|
133
|
+
- sig/mail_inputs.rbs
|
|
134
|
+
- sig/manifest.yaml
|
|
135
|
+
- sig/operation_contracts.rbs
|
|
62
136
|
- sig/operations.rbs
|
|
137
|
+
- sig/outcomes.rbs
|
|
138
|
+
- sig/record.rbs
|
|
139
|
+
- sig/records.rbs
|
|
140
|
+
- sig/serialization.rbs
|
|
141
|
+
- sig/tasks.rbs
|
|
142
|
+
- sig/testing.rbs
|
|
63
143
|
- sig/unisender.rbs
|
|
144
|
+
- sig/webhooks.rbs
|
|
64
145
|
homepage: https://github.com/svyatov/unisender-ruby
|
|
65
146
|
licenses:
|
|
66
147
|
- MIT
|
|
@@ -68,8 +149,8 @@ metadata:
|
|
|
68
149
|
rubygems_mfa_required: 'true'
|
|
69
150
|
source_code_uri: https://github.com/svyatov/unisender-ruby
|
|
70
151
|
bug_tracker_uri: https://github.com/svyatov/unisender-ruby/issues
|
|
71
|
-
documentation_uri: https://github.com/svyatov/unisender-ruby/blob/
|
|
72
|
-
changelog_uri: https://github.com/svyatov/unisender-ruby/blob/
|
|
152
|
+
documentation_uri: https://github.com/svyatov/unisender-ruby/blob/v0.2.0/README.md
|
|
153
|
+
changelog_uri: https://github.com/svyatov/unisender-ruby/blob/v0.2.0/CHANGELOG.md
|
|
73
154
|
rdoc_options: []
|
|
74
155
|
require_paths:
|
|
75
156
|
- lib
|