bzapper 0.11.0 → 0.13.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: 11d1f4c09306edd0ebee64aae4a21ce94abd01f6b1c970c8d20560312c00ba82
4
- data.tar.gz: b7282a59b60b37c64ae70389d2a4e33bedf5dc968434b82ea355e37b0ed1823c
3
+ metadata.gz: 13d0b6718949379d3a764faaf77d13171e968757442090fa66f87ad93ecf5363
4
+ data.tar.gz: c66b3dc08012d3d925303f62dbb79c934a46a5a16f8fc33de9d7514c2c7332f5
5
5
  SHA512:
6
- metadata.gz: e68a0d83d6ec6ad449386fb2d86f821ac073b3726ae39e111aa8ef6b38ce9b671e0f1f352738673fdb70fb48f8a89dd5c672d5cfa85405c6f5a72d7d1a28ee0f
7
- data.tar.gz: 71ea59c63593644c87876d6582ad452b3604ce5d67ad92cb7e0b17bd2d1f6e6cbe3c5195b918fcb8c7a37fd2a73051709cbb9ac32a2c40b2d0abdcd19b7b6618
6
+ metadata.gz: '09dff9e7a1caa6906746089c3b33e228280cb8662e74042e6c73e2ff6cb7fe4077321f03fd2100fba844696ea13b3d3828ffdfef2ebf0f20888e6f0fb6a8c4a1'
7
+ data.tar.gz: c20b0d40090ea71d6da210790c7d0eeb654f5ab700f1022a98efef66f1b280c790b6b05778b695c0427ca6b60400b90590b6e0924edda6e879fea29a17e6b4e8
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.11.0
13
+ gem install bzapper -v 0.13.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.11.0"
19
+ gem "bzapper", "0.13.0"
20
20
  ```
21
21
 
22
22
  ## Hello world
@@ -68,6 +68,28 @@ module Bzapper
68
68
  request("GET", "/campaigns/estimate", query: query, timeout: timeout)
69
69
  end
70
70
 
71
+ # What Meta will charge for a template campaign (official rail). `GET /campaigns/meta-cost`
72
+ #
73
+ # From the template category (the one Meta bills, which follows reclassification) and Meta's
74
+ # Brazil rate card: the cost of `recipients` messages — charged by Meta on the customer's card;
75
+ # bZapper charges only the subscription — and how many days the number's daily new-contact limit
76
+ # requires.
77
+ #
78
+ # @param recipients [Integer] (query)
79
+ # @param template [String] (query)
80
+ # @param language [String, nil] (query)
81
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
82
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
83
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
84
+ def estimate_campaign_meta_cost(recipients:, template:, language: nil, timeout: nil)
85
+ query = {
86
+ "recipients" => recipients,
87
+ "template" => template,
88
+ "language" => language
89
+ }
90
+ request("GET", "/campaigns/meta-cost", query: query, timeout: timeout)
91
+ end
92
+
71
93
  # Per-number campaign eligibility (connection and age). `GET /campaigns/eligibility`
72
94
  #
73
95
  # Same engine the dispatcher uses: which numbers can send campaigns now, the account's campaign
@@ -971,6 +971,12 @@ module Bzapper
971
971
  # index. Empty entries are skipped.
972
972
  # @param code [String, nil] (corpo) AUTHENTICATION templates only. Meta requires the code both
973
973
  # in the body and in the copy-code button; we place it in both.
974
+ # @param offer_expires_at [Time, String, nil] (corpo) Limited-time offer with `has_expiration`:
975
+ # the deadline of THIS send (RFC 3339) — the countdown runs to it. Required for that template;
976
+ # returns 422 before Meta otherwise.
977
+ # @param cards [Array<Hash>, nil] (corpo) Carousel templates: the values of each card, in order.
978
+ # `header_url` is the media of the card for this send (omitted, the sample registered at
979
+ # creation goes out).
974
980
  # @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
975
981
  # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
976
982
  # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
@@ -980,7 +986,8 @@ module Bzapper
980
986
  client_reference: UNSET, mentions: UNSET, scheduled_at: UNSET,
981
987
  groups: UNSET, tags: UNSET, force: UNSET, language: UNSET,
982
988
  variables: UNSET, header_variables: UNSET, button_variables: UNSET,
983
- code: UNSET, idempotency_key: nil, timeout: nil)
989
+ code: UNSET, offer_expires_at: UNSET, cards: UNSET, idempotency_key: nil,
990
+ timeout: nil)
984
991
  payload = compact(
985
992
  "instance_id" => instance_id,
986
993
  "pool_id" => pool_id,
@@ -999,7 +1006,9 @@ module Bzapper
999
1006
  "variables" => variables,
1000
1007
  "header_variables" => header_variables,
1001
1008
  "button_variables" => button_variables,
1002
- "code" => code
1009
+ "code" => code,
1010
+ "offer_expires_at" => offer_expires_at,
1011
+ "cards" => cards
1003
1012
  )
1004
1013
  request("POST",
1005
1014
  "/messages/template",
@@ -41,13 +41,21 @@ module Bzapper
41
41
  # @param code_expiry_minutes [Integer, nil] (corpo) AUTHENTICATION only, 1 to 90. In that
42
42
  # category Meta writes the text itself and adds the copy-code button; this is the only thing you
43
43
  # set.
44
+ # @param limited_time_offer [Hash, nil] (corpo) MARKETING only. Turns the template into a
45
+ # limited-time offer: a badge (up to 16 characters) and, with `has_expiration`, a countdown to
46
+ # the deadline sent in `offer_expires_at`. No footer; header only image or video; needs a URL
47
+ # button (and, with a deadline, the copy-code button).
48
+ # @param cards [Array<Hash>, nil] (corpo) Carousel (MARKETING or UTILITY): 2 to 10 cards. The
49
+ # template keeps only the opening `body`; each card has its own image or video, text (up to 160
50
+ # characters) and 1–2 buttons (quick reply, URL or phone). Meta requires the same media type and
51
+ # the same button types, in the same order, on every card.
44
52
  # @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
45
53
  # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
46
54
  # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
47
55
  # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
48
56
  def create_template(name:, language:, category:, body:, header: UNSET, footer: UNSET,
49
- buttons: UNSET, code_expiry_minutes: UNSET, idempotency_key: nil,
50
- timeout: nil)
57
+ buttons: UNSET, code_expiry_minutes: UNSET, limited_time_offer: UNSET,
58
+ cards: UNSET, idempotency_key: nil, timeout: nil)
51
59
  payload = compact(
52
60
  "name" => name,
53
61
  "language" => language,
@@ -56,7 +64,9 @@ module Bzapper
56
64
  "body" => body,
57
65
  "footer" => footer,
58
66
  "buttons" => buttons,
59
- "code_expiry_minutes" => code_expiry_minutes
67
+ "code_expiry_minutes" => code_expiry_minutes,
68
+ "limited_time_offer" => limited_time_offer,
69
+ "cards" => cards
60
70
  )
61
71
  request("POST",
62
72
  "/templates",
@@ -98,14 +108,22 @@ module Bzapper
98
108
  # @param code_expiry_minutes [Integer, nil] (corpo) AUTHENTICATION only, 1 to 90. In that
99
109
  # category Meta writes the text itself and adds the copy-code button; this is the only thing you
100
110
  # set.
111
+ # @param limited_time_offer [Hash, nil] (corpo) MARKETING only. Turns the template into a
112
+ # limited-time offer: a badge (up to 16 characters) and, with `has_expiration`, a countdown to
113
+ # the deadline sent in `offer_expires_at`. No footer; header only image or video; needs a URL
114
+ # button (and, with a deadline, the copy-code button).
115
+ # @param cards [Array<Hash>, nil] (corpo) Carousel (MARKETING or UTILITY): 2 to 10 cards. The
116
+ # template keeps only the opening `body`; each card has its own image or video, text (up to 160
117
+ # characters) and 1–2 buttons (quick reply, URL or phone). Meta requires the same media type and
118
+ # the same button types, in the same order, on every card.
101
119
  # @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
102
120
  # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
103
121
  # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
104
122
  # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
105
123
  # @raise [ArgumentError] parâmetro de caminho vazio, "." ou "..".
106
124
  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)
125
+ buttons: UNSET, code_expiry_minutes: UNSET, limited_time_offer: UNSET,
126
+ cards: UNSET, idempotency_key: nil, timeout: nil)
109
127
  payload = compact(
110
128
  "name" => name,
111
129
  "language" => language,
@@ -114,7 +132,9 @@ module Bzapper
114
132
  "body" => body,
115
133
  "footer" => footer,
116
134
  "buttons" => buttons,
117
- "code_expiry_minutes" => code_expiry_minutes
135
+ "code_expiry_minutes" => code_expiry_minutes,
136
+ "limited_time_offer" => limited_time_offer,
137
+ "cards" => cards
118
138
  )
119
139
  request("PUT",
120
140
  "/templates/#{segment(id, "id")}",
@@ -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.11.0"
6
+ VERSION = "0.13.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.11.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Berni Software