bzapper 0.9.3 → 0.10.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: 2de73e1893deff0a3dd72bce246825e27d6c7683be57a01f4c9a3c81d55d28ed
4
- data.tar.gz: a661bd96fe3819a7c35b63a89e9d3dc2773568d29aa93f9dbdff20f9208c1153
3
+ metadata.gz: 84d17cde4c28892c1f57d54e891bf6bf1d9b68e711046f8276515f775922d8da
4
+ data.tar.gz: d44bcc3fdda4b5e4e66d02972b0e8b7b0434a61e92d0cf059ef0f6149be1caf4
5
5
  SHA512:
6
- metadata.gz: 88041c2ced6cfb00307dbf710e6e86ba9a6dd4a9f0db5bcc66f0a44446993d12fce5f8e45f6f1e6c15408ef820d14a739b648ec0d524ddfc6353e0e67e2c3c91
7
- data.tar.gz: 4053e5387e460a5bf50944304e14d9b18a8315ef2db4e1690782d9f95d3e0a8f52813b74b60ee9ee4256e933ac086eb744c3feec262f39256dece3b83e540dc3
6
+ metadata.gz: b8104c3e9059859bba1ca20c5b5a8281b47b3939c23358139549e8cb503bd2b8b0a921dd0d94bda75b85a3c8524d336d29545c6fe330b81ae0cec3c84c95750b
7
+ data.tar.gz: d712bbd689f1f8cf9559162ddbe6a4c2720398f79b88dfbf3ec0c22a40ee383411165e6307092d4a7af0375a3d456be5ae9aa8019ca26f774ce23816ea24b103
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.9.3
13
+ gem install bzapper -v 0.10.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.9.3"
19
+ gem "bzapper", "0.10.0"
20
20
  ```
21
21
 
22
22
  ## Hello world
@@ -76,6 +76,53 @@ module Bzapper
76
76
  request("GET", "/templates/#{segment(id, "id")}", timeout: timeout)
77
77
  end
78
78
 
79
+ # Edit a template (content goes back to Meta review). `PUT /templates/{id}`
80
+ #
81
+ # Same body as creation; `name` and `language` are the template identity and do not change. Meta
82
+ # allows editing an APPROVED template once every 24 hours and ten times in 30 days (rejected or
83
+ # paused: no limit), sends it back to review (the template returns to `PENDING` and does not
84
+ # send until the decision arrives by webhook) and does not let an approved template change
85
+ # category.
86
+ #
87
+ # @param id [String] parâmetro de caminho
88
+ # @param name [String] (corpo) Lowercase letters, numbers and _. This is the name you send by.
89
+ # @param language [String] (corpo) e.g. pt_BR. Both pt-BR and pt_BR are accepted.
90
+ # @param category [String] (corpo) Decides what the conversation COSTS and what Meta accepts in
91
+ # the content — not an administrative label. UTILITY is cheaper but only covers what the
92
+ # customer already expects; promotional wording in it gets reclassified, and the price changes
93
+ # with it.
94
+ # @param header [Hash, nil] (corpo)
95
+ # @param body [Hash] (corpo)
96
+ # @param footer [String, nil] (corpo) Up to 60 characters. Accepts no variables.
97
+ # @param buttons [Array<Hash>, nil] (corpo)
98
+ # @param code_expiry_minutes [Integer, nil] (corpo) AUTHENTICATION only, 1 to 90. In that
99
+ # category Meta writes the text itself and adds the copy-code button; this is the only thing you
100
+ # set.
101
+ # @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
102
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
103
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
104
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
105
+ # @raise [ArgumentError] parâmetro de caminho vazio, "." ou "..".
106
+ def edit_template(id, name:, language:, category:, body:, header: UNSET, footer: UNSET,
107
+ buttons: UNSET, code_expiry_minutes: UNSET, idempotency_key: nil,
108
+ timeout: nil)
109
+ payload = compact(
110
+ "name" => name,
111
+ "language" => language,
112
+ "category" => category,
113
+ "header" => header,
114
+ "body" => body,
115
+ "footer" => footer,
116
+ "buttons" => buttons,
117
+ "code_expiry_minutes" => code_expiry_minutes
118
+ )
119
+ request("PUT",
120
+ "/templates/#{segment(id, "id")}",
121
+ body: payload,
122
+ idempotency_key: idempotency_key,
123
+ timeout: timeout)
124
+ end
125
+
79
126
  # Delete a template. `DELETE /templates/{id}`
80
127
  #
81
128
  # Removes it here and at Meta. Meta deletes ALL languages of a name at once — so when another
@@ -95,6 +142,65 @@ module Bzapper
95
142
  timeout: timeout)
96
143
  end
97
144
 
145
+ # Browse Meta's Template Library (ready-made utility and authentication texts). `GET
146
+ # /templates/library`
147
+ #
148
+ # Texts Meta has already approved. A template created from one of them without changing the text
149
+ # is approved immediately — no 24-hour review.
150
+ #
151
+ # @param search [String, nil] (query) Free text: order, delivery, payment…
152
+ # @param topic [String, nil] (query)
153
+ # @param usecase [String, nil] (query)
154
+ # @param industry [String, nil] (query)
155
+ # @param language [String, nil] (query) e.g. pt_BR.
156
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
157
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
158
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
159
+ def list_library_templates(search: nil, topic: nil, usecase: nil, industry: nil,
160
+ language: nil, timeout: nil)
161
+ query = {
162
+ "search" => search,
163
+ "topic" => topic,
164
+ "usecase" => usecase,
165
+ "industry" => industry,
166
+ "language" => language
167
+ }
168
+ request("GET", "/templates/library", query: query, timeout: timeout)
169
+ end
170
+
171
+ # Create a template from the Template Library. `POST /templates/library`
172
+ #
173
+ # The text is Meta's, unchanged — that is what makes it approved at once. You only provide what
174
+ # the buttons need: the site link of a URL button (with an example of the variable suffix, when
175
+ # there is one) or the phone of a call button. Authentication items take `code_expiry_minutes`.
176
+ #
177
+ # @param library_template_name [String] (corpo)
178
+ # @param name [String, nil] (corpo) Your template name (defaults to the library name).
179
+ # @param language [String] (corpo)
180
+ # @param button_inputs [Array<Hash>, nil] (corpo) What each URL / phone button of the library
181
+ # template needs, in order.
182
+ # @param code_expiry_minutes [Integer, nil] (corpo) Authentication items only (default 10).
183
+ # @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
184
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
185
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
186
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
187
+ def create_template_from_library(library_template_name:, language:, name: UNSET,
188
+ button_inputs: UNSET, code_expiry_minutes: UNSET,
189
+ idempotency_key: nil, timeout: nil)
190
+ payload = compact(
191
+ "library_template_name" => library_template_name,
192
+ "name" => name,
193
+ "language" => language,
194
+ "button_inputs" => button_inputs,
195
+ "code_expiry_minutes" => code_expiry_minutes
196
+ )
197
+ request("POST",
198
+ "/templates/library",
199
+ body: payload,
200
+ idempotency_key: idempotency_key,
201
+ timeout: timeout)
202
+ end
203
+
98
204
  # Import templates that exist at Meta and not here. `POST /templates/sync`
99
205
  #
100
206
  # For the account that already used the Cloud API before bZapper and created templates in
@@ -162,9 +268,11 @@ module Bzapper
162
268
  # Choose the template that carries the verification code outside the window. `PUT
163
269
  # /templates/otp`
164
270
  #
165
- # Must be an APPROVED template of the Authentication category — Meta accepts codes in no other
166
- # category. An empty `template_id` clears the choice (the first approved Authentication template
167
- # is used again).
271
+ # Must be an APPROVED template of the Authentication category or — until Meta releases that
272
+ # category for the account (business verification + 2,000 daily limit) — a provisional Utility
273
+ # template with a copy-code button and at most one body variable; the code goes in the variable
274
+ # and in the button. An empty `template_id` clears the choice (the first approved Authentication
275
+ # template is used again).
168
276
  #
169
277
  # @param template_id [String, nil] (corpo) Empty clears the choice.
170
278
  # @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
@@ -3,5 +3,5 @@
3
3
  module Bzapper
4
4
  # Versão da gem. O `scripts/release-sdks.sh` do monorepo bumpa a linha abaixo por regex
5
5
  # (ancorada no início da linha) e o `bzapper.gemspec` lê daqui — não mude o formato dela.
6
- VERSION = "0.9.3"
6
+ VERSION = "0.10.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bzapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Berni Software