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 +4 -4
- data/README.md +2 -2
- data/lib/bzapper/resources/official.rb +27 -0
- data/lib/bzapper/resources/templates.rb +39 -0
- 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: 2de73e1893deff0a3dd72bce246825e27d6c7683be57a01f4c9a3c81d55d28ed
|
|
4
|
+
data.tar.gz: a661bd96fe3819a7c35b63a89e9d3dc2773568d29aa93f9dbdff20f9208c1153
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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.
|
|
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
|
#
|
data/lib/bzapper/version.rb
CHANGED