bzapper 0.9.0 → 0.9.2
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/messages.rb +11 -2
- data/lib/bzapper/resources/official.rb +27 -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: 2e9d9112e9be7a83c45c8477b44610c4b6b133f1bc4f43eafbfe4774c72ffab2
|
|
4
|
+
data.tar.gz: 1d1a9d4d5998d14defee4c9e1fee42bbd24fa7c2eb5f44a842eb10f403a9193c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75e018e04203961849d44f7cc48d11945bc5eaaf275c0814281b4a621dbed944f5aee88b0d1512f650eff6d797b8c70e4cf5f791b8a06db3ece1bbeada955081
|
|
7
|
+
data.tar.gz: 01372d0b22c40ec8ca69e8aa0acbf7ab13dda7cfd082bffacc5c22fac69e9d03c70e68046cc8d49aabdec2c60975eb430b55e224680cf005ba0cb55b23b94f98
|
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.2
|
|
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.2"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Hello world
|
|
@@ -871,6 +871,12 @@ module Bzapper
|
|
|
871
871
|
# language, with variations.
|
|
872
872
|
# @param expiry_minutes [Integer, nil] (corpo) Optional — mentions the expiry in the generated
|
|
873
873
|
# text.
|
|
874
|
+
# @param template [String, nil] (corpo) OFFICIAL RAIL ONLY, optional. Name of an approved
|
|
875
|
+
# AUTHENTICATION template to carry the code — used even inside the 24-hour window. Without it,
|
|
876
|
+
# the project's authentication template is used only when the window is closed. Ignored on the
|
|
877
|
+
# unofficial rail.
|
|
878
|
+
# @param language [String, nil] (corpo) Optional language of the authentication template (e.g.
|
|
879
|
+
# `pt_BR`).
|
|
874
880
|
# @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
|
|
875
881
|
# @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
|
|
876
882
|
# @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
|
|
@@ -878,7 +884,8 @@ module Bzapper
|
|
|
878
884
|
def send_otp(to:, code:, instance_id: UNSET, pool_id: UNSET, sticky: UNSET,
|
|
879
885
|
quoted_message_id: UNSET, quoted_participant: UNSET, client_reference: UNSET,
|
|
880
886
|
mentions: UNSET, scheduled_at: UNSET, groups: UNSET, tags: UNSET, force: UNSET,
|
|
881
|
-
body: UNSET, expiry_minutes: UNSET,
|
|
887
|
+
body: UNSET, expiry_minutes: UNSET, template: UNSET, language: UNSET,
|
|
888
|
+
idempotency_key: nil, timeout: nil)
|
|
882
889
|
payload = compact(
|
|
883
890
|
"instance_id" => instance_id,
|
|
884
891
|
"pool_id" => pool_id,
|
|
@@ -894,7 +901,9 @@ module Bzapper
|
|
|
894
901
|
"force" => force,
|
|
895
902
|
"code" => code,
|
|
896
903
|
"body" => body,
|
|
897
|
-
"expiry_minutes" => expiry_minutes
|
|
904
|
+
"expiry_minutes" => expiry_minutes,
|
|
905
|
+
"template" => template,
|
|
906
|
+
"language" => language
|
|
898
907
|
)
|
|
899
908
|
request("POST",
|
|
900
909
|
"/messages/otp",
|
|
@@ -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
|
data/lib/bzapper/version.rb
CHANGED