signalhouse-sms 1.6.0 → 1.7.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa244c4661c7422637836f6c2cff44f1cb28c7184b429bb642a08aae32581335
|
|
4
|
+
data.tar.gz: c1843fa74c0e307fa89961f73152d1db80bedf8071a7f885ce4c57887fb8409a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d0421fbe53aa531b7cecb7516fe9dfc45d4054172bf691e3e501a8112bec8f8de77568779bcc9a4168d46144a8c96771f37fc8833177f8d7bae7ff60e3d595c
|
|
7
|
+
data.tar.gz: 84c5e34688e5a24a629080d4b9b00b6ce5703d409e4295a58bdc100625880b3b47afcdb7126c2841a782c92deda4f437883589b3d7cc0b775780fdc054284c1f
|
data/README.md
CHANGED
|
@@ -222,12 +222,12 @@ client.users.admin.create_internal_user(
|
|
|
222
222
|
|
|
223
223
|
| Domain | Accessor | Methods |
|
|
224
224
|
|--------|----------|---------|
|
|
225
|
-
| Auth | `client.auth` | `login`, `reset_password`, `get_auth_history` |
|
|
225
|
+
| Auth | `client.auth` | `login`, `reset_password`, `get_auth_history`, `get_oauth_links`, `create_oauth_link`, `create_oauth_reauth`, `confirm_oauth_reauth`, `confirm_oauth_link`, `delete_oauth_link`, `get_oauth_authorization_url` |
|
|
226
226
|
| Billing | `client.billing` | `get_transaction_history`, `get_wallet`, `update_wallet`, `get_payment_methods`, `add_funds`, `add_payment_method`, `remove_payment_method`, `get_invoice_details`, `get_fees` |
|
|
227
|
-
| Brands | `client.brands` | `get_brands`, `get_external_vetting`, `create_brand`, `get_business_verifications`, `get_business_verification`, `create_business_verification`, `update_business_verification`, `
|
|
227
|
+
| Brands | `client.brands` | `get_brands`, `get_external_vetting`, `create_brand`, `get_business_verifications`, `get_business_verification`, `create_business_verification`, `update_business_verification`, `transfer_brand`, `create_external_vetting`, `update_brand`, `revet_brand`, `delete_brand` |
|
|
228
228
|
| Campaigns | `client.campaigns` | `get_campaigns`, `create_campaign`, `update_campaign`, `delete_campaign` |
|
|
229
229
|
| Campaigns Admin | `client.campaigns.admin` | `approve_campaign`, `reject_campaign` |
|
|
230
|
-
| Groups | `client.groups` | `get_group`, `update_group` |
|
|
230
|
+
| Groups | `client.groups` | `get_group`, `update_group`, `get_sso_configuration`, `save_sso_connection`, `delete_sso_connection`, `add_sso_domain`, `verify_sso_domain`, `remove_sso_domain` |
|
|
231
231
|
| Groups Admin | `client.groups.admin` | `get_groups`, `create_group`, `delete_group` |
|
|
232
232
|
| Landings | `client.landings` | `get_landings`, `get_public_landing`, `create_landing`, `update_landing`, `get_landing_by_brand_id`, `delete_landing` |
|
|
233
233
|
| Messages | `client.messages` | `get_messages`, `get_analytics`, `send_sms`, `send_mms`, `send_group_message`, `get_p2p_batch` |
|
|
@@ -2,15 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
module SignalHouseSms
|
|
4
4
|
class Auth
|
|
5
|
-
|
|
5
|
+
attr_reader :admin
|
|
6
|
+
|
|
7
|
+
def initialize(client, enable_admin)
|
|
6
8
|
@client = client
|
|
9
|
+
@admin = Admin.new(client) if enable_admin
|
|
7
10
|
end
|
|
8
11
|
|
|
9
12
|
# POST /auth
|
|
10
|
-
|
|
13
|
+
# Returns { token }, or { mfaRequired: true, challengeId, ... } when the account has 2FA on, or
|
|
14
|
+
# { token, twoFactorSetupRequired: true } (a setup-only session) when the user's group requires 2FA
|
|
15
|
+
# and they haven't turned it on.
|
|
16
|
+
# device_token (from verify_two_factor_challenge) skips 2FA on a trusted device.
|
|
17
|
+
def login(email:, password:, device_token: nil, **opts)
|
|
11
18
|
token = opts[:token]
|
|
12
19
|
headers = HttpClient.headers_for(opts)
|
|
13
|
-
|
|
20
|
+
body = { email: email, password: password }
|
|
21
|
+
body[:deviceToken] = device_token unless device_token.nil?
|
|
22
|
+
@client.request("/auth", method: :post, body: body, token: token, headers: headers)
|
|
14
23
|
end
|
|
15
24
|
|
|
16
25
|
# PUT /auth/resetpassword/:userId
|
|
@@ -75,5 +84,253 @@ module SignalHouseSms
|
|
|
75
84
|
headers = HttpClient.headers_for(opts)
|
|
76
85
|
@client.request("/auth/external-link-token", method: :post, body: { product: product }, token: token, headers: headers)
|
|
77
86
|
end
|
|
87
|
+
|
|
88
|
+
# GET /auth/oauth/providers
|
|
89
|
+
# List the OAuth sign-in providers enabled on this API (only providers with credentials configured).
|
|
90
|
+
def get_oauth_providers(**opts)
|
|
91
|
+
token = opts[:token]
|
|
92
|
+
headers = opts[:headers]
|
|
93
|
+
@client.request("/auth/oauth/providers", method: :get, token: token, headers: headers)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# GET /auth/oauth/links
|
|
97
|
+
# The sign-in providers linked to the caller's account. Returns { passwordKnown, links }; passwordKnown is
|
|
98
|
+
# false for an account without its own password (it confirms identity with an emailed code instead).
|
|
99
|
+
def get_oauth_links(**opts)
|
|
100
|
+
@client.request("/auth/oauth/links", method: :get, token: opts[:token], headers: opts[:headers])
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# POST /auth/oauth/:provider/link
|
|
104
|
+
# Start linking a sign-in provider to the caller's account. Returns { linkTicket, expiresInSeconds }; pass
|
|
105
|
+
# linkTicket as link_ticket: to get_oauth_authorization_url and navigate the browser there to finish.
|
|
106
|
+
# provider is "google", "microsoft" or "apple"; the ticket is single-use and valid 2 minutes.
|
|
107
|
+
# Requires a fresh confirm_two_factor_identity from the same session, which this spends (403 otherwise).
|
|
108
|
+
def create_oauth_link(provider:, **opts)
|
|
109
|
+
@client.require_params("provider" => provider)
|
|
110
|
+
@client.request("/auth/oauth/#{CGI.escape(provider.to_s)}/link", method: :post, token: opts[:token], headers: opts[:headers])
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# POST /auth/oauth/:provider/reauth
|
|
114
|
+
# Start signing in again with a provider already linked to the caller's account, to confirm it's them.
|
|
115
|
+
# Returns { reauthTicket, reauthSecret, expiresInSeconds }. Keep reauthSecret in the client that started the
|
|
116
|
+
# flow: it is returned only here, and confirm_oauth_reauth needs it. Pass reauthTicket as reauth_ticket: to
|
|
117
|
+
# get_oauth_authorization_url and navigate the browser there. provider is "google", "microsoft", "apple" or
|
|
118
|
+
# "sso"; the ticket is single-use and valid 2 minutes, and nothing is spent. The browser comes back to
|
|
119
|
+
# /Settings/Security with a single-use `pendingReauth` (the session that started it redeems it with confirm_oauth_reauth) or `reauthError` (reauth_wrong_account, reauth_unsupported,
|
|
120
|
+
# reauth_stale, invalid_state, sso_not_configured, access_denied or provider_error).
|
|
121
|
+
def create_oauth_reauth(provider:, **opts)
|
|
122
|
+
@client.require_params("provider" => provider)
|
|
123
|
+
@client.request("/auth/oauth/#{CGI.escape(provider.to_s)}/reauth", method: :post, token: opts[:token], headers: opts[:headers])
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# POST /auth/oauth/reauth/confirm
|
|
127
|
+
# Finish signing in again with a linked provider. The round trip started with create_oauth_reauth returns the
|
|
128
|
+
# browser to /Settings/Security with a single-use `pendingReauth` (valid 5 minutes); this redeems it, but only
|
|
129
|
+
# for the same account and the same session that called create_oauth_reauth, so a re-sign-in completed in
|
|
130
|
+
# someone else's browser confirms nothing. 400 when it expired or was used, 403 for another account or session.
|
|
131
|
+
# pending_reauth (sent as `pendingReauth`): the `pendingReauth` query parameter from the redirect.
|
|
132
|
+
# reauth_secret (sent as `reauthSecret`): the reauthSecret create_oauth_reauth returned; a wrong or missing
|
|
133
|
+
# secret is refused (403) and uses up the pending re-sign-in.
|
|
134
|
+
# Returns { identityConfirmed }: true when 2FA is off, so it counts as a confirmed identity.
|
|
135
|
+
def confirm_oauth_reauth(pending_reauth:, reauth_secret:, **opts)
|
|
136
|
+
@client.require_params("pendingReauth" => pending_reauth, "reauthSecret" => reauth_secret)
|
|
137
|
+
@client.request("/auth/oauth/reauth/confirm", method: :post, body: { pendingReauth: pending_reauth, reauthSecret: reauth_secret }, token: opts[:token], headers: opts[:headers])
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# POST /auth/oauth/links/confirm
|
|
141
|
+
# Finish linking a provider. The provider round trip started with create_oauth_link returns the browser to
|
|
142
|
+
# /Settings/Security with a single-use `pendingLink`; this links it, but only for the account the link was
|
|
143
|
+
# started for, so a link URL opened in someone else's browser can't attach their provider to your account.
|
|
144
|
+
# pending_link (sent as `pendingLink`): the `pendingLink` query parameter from the redirect.
|
|
145
|
+
# Returns the caller's { passwordKnown, links }.
|
|
146
|
+
def confirm_oauth_link(pending_link:, **opts)
|
|
147
|
+
@client.require_params("pendingLink" => pending_link)
|
|
148
|
+
@client.request("/auth/oauth/links/confirm", method: :post, body: { pendingLink: pending_link }, token: opts[:token], headers: opts[:headers])
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# DELETE /auth/oauth/:provider/link
|
|
152
|
+
# Unlink a sign-in provider (provider may be "sso") from the caller's account. Refused (400) if it is the
|
|
153
|
+
# account's only way to sign in. Requires a fresh confirm_two_factor_identity from the same session (403 otherwise).
|
|
154
|
+
def delete_oauth_link(provider:, **opts)
|
|
155
|
+
@client.require_params("provider" => provider)
|
|
156
|
+
@client.request("/auth/oauth/#{CGI.escape(provider.to_s)}/link", method: :delete, token: opts[:token], headers: opts[:headers])
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Build the URL that starts an OAuth sign-in for provider ("google", "microsoft", "apple" or "sso").
|
|
160
|
+
# Navigate a browser to it; it is a redirect, not an API call. The API returns the user to the
|
|
161
|
+
# portal's /auth/callback with a single-use ticket.
|
|
162
|
+
# email (optional; required for "sso" sign-in): the address whose domain selects the group's SSO
|
|
163
|
+
# connection. Not needed with a reauth_ticket.
|
|
164
|
+
# link_ticket (optional; sent as `linkTicket`): the ticket from create_oauth_link, to link the provider
|
|
165
|
+
# to the signed-in account instead of signing in.
|
|
166
|
+
# reauth_ticket (optional; sent as `reauthTicket`): the ticket from create_oauth_reauth, to sign the
|
|
167
|
+
# account in again with a linked provider to confirm it's them.
|
|
168
|
+
# next_path (optional; sent as the `next` query parameter, named next_path here because `next`
|
|
169
|
+
# is a Ruby keyword): a same-site path (e.g. "/oauth/consent?request=abc") to return the user to
|
|
170
|
+
# after sign-in. The API hands it back on the /auth/callback redirect as `next`; anything that
|
|
171
|
+
# isn't a rooted path on the portal is dropped.
|
|
172
|
+
# Query keys are emitted in the order email, linkTicket, reauthTicket, next, and only when set.
|
|
173
|
+
def get_oauth_authorization_url(provider:, next_path: nil, email: nil, link_ticket: nil, reauth_ticket: nil)
|
|
174
|
+
@client.require_params("provider" => provider)
|
|
175
|
+
url = "#{@client.base_url}/auth/oauth/#{CGI.escape(provider.to_s)}"
|
|
176
|
+
query = [["email", email], ["linkTicket", link_ticket], ["reauthTicket", reauth_ticket], ["next", next_path]]
|
|
177
|
+
.reject { |_key, value| value.nil? || value.to_s.empty? }
|
|
178
|
+
.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }
|
|
179
|
+
url += "?#{query.join("&")}" unless query.empty?
|
|
180
|
+
url
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# POST /auth/oauth/ticket
|
|
184
|
+
# Read what a single-use OAuth ticket resolves to without consuming it: a "session" (ready to
|
|
185
|
+
# exchange), a "select" (pick one of several accounts) or a "signup" (finish registration).
|
|
186
|
+
def read_oauth_ticket(ticket:, **opts)
|
|
187
|
+
@client.require_params("ticket" => ticket)
|
|
188
|
+
token = opts[:token]
|
|
189
|
+
headers = opts[:headers]
|
|
190
|
+
@client.request("/auth/oauth/ticket", method: :post, body: { ticket: ticket }, token: token, headers: headers)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# POST /auth/oauth/exchange
|
|
194
|
+
# Exchange a single-use "session" or "select" OAuth ticket for a JWT. Consumes the ticket.
|
|
195
|
+
# user_id is required for a "select" ticket: the chosen account from "accounts".
|
|
196
|
+
def exchange_oauth_ticket(ticket:, user_id: nil, device_token: nil, **opts)
|
|
197
|
+
@client.require_params("ticket" => ticket)
|
|
198
|
+
token = opts[:token]
|
|
199
|
+
headers = opts[:headers]
|
|
200
|
+
body = { ticket: ticket }
|
|
201
|
+
body[:userId] = user_id unless user_id.nil?
|
|
202
|
+
body[:deviceToken] = device_token unless device_token.nil?
|
|
203
|
+
@client.request("/auth/oauth/exchange", method: :post, body: body, token: token, headers: headers)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# GET /auth/2fa
|
|
207
|
+
# The caller's two-factor settings: methods (targets masked), default, backup-code counts, trusted devices.
|
|
208
|
+
def get_two_factor_settings(**opts)
|
|
209
|
+
@client.request("/auth/2fa", method: :get, token: opts[:token], headers: opts[:headers])
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# POST /auth/2fa/confirm-identity
|
|
213
|
+
# Confirm it's really the account owner before a sensitive change: start_two_factor_enrollment,
|
|
214
|
+
# remove_two_factor_method, regenerate_backup_codes, disable_two_factor, create_oauth_link, delete_oauth_link,
|
|
215
|
+
# or groups.save_sso_connection / groups.delete_sso_connection. With 2FA on, pass a current code (or a backup
|
|
216
|
+
# code); with 2FA off, pass the account password, or, for an account without a password of its own
|
|
217
|
+
# (get_oauth_links returns passwordKnown: false), the code from send_two_factor_identity_code(method: "email")
|
|
218
|
+
# with method: "email". A confirmation lasts 5 minutes, belongs to the session that made it, and unlocks
|
|
219
|
+
# exactly one change. Returns { confirmed, expiresInSeconds }.
|
|
220
|
+
def confirm_two_factor_identity(password: nil, code: nil, method: nil, using_backup_code: nil, **opts)
|
|
221
|
+
body = { password: password, code: code, method: method, usingBackupCode: using_backup_code }.compact
|
|
222
|
+
@client.request("/auth/2fa/confirm-identity", method: :post, body: body, token: opts[:token], headers: opts[:headers])
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# POST /auth/2fa/confirm-identity/send
|
|
226
|
+
# Send a code by an enrolled "sms" or "email" method to use with confirm_two_factor_identity (not needed for "app").
|
|
227
|
+
# An account without a password of its own (passwordKnown false from get_oauth_links) uses "email" even with 2FA off.
|
|
228
|
+
# Returns { sent, target, expiresInSeconds? }.
|
|
229
|
+
def send_two_factor_identity_code(method:, **opts)
|
|
230
|
+
@client.require_params("method" => method)
|
|
231
|
+
@client.request("/auth/2fa/confirm-identity/send", method: :post, body: { method: method }, token: opts[:token], headers: opts[:headers])
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# POST /auth/2fa/enroll
|
|
235
|
+
# Start enrolling "app", "sms" or "email". App returns secret + otpauthUri; sms/email send a code.
|
|
236
|
+
# Requires a fresh confirm_two_factor_identity from the same session (403 otherwise); each confirmation unlocks one change.
|
|
237
|
+
def start_two_factor_enrollment(method:, phone: nil, address: nil, device_name: nil, **opts)
|
|
238
|
+
@client.require_params("method" => method)
|
|
239
|
+
body = { method: method, phone: phone, address: address, deviceName: device_name }.compact
|
|
240
|
+
@client.request("/auth/2fa/enroll", method: :post, body: body, token: opts[:token], headers: opts[:headers])
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# POST /auth/2fa/enroll/:enrollmentId/verify
|
|
244
|
+
# Confirm a pending enrollment. The first method turns 2FA on and returns backup codes (shown once).
|
|
245
|
+
def confirm_two_factor_enrollment(enrollment_id:, code:, **opts)
|
|
246
|
+
@client.require_params("enrollmentId" => enrollment_id, "code" => code)
|
|
247
|
+
safe_id = CGI.escape(enrollment_id.to_s)
|
|
248
|
+
@client.request("/auth/2fa/enroll/#{safe_id}/verify", method: :post, body: { code: code }, token: opts[:token], headers: opts[:headers])
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# PUT /auth/2fa/primary
|
|
252
|
+
# Choose which enrolled method is offered first at sign-in.
|
|
253
|
+
def set_two_factor_primary_method(method:, **opts)
|
|
254
|
+
@client.require_params("method" => method)
|
|
255
|
+
@client.request("/auth/2fa/primary", method: :put, body: { method: method }, token: opts[:token], headers: opts[:headers])
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# DELETE /auth/2fa/methods/:method
|
|
259
|
+
# Remove an enrolled method. Removing the last one turns 2FA off.
|
|
260
|
+
# Requires a fresh confirm_two_factor_identity from the same session (403 otherwise); each confirmation unlocks one change.
|
|
261
|
+
def remove_two_factor_method(method:, **opts)
|
|
262
|
+
@client.require_params("method" => method)
|
|
263
|
+
@client.request("/auth/2fa/methods/#{CGI.escape(method.to_s)}", method: :delete, token: opts[:token], headers: opts[:headers])
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# POST /auth/2fa/backup-codes
|
|
267
|
+
# Replace all backup codes (shown once); the previous codes stop working.
|
|
268
|
+
# Requires a fresh confirm_two_factor_identity from the same session (403 otherwise); each confirmation unlocks one change.
|
|
269
|
+
def regenerate_backup_codes(**opts)
|
|
270
|
+
@client.request("/auth/2fa/backup-codes", method: :post, token: opts[:token], headers: opts[:headers])
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# DELETE /auth/2fa/trusted-devices/:deviceId
|
|
274
|
+
# Stop trusting a device, so its next sign-in asks for the second factor again.
|
|
275
|
+
def revoke_trusted_device(device_id:, **opts)
|
|
276
|
+
@client.require_params("deviceId" => device_id)
|
|
277
|
+
@client.request("/auth/2fa/trusted-devices/#{CGI.escape(device_id.to_s)}", method: :delete, token: opts[:token], headers: opts[:headers])
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# DELETE /auth/2fa
|
|
281
|
+
# Turn 2FA off: removes every method, backup code and trusted device.
|
|
282
|
+
# Requires a fresh confirm_two_factor_identity from the same session (403 otherwise); each confirmation unlocks one change.
|
|
283
|
+
def disable_two_factor(**opts)
|
|
284
|
+
@client.request("/auth/2fa", method: :delete, token: opts[:token], headers: opts[:headers])
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# GET /auth/2fa/prompt
|
|
288
|
+
# Whether the "secure your account" enrollment prompt is due.
|
|
289
|
+
def get_two_factor_prompt(**opts)
|
|
290
|
+
@client.request("/auth/2fa/prompt", method: :get, token: opts[:token], headers: opts[:headers])
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# POST /auth/2fa/prompt/dismiss
|
|
294
|
+
# Dismiss the prompt until the next sign-in; it stops for good after three dismissals.
|
|
295
|
+
def dismiss_two_factor_prompt(**opts)
|
|
296
|
+
@client.request("/auth/2fa/prompt/dismiss", method: :post, token: opts[:token], headers: opts[:headers])
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# POST /auth/2fa/challenge/:challengeId/send
|
|
300
|
+
# Send a sign-in code by "sms" or "email" (not needed for "app").
|
|
301
|
+
def send_two_factor_challenge_code(challenge_id:, method:, **opts)
|
|
302
|
+
@client.require_params("challengeId" => challenge_id, "method" => method)
|
|
303
|
+
safe_id = CGI.escape(challenge_id.to_s)
|
|
304
|
+
@client.request("/auth/2fa/challenge/#{safe_id}/send", method: :post, body: { method: method }, token: opts[:token], headers: opts[:headers])
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# POST /auth/2fa/challenge/:challengeId/verify
|
|
308
|
+
# Verify a sign-in code or backup code; returns { token, deviceToken? }.
|
|
309
|
+
def verify_two_factor_challenge(challenge_id:, code:, method: nil, using_backup_code: nil, remember_device: nil, device_name: nil, **opts)
|
|
310
|
+
@client.require_params("challengeId" => challenge_id, "code" => code)
|
|
311
|
+
safe_id = CGI.escape(challenge_id.to_s)
|
|
312
|
+
body = { code: code, method: method, usingBackupCode: using_backup_code, rememberDevice: remember_device, deviceName: device_name }.compact
|
|
313
|
+
@client.request("/auth/2fa/challenge/#{safe_id}/verify", method: :post, body: body, token: opts[:token], headers: opts[:headers])
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# DELETE /auth/2fa/challenge/:challengeId
|
|
317
|
+
# Cancel a pending two-factor challenge.
|
|
318
|
+
def cancel_two_factor_challenge(challenge_id:, **opts)
|
|
319
|
+
@client.require_params("challengeId" => challenge_id)
|
|
320
|
+
@client.request("/auth/2fa/challenge/#{CGI.escape(challenge_id.to_s)}", method: :delete, token: opts[:token], headers: opts[:headers])
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
class Admin
|
|
324
|
+
def initialize(client)
|
|
325
|
+
@client = client
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# DELETE /auth/2fa/users/:userId
|
|
329
|
+
# Turn 2FA off for a user who has lost every factor (lockout recovery). Staff only; audited.
|
|
330
|
+
def reset_user_two_factor(user_id:, **opts)
|
|
331
|
+
@client.require_params("userId" => user_id)
|
|
332
|
+
@client.request("/auth/2fa/users/#{CGI.escape(user_id.to_s)}", method: :delete, token: opts[:token], headers: opts[:headers])
|
|
333
|
+
end
|
|
334
|
+
end
|
|
78
335
|
end
|
|
79
336
|
end
|
|
@@ -109,27 +109,6 @@ module SignalHouseSms
|
|
|
109
109
|
@client.request("/brand/business-verification/#{safe_group_id}/#{safe_business_verification_id}", method: :put, body: details, token: token, headers: headers)
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
-
# GET /brand/toll-free-isv-account/:groupId — get a group's toll-free ISV account, its own parent account at the
|
|
113
|
-
# toll-free provider; data is nil when it has none (signalhouse_api, signalhouse_admin or signalhouse_user only).
|
|
114
|
-
def get_toll_free_isv_account(group_id:, **opts)
|
|
115
|
-
@client.require_params("groupId" => group_id)
|
|
116
|
-
token = opts[:token]
|
|
117
|
-
headers = HttpClient.headers_for(opts)
|
|
118
|
-
safe_group_id = CGI.escape(group_id.to_s)
|
|
119
|
-
@client.request("/brand/toll-free-isv-account/#{safe_group_id}", method: :get, token: token, headers: headers)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
# PUT /brand/toll-free-isv-account/:groupId — register a group's toll-free ISV account, or replace the API key of the
|
|
123
|
-
# one it has (signalhouse_admin only). The provider checks the account and key first; the secret is never returned.
|
|
124
|
-
def set_toll_free_isv_account(group_id:, account_sid:, api_key_sid:, api_key_secret:, **opts)
|
|
125
|
-
@client.require_params("groupId" => group_id, "accountSid" => account_sid, "apiKeySid" => api_key_sid, "apiKeySecret" => api_key_secret)
|
|
126
|
-
token = opts[:token]
|
|
127
|
-
headers = HttpClient.headers_for(opts)
|
|
128
|
-
safe_group_id = CGI.escape(group_id.to_s)
|
|
129
|
-
body = { accountSid: account_sid, apiKeySid: api_key_sid, apiKeySecret: api_key_secret }
|
|
130
|
-
@client.request("/brand/toll-free-isv-account/#{safe_group_id}", method: :put, body: body, token: token, headers: headers)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
112
|
# POST /brand/short-code — create a local Short Code brand in PENDING_APPROVAL for manual review.
|
|
134
113
|
# The route forces registrationType to SHORT_CODE and returns a synchronous 201 record with an
|
|
135
114
|
# SCB-prefixed brandId.
|
|
@@ -27,6 +27,70 @@ module SignalHouseSms
|
|
|
27
27
|
@client.request("/group/#{safe_id}", method: :put, body: group_data, token: token, headers: headers)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
# GET /group/sso?groupId=...
|
|
31
|
+
# The group's SSO connection (client secret never returned) and its email domains with verification status.
|
|
32
|
+
def get_sso_configuration(group_id:, **opts)
|
|
33
|
+
@client.require_params("groupId" => group_id)
|
|
34
|
+
token = opts[:token]
|
|
35
|
+
headers = HttpClient.headers_for(opts)
|
|
36
|
+
qs = @client.get_query_string(groupId: group_id)
|
|
37
|
+
@client.request("/group/sso#{qs}", method: :get, token: token, headers: headers)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# PUT /group/sso
|
|
41
|
+
# Create or update the group's OIDC SSO connection. client_secret may be omitted on update to keep the
|
|
42
|
+
# stored one. Requires a fresh auth.confirm_two_factor_identity from the same session (403 otherwise).
|
|
43
|
+
def save_sso_connection(group_id:, issuer:, client_id:, client_secret: nil, enabled: nil, **opts)
|
|
44
|
+
@client.require_params("groupId" => group_id, "issuer" => issuer, "clientId" => client_id)
|
|
45
|
+
token = opts[:token]
|
|
46
|
+
headers = HttpClient.headers_for(opts)
|
|
47
|
+
body = { groupId: group_id, issuer: issuer, clientId: client_id }
|
|
48
|
+
body[:clientSecret] = client_secret unless client_secret.nil?
|
|
49
|
+
body[:enabled] = enabled unless enabled.nil?
|
|
50
|
+
@client.request("/group/sso", method: :put, body: body, token: token, headers: headers)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# DELETE /group/sso?groupId=...
|
|
54
|
+
# Delete the group's SSO connection. Requires a fresh auth.confirm_two_factor_identity from the same
|
|
55
|
+
# session (403 otherwise).
|
|
56
|
+
def delete_sso_connection(group_id:, **opts)
|
|
57
|
+
@client.require_params("groupId" => group_id)
|
|
58
|
+
token = opts[:token]
|
|
59
|
+
headers = HttpClient.headers_for(opts)
|
|
60
|
+
qs = @client.get_query_string(groupId: group_id)
|
|
61
|
+
@client.request("/group/sso#{qs}", method: :delete, token: token, headers: headers)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# POST /group/sso/domains
|
|
65
|
+
# Claim an email domain for the group's SSO. Returns the DNS TXT record to publish before verify_sso_domain.
|
|
66
|
+
def add_sso_domain(group_id:, domain:, **opts)
|
|
67
|
+
@client.require_params("groupId" => group_id, "domain" => domain)
|
|
68
|
+
token = opts[:token]
|
|
69
|
+
headers = HttpClient.headers_for(opts)
|
|
70
|
+
@client.request("/group/sso/domains", method: :post, body: { groupId: group_id, domain: domain }, token: token, headers: headers)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# POST /group/sso/domains/:domain/verify
|
|
74
|
+
# Check the domain's DNS TXT record and mark the domain verified when it matches.
|
|
75
|
+
def verify_sso_domain(group_id:, domain:, **opts)
|
|
76
|
+
@client.require_params("groupId" => group_id, "domain" => domain)
|
|
77
|
+
token = opts[:token]
|
|
78
|
+
headers = HttpClient.headers_for(opts)
|
|
79
|
+
safe_domain = CGI.escape(domain.to_s)
|
|
80
|
+
@client.request("/group/sso/domains/#{safe_domain}/verify", method: :post, body: { groupId: group_id }, token: token, headers: headers)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# DELETE /group/sso/domains/:domain?groupId=...
|
|
84
|
+
# Remove an email domain from the group's SSO.
|
|
85
|
+
def remove_sso_domain(group_id:, domain:, **opts)
|
|
86
|
+
@client.require_params("groupId" => group_id, "domain" => domain)
|
|
87
|
+
token = opts[:token]
|
|
88
|
+
headers = HttpClient.headers_for(opts)
|
|
89
|
+
safe_domain = CGI.escape(domain.to_s)
|
|
90
|
+
qs = @client.get_query_string(groupId: group_id)
|
|
91
|
+
@client.request("/group/sso/domains/#{safe_domain}#{qs}", method: :delete, token: token, headers: headers)
|
|
92
|
+
end
|
|
93
|
+
|
|
30
94
|
class Admin
|
|
31
95
|
def initialize(client)
|
|
32
96
|
@client = client
|
|
@@ -79,7 +79,7 @@ module SignalHouseSms
|
|
|
79
79
|
# sentimentScore is an average, so it must never be summed across responses.
|
|
80
80
|
# message_type scopes the SENTIMENT figures to "SMS", "MMS" or "P2P" (single value, array, or comma-separated
|
|
81
81
|
# string); omit for all scored types. It does NOT narrow the message counts, which are always returned split per type.
|
|
82
|
-
# carrier_family filters by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless); single value, array,
|
|
82
|
+
# carrier_family filters by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array,
|
|
83
83
|
# or comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
84
84
|
# date_bounds is which contract binds start_date/end_date. "day": each bound is widened to its whole UTC day
|
|
85
85
|
#. "exact": a timestamp is bound as the instant it names and a bare date is its
|
|
@@ -112,7 +112,7 @@ module SignalHouseSms
|
|
|
112
112
|
# The fields are always present; sentimentScore is an average and must never be summed across rows or responses.
|
|
113
113
|
# message_type scopes the SENTIMENT figures to "SMS", "MMS" or "P2P" (single value, array, or comma-separated
|
|
114
114
|
# string); omit for all scored types. It does NOT narrow the message counts, which are always returned split per type.
|
|
115
|
-
# carrier_family filters by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless); single value, array,
|
|
115
|
+
# carrier_family filters by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array,
|
|
116
116
|
# or comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
117
117
|
# granularity ("day" | "hour") is the time-bucket grain of the byDate rows. Omit for day (each row's _id is a
|
|
118
118
|
# "YYYY-MM-DD" date). "hour" buckets by hour (each row's _id is a "YYYY-MM-DD HH:MM:SS" UTC hour; start_date is
|
|
@@ -199,7 +199,7 @@ module SignalHouseSms
|
|
|
199
199
|
# message_type: SMS | MMS | P2P (single value or array) — scopes ONLY the sentiment figures.
|
|
200
200
|
# Omit for all scored types; it does not narrow the message counts, which are always returned
|
|
201
201
|
# split per type and have no filterable type dimension.
|
|
202
|
-
# carrier_family filters by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless); single value, array,
|
|
202
|
+
# carrier_family filters by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array,
|
|
203
203
|
# or comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
204
204
|
# registration_id filters to traffic attributed to these registrations (hourly analytics only; a 400 while hourly
|
|
205
205
|
# reads are off); single value or array. A phone_number filter takes precedence.
|
|
@@ -227,7 +227,7 @@ module SignalHouseSms
|
|
|
227
227
|
# channel: "both" (default, every code) or "tenDLC" | "virtualLongCode" | "tollFree" | "shortCode" | "p2p" (single value or
|
|
228
228
|
# array) — scopes ORDER BY + totalCount by the stored channel column; when one channel is
|
|
229
229
|
# selected, totalErrors reflects only that channel.
|
|
230
|
-
# carrier_family filters by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless); single value, array,
|
|
230
|
+
# carrier_family filters by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array,
|
|
231
231
|
# or comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
232
232
|
# registration_id filters to traffic attributed to these registrations (hourly analytics only; a 400 while hourly
|
|
233
233
|
# reads are off); single value or array. A phone_number filter takes precedence.
|
|
@@ -293,7 +293,7 @@ module SignalHouseSms
|
|
|
293
293
|
# records for non-US recipients), optOutKeyword — the normalized keyword that revoked consent (e.g. "stop", "opt out";
|
|
294
294
|
# a repeat opt-out records the most recent word), nil for opt-outs recorded before keyword capture
|
|
295
295
|
# shipped — and carrierFamily, the resolved carrier family of the recipient number (Default, ATT, TMobile,
|
|
296
|
-
# Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Standard, IceWireless), copied from the inbound message that
|
|
296
|
+
# Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics), copied from the inbound message that
|
|
297
297
|
# triggered the opt-out.
|
|
298
298
|
# registration_id filters to traffic attributed to these registrations (hourly analytics only; a 400 while hourly
|
|
299
299
|
# reads are off); single value or array. A phone_number filter takes precedence.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: signalhouse-sms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SignalHouse LLC
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Official Ruby SDK for the SignalHouse API. Provides a simple interface
|
|
14
14
|
for sending SMS/MMS messages, managing phone numbers, 10DLC brand/campaign registration,
|