bzapper 0.9.1 → 0.9.3

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: 316cbd15dfc092ac463fe8962cc28654cf759bd05b4beff64e6a416d1efb9bd0
4
- data.tar.gz: 0a5366e02dde82845b9bfcb3052cf3729c65ff5768f5e2fc2ce09717fed6545e
3
+ metadata.gz: 2de73e1893deff0a3dd72bce246825e27d6c7683be57a01f4c9a3c81d55d28ed
4
+ data.tar.gz: a661bd96fe3819a7c35b63a89e9d3dc2773568d29aa93f9dbdff20f9208c1153
5
5
  SHA512:
6
- metadata.gz: 6b0eaebe936d54f02ef34fb9157a2e586b4845b5e516618b6e0cf3035e915a744b53930bf12435f138ebba738bd4f771b20e4cae29720d750cd168dfd00a72dd
7
- data.tar.gz: 553b87a95d514d5582b6a64cc59abf2d87ee5a0361eb3ce5e509726b92102ebd9d69759f521fd93924b5af7e6252f0359871ec055e0d62e1bbd39a7266566f3a
6
+ metadata.gz: 88041c2ced6cfb00307dbf710e6e86ba9a6dd4a9f0db5bcc66f0a44446993d12fce5f8e45f6f1e6c15408ef820d14a739b648ec0d524ddfc6353e0e67e2c3c91
7
+ data.tar.gz: 4053e5387e460a5bf50944304e14d9b18a8315ef2db4e1690782d9f95d3e0a8f52813b74b60ee9ee4256e933ac086eb744c3feec262f39256dece3b83e540dc3
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.1
13
+ gem install bzapper -v 0.9.3
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.1"
19
+ gem "bzapper", "0.9.3"
20
20
  ```
21
21
 
22
22
  ## Hello world
@@ -123,6 +123,33 @@ module Bzapper
123
123
  request("GET", "/official/status", timeout: timeout)
124
124
  end
125
125
 
126
+ # Estimated Meta cost and official-rail KPIs for a period. `GET /official/insights`
127
+ #
128
+ # What Meta will charge the customer (bZapper charges only the subscription), estimated per
129
+ # category — marketing, utility, authentication and service — for the period, the previous
130
+ # period of the same length, the current month so far and its projection, plus delivery and read
131
+ # rates, free messages, conversations from ads, marketing opt-outs, the templates sent, the most
132
+ # common failure reasons and each number's quality and limit. The estimate uses the category and
133
+ # `billable` flag Meta reports in each status webhook and, when missing, the template's category
134
+ # (conservative: utility counts as charged). Prices follow the recipient's country; the rate
135
+ # card used (Meta's, for Brazil, in BRL) comes in `rate_card`. Messages to other countries are
136
+ # counted in `cost.other_countries` but not priced.
137
+ #
138
+ # @param days [Integer, nil] (query) Period ending now: 7, 30 or 90 (default 30; up to 366).
139
+ # @param from [Time, String, nil] (query) Period start (RFC 3339). Overrides `days`.
140
+ # @param to [Time, String, nil] (query) Period end (RFC 3339). Default: now.
141
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
142
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
143
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
144
+ def get_official_insights(days: nil, from: nil, to: nil, timeout: nil)
145
+ query = {
146
+ "days" => days,
147
+ "from" => from,
148
+ "to" => to
149
+ }
150
+ request("GET", "/official/insights", query: query, timeout: timeout)
151
+ end
152
+
126
153
  # Upload a file to Meta once and reuse it in many sends (multipart). `POST /official/media`
127
154
  #
128
155
  # Uploads the file to Meta through the project's default number (or `instance_id`) and returns
@@ -143,6 +143,45 @@ module Bzapper
143
143
  timeout: timeout)
144
144
  end
145
145
 
146
+ # Get the verification-code template and whether Meta allows Authentication templates. `GET
147
+ # /templates/otp`
148
+ #
149
+ # The template that carries the code of POST /messages/otp when the 24-hour window is closed
150
+ # (null = the first approved Authentication template is used), plus the account's eligibility
151
+ # for the Authentication category: Meta requires the business to be verified and the number to
152
+ # reach the 2,000-a-day sending limit. Each criterion comes with its current state, so the
153
+ # customer knows what is missing.
154
+ #
155
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
156
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
157
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
158
+ def get_otp_template(timeout: nil)
159
+ request("GET", "/templates/otp", timeout: timeout)
160
+ end
161
+
162
+ # Choose the template that carries the verification code outside the window. `PUT
163
+ # /templates/otp`
164
+ #
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).
168
+ #
169
+ # @param template_id [String, nil] (corpo) Empty clears the choice.
170
+ # @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
171
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
172
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
173
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
174
+ def set_otp_template(template_id: UNSET, idempotency_key: nil, timeout: nil)
175
+ payload = compact(
176
+ "template_id" => template_id
177
+ )
178
+ request("PUT",
179
+ "/templates/otp",
180
+ body: payload,
181
+ idempotency_key: idempotency_key,
182
+ timeout: timeout)
183
+ end
184
+
146
185
  # Upload the header sample of a template (multipart, JPEG/PNG/MP4/PDF up to 10 MB). `POST
147
186
  # /templates/media`
148
187
  #
@@ -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.1"
6
+ VERSION = "0.9.3"
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.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Berni Software