bzapper 0.14.0 → 0.15.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/README.md +2 -2
- data/lib/bzapper/resources/templates.rb +67 -4
- data/lib/bzapper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ba14c87559d90cbd5a325eab687fd6583e59074bc863923812a9f24e3f70f1e
|
|
4
|
+
data.tar.gz: 3f76da97b6a4e96077f39188a435e952dd1df29d953943abb454c920ccc72e38
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6628e2114fe558cbfdf7c67d0817fa69ace57b21ddad8a75a0e52f8587afdf5be1ab83269f6d3bf0955acd194c6133408d97bee16ca87a6782b636ba1182e052
|
|
7
|
+
data.tar.gz: e3197eb515d030707317134b12544d782c3ea99936ee412956a9d784e3580ba6ee5e1f54a2dd07b9402e8d76bcafa7e33d5d49526bfc29cdab61381ce84346f8
|
data/README.md
CHANGED
|
@@ -10,13 +10,13 @@ Zero dependências de runtime (só biblioteca padrão: `net/http`, `json`, `open
|
|
|
10
10
|
## Instalação
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
gem install bzapper -v 0.
|
|
13
|
+
gem install bzapper -v 0.15.0
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Ou no `Gemfile` — **fixe a versão exata** (cada release declara se muda a superfície pública):
|
|
17
17
|
|
|
18
18
|
```ruby
|
|
19
|
-
gem "bzapper", "0.
|
|
19
|
+
gem "bzapper", "0.15.0"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Hello world
|
|
@@ -221,6 +221,67 @@ module Bzapper
|
|
|
221
221
|
timeout: timeout)
|
|
222
222
|
end
|
|
223
223
|
|
|
224
|
+
# Check a template against Meta's rules without submitting it. `POST /templates/validate`
|
|
225
|
+
#
|
|
226
|
+
# The same validation as creation (variables, examples, lengths, buttons, category rules, offer
|
|
227
|
+
# and carousel rules, a repeated name), with no call to Meta and no submission spent. Use it
|
|
228
|
+
# while the template is being written — the panel does — to never send what Meta would reject.
|
|
229
|
+
# `?id=` checks an edit (its own name does not count as repeated; an approved template cannot
|
|
230
|
+
# change category).
|
|
231
|
+
#
|
|
232
|
+
# @param id [String, nil] (query) Template being edited.
|
|
233
|
+
# @param name [String] (corpo) Lowercase letters, numbers and _. This is the name you send by.
|
|
234
|
+
# @param language [String] (corpo) e.g. pt_BR. Both pt-BR and pt_BR are accepted.
|
|
235
|
+
# @param category [String] (corpo) Decides what the conversation COSTS and what Meta accepts in
|
|
236
|
+
# the content — not an administrative label. UTILITY is cheaper but only covers what the
|
|
237
|
+
# customer already expects; promotional wording in it gets reclassified, and the price changes
|
|
238
|
+
# with it.
|
|
239
|
+
# @param header [Hash, nil] (corpo)
|
|
240
|
+
# @param body [Hash] (corpo)
|
|
241
|
+
# @param footer [String, nil] (corpo) Up to 60 characters. Accepts no variables.
|
|
242
|
+
# @param buttons [Array<Hash>, nil] (corpo)
|
|
243
|
+
# @param code_expiry_minutes [Integer, nil] (corpo) AUTHENTICATION only, 1 to 90. In that
|
|
244
|
+
# category Meta writes the text itself and adds the copy-code button; this is the only thing you
|
|
245
|
+
# set.
|
|
246
|
+
# @param limited_time_offer [Hash, nil] (corpo) MARKETING only. Turns the template into a
|
|
247
|
+
# limited-time offer: a badge (up to 16 characters) and, with `has_expiration`, a countdown to
|
|
248
|
+
# the deadline sent in `offer_expires_at`. No footer; header only image or video; needs a URL
|
|
249
|
+
# button (and, with a deadline, the copy-code button).
|
|
250
|
+
# @param cards [Array<Hash>, nil] (corpo) Carousel (MARKETING or UTILITY): 2 to 10 cards. The
|
|
251
|
+
# template keeps only the opening `body`; each card has its own image or video, text (up to 160
|
|
252
|
+
# characters) and 1–2 buttons (quick reply, URL or phone). Meta requires the same media type and
|
|
253
|
+
# the same button types, in the same order, on every card.
|
|
254
|
+
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
255
|
+
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
256
|
+
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
257
|
+
# @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
|
|
258
|
+
def validate_template(name:, language:, category:, body:, id: nil, header: UNSET,
|
|
259
|
+
footer: UNSET, buttons: UNSET, code_expiry_minutes: UNSET,
|
|
260
|
+
limited_time_offer: UNSET, cards: UNSET, idempotency_key: nil,
|
|
261
|
+
timeout: nil)
|
|
262
|
+
query = {
|
|
263
|
+
"id" => id
|
|
264
|
+
}
|
|
265
|
+
payload = compact(
|
|
266
|
+
"name" => name,
|
|
267
|
+
"language" => language,
|
|
268
|
+
"category" => category,
|
|
269
|
+
"header" => header,
|
|
270
|
+
"body" => body,
|
|
271
|
+
"footer" => footer,
|
|
272
|
+
"buttons" => buttons,
|
|
273
|
+
"code_expiry_minutes" => code_expiry_minutes,
|
|
274
|
+
"limited_time_offer" => limited_time_offer,
|
|
275
|
+
"cards" => cards
|
|
276
|
+
)
|
|
277
|
+
request("POST",
|
|
278
|
+
"/templates/validate",
|
|
279
|
+
query: query,
|
|
280
|
+
body: payload,
|
|
281
|
+
idempotency_key: idempotency_key,
|
|
282
|
+
timeout: timeout)
|
|
283
|
+
end
|
|
284
|
+
|
|
224
285
|
# Performance of each template (sent, delivered, read, failed). `GET /templates/analytics`
|
|
225
286
|
#
|
|
226
287
|
# Counted from the messages sent through each template in the last `days` days, grouped by
|
|
@@ -305,10 +366,12 @@ module Bzapper
|
|
|
305
366
|
# /templates/otp`
|
|
306
367
|
#
|
|
307
368
|
# Must be an APPROVED template of the Authentication category or — until Meta releases that
|
|
308
|
-
# category for the account (business verification + 2,000 daily limit) — a provisional
|
|
309
|
-
#
|
|
310
|
-
#
|
|
311
|
-
#
|
|
369
|
+
# category for the account (business verification + 2,000 daily limit) — a provisional template:
|
|
370
|
+
# MARKETING with a copy-code button and at most one body variable (the customer copies only the
|
|
371
|
+
# code; Meta accepts that button only in Marketing — costlier, and not delivered to people who
|
|
372
|
+
# opted out of marketing), or UTILITY with exactly one body variable that receives the code in
|
|
373
|
+
# the text. An empty `template_id` clears the choice (the first approved Authentication template
|
|
374
|
+
# is used again).
|
|
312
375
|
#
|
|
313
376
|
# @param template_id [String, nil] (corpo) Empty clears the choice.
|
|
314
377
|
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
data/lib/bzapper/version.rb
CHANGED