abusezero 0.1.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 +7 -0
- data/API.md +188 -0
- data/LICENSE +279 -0
- data/README.md +111 -0
- data/THIRD-PARTY-NOTICES +1 -0
- data/examples/evaluate.rb +19 -0
- data/examples/frameworks.md +19 -0
- data/lib/abusezero/client.rb +555 -0
- data/lib/abusezero/core.rb +313 -0
- data/lib/abusezero/operations.json +20373 -0
- data/lib/abusezero.rb +4 -0
- data/sig/abusezero.rbs +188 -0
- data/sig/core.rbs +20 -0
- metadata +73 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7a4b5a36fa772706ef46ca90e3f15b712c0a9f110a9fcd26e7a2678c67127ea8
|
|
4
|
+
data.tar.gz: aa460c44b6ca9dc56ffc34b3c8e83df24a6a67ae8ef5096737f6c00dec2d8b3b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fcabf36ecaad65dfbea0937887c1a45a458c7fd1533656c791244b1d7c7296fe4f63a88f636c1c3f32fd1f4e7b7f7a70f7f070fad6a111b9aaedad6d68f56528
|
|
7
|
+
data.tar.gz: 139f3427a31f854b91f30edd5edb2973cdd30b3c97616c8c0b51b1d6b47fc7845dfd89d14b76eb25ac10bbfd10302c23b2a3a8c59d1a1bd4e0d8c51ec1328522
|
data/API.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# API methods
|
|
2
|
+
|
|
3
|
+
Pass input fields in the method's input and path fields separately in `path`. Public methods belong to `AbuseZero::PublicClient` and need no credentials. All other methods belong to `AbuseZero::Client`. Methods with the `operations:management` scope need an OAuth access token; an API key alone can't call them.
|
|
4
|
+
|
|
5
|
+
| Method | HTTP operation | Path fields | Idempotency key | Scope |
|
|
6
|
+
|---|---|---|---|---|
|
|
7
|
+
| `pricing()` | `GET /v1/public/pricing` | — | — | Public, no credentials |
|
|
8
|
+
| `price_quote()` | `GET /v1/public/pricing/quote` | — | — | Public, no credentials |
|
|
9
|
+
| `docs()` | `GET /v1/public/docs` | — | — | Public, no credentials |
|
|
10
|
+
| `search_docs()` | `GET /v1/public/docs/search` | — | — | Public, no credentials |
|
|
11
|
+
| `public_docs_page()` | `GET /v1/public/docs/{path}` | path | — | Public, no credentials |
|
|
12
|
+
| `help_articles()` | `GET /v1/public/help` | — | — | Public, no credentials |
|
|
13
|
+
| `search_help()` | `GET /v1/public/help/search` | — | — | Public, no credentials |
|
|
14
|
+
| `public_help_article()` | `GET /v1/public/help/{path}` | path | — | Public, no credentials |
|
|
15
|
+
| `openapi()` | `GET /v1/public/openapi` | — | — | Public, no credentials |
|
|
16
|
+
| `actions()` | `GET /v1/public/actions` | — | — | Public, no credentials |
|
|
17
|
+
| `error_codes()` | `GET /v1/public/errors` | — | — | Public, no credentials |
|
|
18
|
+
| `reason_codes()` | `GET /v1/public/reasons` | — | — | Public, no credentials |
|
|
19
|
+
| `webhook_event_types()` | `GET /v1/public/webhook-events` | — | — | Public, no credentials |
|
|
20
|
+
| `conditions()` | `GET /v1/public/conditions` | — | — | Public, no credentials |
|
|
21
|
+
| `glossary()` | `GET /v1/public/glossary` | — | — | Public, no credentials |
|
|
22
|
+
| `legal_documents()` | `GET /v1/public/legal` | — | — | Public, no credentials |
|
|
23
|
+
| `legal_document()` | `GET /v1/public/legal/{document}` | document | — | Public, no credentials |
|
|
24
|
+
| `changelog()` | `GET /v1/public/changelog` | — | — | Public, no credentials |
|
|
25
|
+
| `blog_posts()` | `GET /v1/public/blog` | — | — | Public, no credentials |
|
|
26
|
+
| `blog_post()` | `GET /v1/public/blog/{slug}` | slug | — | Public, no credentials |
|
|
27
|
+
| `versions()` | `GET /v1/public/versions` | — | — | Public, no credentials |
|
|
28
|
+
| `service_status()` | `GET /v1/public/status` | — | — | Public, no credentials |
|
|
29
|
+
| `contacts()` | `GET /v1/public/contacts` | — | — | Public, no credentials |
|
|
30
|
+
| `contact_sales()` | `POST /v1/public/contact/sales` | — | Required | Public, no credentials |
|
|
31
|
+
| `contact_support()` | `POST /v1/public/contact/support` | — | Required | Public, no credentials |
|
|
32
|
+
| `start_onboarding()` | `POST /v1/public/onboarding-sessions` | — | — | Public, no credentials |
|
|
33
|
+
| `onboarding_status()` | `POST /v1/public/onboarding-sessions/{id}/status` | id | — | Public, no credentials |
|
|
34
|
+
| `workspaces()` | `GET /v1/workspaces` | — | — | `operations:general` |
|
|
35
|
+
| `me()` | `GET /v1/me` | — | — | `operations:general` |
|
|
36
|
+
| `api_keys()` | `GET /v1/api-keys` | — | — | `operations:general` |
|
|
37
|
+
| `create_api_key()` | `POST /v1/api-keys` | — | Required | `operations:management` |
|
|
38
|
+
| `update_api_key()` | `PATCH /v1/api-keys/{id}` | id | Required | `operations:management` |
|
|
39
|
+
| `roll_api_key()` | `POST /v1/api-keys/{id}/roll` | id | Required | `operations:management` |
|
|
40
|
+
| `show_api_key_replacement()` | `POST /v1/api-keys/{id}/replacement` | id | Required | `operations:management` |
|
|
41
|
+
| `revoke_api_key()` | `POST /v1/api-keys/{id}/revoke` | id | Required | `operations:management` |
|
|
42
|
+
| `machine_clients()` | `GET /v1/machine-clients` | — | — | `operations:general` |
|
|
43
|
+
| `create_machine_client()` | `POST /v1/machine-clients` | — | Required | `operations:management` |
|
|
44
|
+
| `rotate_machine_client_secret()` | `POST /v1/machine-clients/{id}/rotate-secret` | id | Required | `operations:management` |
|
|
45
|
+
| `revoke_machine_client()` | `POST /v1/machine-clients/{id}/revoke` | id | Required | `operations:management` |
|
|
46
|
+
| `authorized_apps()` | `GET /v1/authorized-apps` | — | — | `operations:general` |
|
|
47
|
+
| `disconnect_authorized_app()` | `POST /v1/authorized-apps/{id}/disconnect` | id | Required | `operations:management` |
|
|
48
|
+
| `members()` | `GET /v1/members` | — | — | `operations:general` |
|
|
49
|
+
| `update_member()` | `PATCH /v1/members/{id}` | id | Required | `operations:management` |
|
|
50
|
+
| `remove_member()` | `DELETE /v1/members/{id}` | id | Required | `operations:management` |
|
|
51
|
+
| `invitations()` | `GET /v1/invitations` | — | — | `operations:general` |
|
|
52
|
+
| `invite_member()` | `POST /v1/invitations` | — | Required | `operations:management` |
|
|
53
|
+
| `resend_invitation()` | `POST /v1/invitations/{id}/resend` | id | Required | `operations:management` |
|
|
54
|
+
| `cancel_invitation()` | `POST /v1/invitations/{id}/cancel` | id | Required | `operations:management` |
|
|
55
|
+
| `workspace_settings()` | `GET /v1/workspace` | — | — | `operations:general` |
|
|
56
|
+
| `update_workspace_settings()` | `PATCH /v1/workspace` | — | Required | `operations:configuration` |
|
|
57
|
+
| `upload_workspace_icon()` | `PUT /v1/workspace/icon` | — | Required | `operations:configuration` |
|
|
58
|
+
| `remove_workspace_icon()` | `DELETE /v1/workspace/icon` | — | Required | `operations:configuration` |
|
|
59
|
+
| `workspace_icon_upload()` | `GET /v1/workspace/icon/uploads/{id}` | id | — | `operations:general` |
|
|
60
|
+
| `set_data_retention()` | `PUT /v1/workspace/data-retention` | — | Required | `operations:management` |
|
|
61
|
+
| `setup_progress()` | `GET /v1/workspace/setup` | — | — | `operations:general` |
|
|
62
|
+
| `finish_setup()` | `POST /v1/workspace/setup/finish` | — | Required | `operations:general` |
|
|
63
|
+
| `dismiss_setup_guide()` | `POST /v1/workspace/setup/dismiss` | — | Required | `operations:general` |
|
|
64
|
+
| `leave_workspace()` | `POST /v1/workspace/leave` | — | Required | `operations:general` |
|
|
65
|
+
| `evaluations()` | `GET /v1/evaluations` | — | — | `operations:general` |
|
|
66
|
+
| `evaluate()` | `POST /v1/evaluations` | — | Required | `operations:general` |
|
|
67
|
+
| `evaluation_filters()` | `GET /v1/evaluation-filters` | — | — | `operations:general` |
|
|
68
|
+
| `get_evaluation()` | `GET /v1/evaluations/{id}` | id | — | `operations:general` |
|
|
69
|
+
| `evaluation_graph()` | `GET /v1/evaluations/{id}/graph` | id | — | `operations:general` |
|
|
70
|
+
| `evaluation_evidence()` | `GET /v1/evaluations/{id}/evidence` | id | — | `operations:general` |
|
|
71
|
+
| `outcomes()` | `GET /v1/outcomes` | — | — | `operations:general` |
|
|
72
|
+
| `get_outcome()` | `GET /v1/outcomes/{id}` | id | — | `operations:general` |
|
|
73
|
+
| `outcome()` | `POST /v1/evaluations/{id}/outcome` | id | Required | `operations:general` |
|
|
74
|
+
| `dry_run_evaluation()` | `POST /v1/evaluations/dry-run` | — | Required | `operations:general` |
|
|
75
|
+
| `simulate()` | `POST /v1/simulations` | — | — | `operations:general` |
|
|
76
|
+
| `replay()` | `POST /v1/replays` | — | — | `operations:general` |
|
|
77
|
+
| `benefits()` | `GET /v1/benefits` | — | — | `operations:general` |
|
|
78
|
+
| `create_benefit()` | `POST /v1/benefits` | — | Required | `operations:configuration` |
|
|
79
|
+
| `get_benefit()` | `GET /v1/benefits/{id}` | id | — | `operations:general` |
|
|
80
|
+
| `update_benefit()` | `PATCH /v1/benefits/{id}` | id | Required | `operations:configuration` |
|
|
81
|
+
| `delete_benefit()` | `DELETE /v1/benefits/{id}` | id | Required | `operations:configuration` |
|
|
82
|
+
| `policies()` | `GET /v1/policies` | — | — | `operations:general` |
|
|
83
|
+
| `create_policy()` | `POST /v1/policies` | — | Required | `operations:configuration` |
|
|
84
|
+
| `get_policy()` | `GET /v1/policies/{id}` | id | — | `operations:general` |
|
|
85
|
+
| `update_policy()` | `PATCH /v1/policies/{id}` | id | Required | `operations:configuration` |
|
|
86
|
+
| `delete_policy()` | `DELETE /v1/policies/{id}` | id | Required | `operations:configuration` |
|
|
87
|
+
| `duplicate_policy()` | `POST /v1/policies/{id}/duplicate` | id | Required | `operations:configuration` |
|
|
88
|
+
| `policy_versions()` | `GET /v1/policies/{id}/versions` | id | — | `operations:general` |
|
|
89
|
+
| `get_policy_version()` | `GET /v1/policies/{id}/versions/{version}` | id, version | — | `operations:general` |
|
|
90
|
+
| `policy_signals()` | `GET /v1/policy-signals` | — | — | `operations:general` |
|
|
91
|
+
| `access_lists()` | `GET /v1/access-lists` | — | — | `operations:general` |
|
|
92
|
+
| `add_access_list_entries()` | `POST /v1/access-lists` | — | Required | `operations:configuration` |
|
|
93
|
+
| `get_access_list_entry()` | `GET /v1/access-lists/{id}` | id | — | `operations:general` |
|
|
94
|
+
| `delete_access_list_entry()` | `DELETE /v1/access-lists/{id}` | id | Required | `operations:configuration` |
|
|
95
|
+
| `update_access_list_entry()` | `PATCH /v1/access-lists/{id}` | id | Required | `operations:configuration` |
|
|
96
|
+
| `look_up_identifier()` | `POST /v1/identifiers/lookup` | — | — | `operations:general` |
|
|
97
|
+
| `custom_identifiers()` | `GET /v1/custom-identifiers` | — | — | `operations:general` |
|
|
98
|
+
| `register_custom_identifier()` | `POST /v1/custom-identifiers` | — | Required | `operations:configuration` |
|
|
99
|
+
| `get_custom_identifier()` | `GET /v1/custom-identifiers/{id}` | id | — | `operations:general` |
|
|
100
|
+
| `delete_custom_identifier()` | `DELETE /v1/custom-identifiers/{id}` | id | Required | `operations:configuration` |
|
|
101
|
+
| `imports()` | `GET /v1/imports` | — | — | `operations:general` |
|
|
102
|
+
| `import_claim_history()` | `POST /v1/imports` | — | Required | `operations:general` |
|
|
103
|
+
| `create_csv_import()` | `POST /v1/imports/csv` | — | Required | `operations:general` |
|
|
104
|
+
| `get_import()` | `GET /v1/imports/{id}` | id | — | `operations:general` |
|
|
105
|
+
| `list_import_problems()` | `GET /v1/imports/{id}/problems` | id | — | `operations:general` |
|
|
106
|
+
| `import_problems_download()` | `GET /v1/imports/{id}/problems/download` | id | — | `operations:general` |
|
|
107
|
+
| `confirm_import()` | `POST /v1/imports/{id}/confirm` | id | Required | `operations:general` |
|
|
108
|
+
| `discard_import()` | `POST /v1/imports/{id}/discard` | id | Required | `operations:general` |
|
|
109
|
+
| `fix_import_row()` | `POST /v1/imports/{id}/fix` | id | Required | `operations:general` |
|
|
110
|
+
| `skip_import_row()` | `POST /v1/imports/{id}/skip` | id | Required | `operations:general` |
|
|
111
|
+
| `exports()` | `GET /v1/exports` | — | — | `operations:general` |
|
|
112
|
+
| `request_export()` | `POST /v1/exports` | — | Required | `operations:general` |
|
|
113
|
+
| `get_export()` | `GET /v1/exports/{id}` | id | — | `operations:general` |
|
|
114
|
+
| `export_download()` | `GET /v1/exports/{id}/download` | id | — | `operations:general` |
|
|
115
|
+
| `request_workspace_export()` | `POST /v1/workspace-exports` | — | Required | `operations:general` |
|
|
116
|
+
| `workspace_export()` | `GET /v1/workspace-exports` | — | — | `operations:general` |
|
|
117
|
+
| `workspace_export_download()` | `GET /v1/workspace-exports/{id}/download` | id | — | `operations:general` |
|
|
118
|
+
| `delete_workspace_export()` | `DELETE /v1/workspace-exports/{id}` | id | Required | `operations:general` |
|
|
119
|
+
| `dry_run_data_deletion()` | `POST /v1/data-deletions/dry-run` | — | — | `operations:general` |
|
|
120
|
+
| `data_deletions()` | `GET /v1/data-deletions` | — | — | `operations:general` |
|
|
121
|
+
| `request_data_deletion()` | `POST /v1/data-deletions` | — | Required | `operations:general` |
|
|
122
|
+
| `get_data_deletion()` | `GET /v1/data-deletions/{id}` | id | — | `operations:general` |
|
|
123
|
+
| `analytics()` | `GET /v1/analytics` | — | — | `operations:general` |
|
|
124
|
+
| `overview()` | `GET /v1/overview` | — | — | `operations:general` |
|
|
125
|
+
| `benefit_value()` | `GET /v1/analytics/value` | — | — | `operations:general` |
|
|
126
|
+
| `denial_reasons()` | `GET /v1/analytics/denial-reasons` | — | — | `operations:general` |
|
|
127
|
+
| `request_logs()` | `GET /v1/request-logs` | — | — | `operations:general` |
|
|
128
|
+
| `get_request_log()` | `GET /v1/request-logs/{id}` | id | — | `operations:general` |
|
|
129
|
+
| `audit_logs()` | `GET /v1/audit-logs` | — | — | `operations:general` |
|
|
130
|
+
| `get_audit_log()` | `GET /v1/audit-logs/{id}` | id | — | `operations:general` |
|
|
131
|
+
| `account_status()` | `GET /v1/account-status` | — | — | `operations:general` |
|
|
132
|
+
| `integration_status()` | `GET /v1/integration-status` | — | — | `operations:general` |
|
|
133
|
+
| `events()` | `GET /v1/events` | — | — | `operations:general` |
|
|
134
|
+
| `browser_collection()` | `GET /v1/browser-collection` | — | — | `operations:general` |
|
|
135
|
+
| `update_browser_collection()` | `PATCH /v1/browser-collection` | — | Required | `operations:configuration` |
|
|
136
|
+
| `browser_script()` | `GET /v1/browser-collection/script` | — | — | `operations:general` |
|
|
137
|
+
| `webhook_endpoints()` | `GET /v1/webhook-endpoints` | — | — | `operations:general` |
|
|
138
|
+
| `create_webhook_endpoint()` | `POST /v1/webhook-endpoints` | — | Required | `operations:configuration` |
|
|
139
|
+
| `get_webhook_endpoint()` | `GET /v1/webhook-endpoints/{id}` | id | — | `operations:general` |
|
|
140
|
+
| `update_webhook_endpoint()` | `PATCH /v1/webhook-endpoints/{id}` | id | Required | `operations:configuration` |
|
|
141
|
+
| `delete_webhook_endpoint()` | `DELETE /v1/webhook-endpoints/{id}` | id | Required | `operations:configuration` |
|
|
142
|
+
| `send_webhook_test()` | `POST /v1/webhook-endpoints/{id}/test` | id | Required | `operations:general` |
|
|
143
|
+
| `enable_webhook_endpoint()` | `POST /v1/webhook-endpoints/{id}/enable` | id | Required | `operations:configuration` |
|
|
144
|
+
| `disable_webhook_endpoint()` | `POST /v1/webhook-endpoints/{id}/disable` | id | Required | `operations:configuration` |
|
|
145
|
+
| `webhook_signing_secret()` | `GET /v1/webhook-endpoints/{id}/secret` | id | — | `operations:management` |
|
|
146
|
+
| `rotate_webhook_signing_secret()` | `POST /v1/webhook-endpoints/{id}/rotate-secret` | id | Required | `operations:management` |
|
|
147
|
+
| `webhook_usage()` | `GET /v1/webhook-usage` | — | — | `operations:general` |
|
|
148
|
+
| `webhook_deliveries()` | `GET /v1/webhook-deliveries` | — | — | `operations:general` |
|
|
149
|
+
| `get_webhook_delivery()` | `GET /v1/webhook-deliveries/{id}` | id | — | `operations:general` |
|
|
150
|
+
| `resend_webhook_delivery()` | `POST /v1/webhook-deliveries/{id}/resend` | id | Required | `operations:general` |
|
|
151
|
+
| `plan()` | `GET /v1/billing/plan` | — | — | `operations:general` |
|
|
152
|
+
| `usage()` | `GET /v1/billing/usage` | — | — | `operations:general` |
|
|
153
|
+
| `credit_history()` | `GET /v1/billing/credit-history` | — | — | `operations:general` |
|
|
154
|
+
| `daily_usage()` | `GET /v1/billing/daily-usage` | — | — | `operations:general` |
|
|
155
|
+
| `enterprise_plans()` | `GET /v1/billing/enterprise-plans` | — | — | `operations:general` |
|
|
156
|
+
| `preview_enterprise_plan_code()` | `POST /v1/billing/enterprise-plan-codes/preview` | — | — | `operations:general` |
|
|
157
|
+
| `upcoming_charge()` | `GET /v1/billing/upcoming-charge` | — | — | `operations:general` |
|
|
158
|
+
| `invoices()` | `GET /v1/billing/invoices` | — | — | `operations:general` |
|
|
159
|
+
| `payment_methods()` | `GET /v1/billing/payment-methods` | — | — | `operations:general` |
|
|
160
|
+
| `billing_details()` | `GET /v1/billing/details` | — | — | `operations:general` |
|
|
161
|
+
| `update_billing_details()` | `PUT /v1/billing/details` | — | Required | `operations:configuration` |
|
|
162
|
+
| `get_payment()` | `GET /v1/billing/payments/{id}` | id | — | `operations:general` |
|
|
163
|
+
| `quote_plan_change()` | `POST /v1/billing/quotes` | — | — | `operations:general` |
|
|
164
|
+
| `set_low_credit_alert()` | `PUT /v1/billing/low-credit-alert` | — | Required | `operations:configuration` |
|
|
165
|
+
| `choose_what_stays_active()` | `POST /v1/billing/over-limit` | — | Required | `operations:configuration` |
|
|
166
|
+
| `set_auto_reload()` | `PUT /v1/billing/auto-reload` | — | Required | `operations:management` |
|
|
167
|
+
| `buy_credits()` | `POST /v1/billing/credit-purchases` | — | Required | `operations:management` |
|
|
168
|
+
| `retry_credit_purchase()` | `POST /v1/billing/credit-purchases/{id}/retry` | id | Required | `operations:management` |
|
|
169
|
+
| `confirm_plan_change()` | `POST /v1/billing/quotes/{id}/confirm` | id | Required | `operations:management` |
|
|
170
|
+
| `undo_scheduled_downgrade()` | `POST /v1/billing/scheduled-change/undo` | — | Required | `operations:management` |
|
|
171
|
+
| `resume_subscription()` | `POST /v1/billing/subscription/resume` | — | Required | `operations:management` |
|
|
172
|
+
| `pay_overdue_invoice()` | `POST /v1/billing/invoices/pay` | — | Required | `operations:management` |
|
|
173
|
+
| `set_default_payment_method()` | `POST /v1/billing/payment-methods/{id}/default` | id | Required | `operations:management` |
|
|
174
|
+
| `move_backup_payment_method()` | `POST /v1/billing/payment-methods/{id}/move` | id | Required | `operations:management` |
|
|
175
|
+
| `remove_payment_method()` | `DELETE /v1/billing/payment-methods/{id}` | id | Required | `operations:management` |
|
|
176
|
+
| `redeem_enterprise_plan_code()` | `POST /v1/billing/enterprise-plan-codes/redeem` | — | Required | `operations:management` |
|
|
177
|
+
| `create_billing_approval_link()` | `POST /v1/billing/approval-links` | — | Required | `operations:management` |
|
|
178
|
+
| `billing_approval_link()` | `GET /v1/billing/approval-links/{id}` | id | — | `operations:general` |
|
|
179
|
+
| `update_account_name()` | `PATCH /v1/account` | — | Required | `operations:general` |
|
|
180
|
+
| `email_preferences()` | `GET /v1/account/email-preferences` | — | — | `operations:general` |
|
|
181
|
+
| `update_email_preferences()` | `PATCH /v1/account/email-preferences` | — | Required | `operations:configuration` |
|
|
182
|
+
| `notifications()` | `GET /v1/notifications` | — | — | `operations:general` |
|
|
183
|
+
| `mark_notification()` | `PATCH /v1/notifications/{id}` | id | Required | `operations:general` |
|
|
184
|
+
| `mark_all_notifications_read()` | `POST /v1/notifications/read-all` | — | Required | `operations:general` |
|
|
185
|
+
| `run_notification_action()` | `POST /v1/notifications/{id}/run` | id | Required | `operations:general` |
|
|
186
|
+
| `contact_support()` | `POST /v1/support-tickets` | — | Required | `operations:general` |
|
|
187
|
+
| `support_tickets()` | `GET /v1/support-tickets` | — | — | `operations:general` |
|
|
188
|
+
| `send_feedback()` | `POST /v1/feedback` | — | Required | `operations:general` |
|
data/LICENSE
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
ABUSEZERO SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AbuseZero. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This AbuseZero Software Development Kit License Agreement (this "Agreement")
|
|
6
|
+
is a legal agreement between you and AbuseZero. If you accept this Agreement
|
|
7
|
+
on behalf of an organization, "you" means that organization, and you represent
|
|
8
|
+
that you have authority to bind it. By downloading, installing, copying,
|
|
9
|
+
accessing or using the Software, you agree to this Agreement. If you do not
|
|
10
|
+
agree, do not download, install, copy, access or use the Software.
|
|
11
|
+
|
|
12
|
+
1. DEFINITIONS
|
|
13
|
+
|
|
14
|
+
1.1 "AbuseZero", "we" and "us" mean the entity that operates the AbuseZero
|
|
15
|
+
service, as identified in the Terms.
|
|
16
|
+
|
|
17
|
+
1.2 "Terms" means the AbuseZero Terms of Service published at
|
|
18
|
+
https://abusezero.com/terms, together with the documents they reference,
|
|
19
|
+
including the Acceptable Use Policy, Privacy Policy and Data Processing
|
|
20
|
+
Agreement, each as updated from time to time, or any other written
|
|
21
|
+
agreement between you and AbuseZero that governs your use of the Service.
|
|
22
|
+
|
|
23
|
+
1.3 "Service" means the AbuseZero application programming interfaces, Model
|
|
24
|
+
Context Protocol endpoints, dashboard and related hosted services.
|
|
25
|
+
|
|
26
|
+
1.4 "Software" means this software package, including its server, browser,
|
|
27
|
+
command-line and Model Context Protocol components, any standalone
|
|
28
|
+
browser script made available by AbuseZero, and all related files,
|
|
29
|
+
documentation, updates and copies, excluding Third-Party Components.
|
|
30
|
+
|
|
31
|
+
1.5 "Browser Components" means the parts of the Software designed to run in
|
|
32
|
+
an end user's web browser.
|
|
33
|
+
|
|
34
|
+
1.6 "Your Application" means a website, application or service that you
|
|
35
|
+
develop and operate and that uses the Service.
|
|
36
|
+
|
|
37
|
+
1.7 "Third-Party Components" means software owned by third parties and
|
|
38
|
+
included in the Software, as listed in the THIRD-PARTY-NOTICES file.
|
|
39
|
+
|
|
40
|
+
2. LICENSE GRANT
|
|
41
|
+
|
|
42
|
+
2.1 Subject to your continued compliance with this Agreement and the Terms,
|
|
43
|
+
AbuseZero grants you a limited, non-exclusive, non-transferable,
|
|
44
|
+
non-sublicensable, revocable, royalty-free license, during the term of
|
|
45
|
+
this Agreement, to:
|
|
46
|
+
|
|
47
|
+
(a) install, run and use the Software solely to access and use the
|
|
48
|
+
Service in accordance with the Terms;
|
|
49
|
+
|
|
50
|
+
(b) incorporate the Software, in unmodified form, into Your Application
|
|
51
|
+
solely to enable Your Application to access the Service; and
|
|
52
|
+
|
|
53
|
+
(c) distribute the Browser Components, in unmodified object form and
|
|
54
|
+
solely as part of Your Application, to end users of Your Application,
|
|
55
|
+
including through bundling, minification or other automated build
|
|
56
|
+
processes that do not alter the functionality of the Browser
|
|
57
|
+
Components.
|
|
58
|
+
|
|
59
|
+
2.2 You may make a reasonable number of copies of the Software for backup,
|
|
60
|
+
development, testing and deployment of Your Application.
|
|
61
|
+
|
|
62
|
+
2.3 All rights not expressly granted in this Agreement are reserved by
|
|
63
|
+
AbuseZero and its licensors. No license is granted by implication,
|
|
64
|
+
estoppel or otherwise.
|
|
65
|
+
|
|
66
|
+
3. RESTRICTIONS
|
|
67
|
+
|
|
68
|
+
Except as expressly permitted by this Agreement or by applicable law that
|
|
69
|
+
cannot be excluded by contract, you will not, and will not permit any
|
|
70
|
+
third party to:
|
|
71
|
+
|
|
72
|
+
(a) copy, modify, translate, adapt or create derivative works of the
|
|
73
|
+
Software;
|
|
74
|
+
|
|
75
|
+
(b) decompile, disassemble, reverse engineer or otherwise attempt to
|
|
76
|
+
derive the source code, algorithms, structure, signals or methods of
|
|
77
|
+
the Software or the Service;
|
|
78
|
+
|
|
79
|
+
(c) sell, resell, rent, lease, lend, sublicense, distribute, publish or
|
|
80
|
+
otherwise make the Software available to any third party, except the
|
|
81
|
+
Browser Components as permitted by Section 2.1(c);
|
|
82
|
+
|
|
83
|
+
(d) publish or distribute the Software, or any part of it, as a
|
|
84
|
+
standalone package, library, module or container image, in any
|
|
85
|
+
package registry, repository or other channel;
|
|
86
|
+
|
|
87
|
+
(e) use the Software to access any service other than the Service, or to
|
|
88
|
+
access the Service other than in accordance with the Terms;
|
|
89
|
+
|
|
90
|
+
(f) use the Software to build, train, benchmark or improve a product or
|
|
91
|
+
service that competes with the Service, or for competitive analysis;
|
|
92
|
+
|
|
93
|
+
(g) circumvent, disable or interfere with any security, authentication,
|
|
94
|
+
rate-limiting, usage-limiting or integrity mechanism of the Software
|
|
95
|
+
or the Service;
|
|
96
|
+
|
|
97
|
+
(h) remove, alter or obscure any copyright, trademark, license or other
|
|
98
|
+
proprietary notice in or on the Software;
|
|
99
|
+
|
|
100
|
+
(i) use the Software in violation of any applicable law, regulation or
|
|
101
|
+
third-party right, including laws on privacy, data protection,
|
|
102
|
+
consumer protection, electronic communications and export control;
|
|
103
|
+
or
|
|
104
|
+
|
|
105
|
+
(j) use the Software to transmit malicious code or data that you do not
|
|
106
|
+
have the right to transmit.
|
|
107
|
+
|
|
108
|
+
4. YOUR RESPONSIBILITIES
|
|
109
|
+
|
|
110
|
+
4.1 You are responsible for Your Application, for all use of the Software
|
|
111
|
+
under your credentials, and for your compliance and your end users'
|
|
112
|
+
compliance with this Agreement and the Terms.
|
|
113
|
+
|
|
114
|
+
4.2 You are responsible for providing any notices to, and obtaining any
|
|
115
|
+
consents from, end users that are required by applicable law for the use
|
|
116
|
+
of the Software in Your Application, including for the Browser
|
|
117
|
+
Components.
|
|
118
|
+
|
|
119
|
+
4.3 You are responsible for keeping credentials, access tokens and devices
|
|
120
|
+
on which the Software stores them secure, and for revoking access you no
|
|
121
|
+
longer need.
|
|
122
|
+
|
|
123
|
+
5. DATA
|
|
124
|
+
|
|
125
|
+
The Software transmits data to the Service. AbuseZero processes that data
|
|
126
|
+
in accordance with the Terms. This Agreement does not change the
|
|
127
|
+
allocation of rights and responsibilities for data set out in the Terms.
|
|
128
|
+
|
|
129
|
+
6. OWNERSHIP
|
|
130
|
+
|
|
131
|
+
The Software is licensed, not sold. AbuseZero and its licensors retain all
|
|
132
|
+
right, title and interest, including all intellectual property rights, in
|
|
133
|
+
and to the Software, the Service and all copies, modifications and
|
|
134
|
+
derivative works of them. This Agreement grants you no right to use the
|
|
135
|
+
names, trademarks, service marks, logos or trade dress of AbuseZero.
|
|
136
|
+
|
|
137
|
+
7. THIRD-PARTY COMPONENTS
|
|
138
|
+
|
|
139
|
+
Third-Party Components are licensed to you under their own license terms,
|
|
140
|
+
which are reproduced in the THIRD-PARTY-NOTICES file. Nothing in this
|
|
141
|
+
Agreement limits your rights under, or grants you rights that supersede,
|
|
142
|
+
those license terms. To the extent those license terms require it,
|
|
143
|
+
they apply to the relevant Third-Party Components in place of this
|
|
144
|
+
Agreement.
|
|
145
|
+
|
|
146
|
+
8. UPDATES AND SUPPORT
|
|
147
|
+
|
|
148
|
+
AbuseZero may, at its discretion, provide updates to the Software, change
|
|
149
|
+
or discontinue the Software or any of its features, and require you to
|
|
150
|
+
use a current version to continue accessing the Service. Updates are
|
|
151
|
+
governed by this Agreement unless they are accompanied by other terms.
|
|
152
|
+
AbuseZero has no obligation to provide maintenance or support for the
|
|
153
|
+
Software except as stated in the Terms.
|
|
154
|
+
|
|
155
|
+
9. FEEDBACK
|
|
156
|
+
|
|
157
|
+
If you provide suggestions, comments or other feedback about the Software,
|
|
158
|
+
AbuseZero may use it for any purpose without restriction, compensation or
|
|
159
|
+
obligation to you.
|
|
160
|
+
|
|
161
|
+
10. TERM AND TERMINATION
|
|
162
|
+
|
|
163
|
+
10.1 This Agreement takes effect when you first download, install, copy,
|
|
164
|
+
access or use the Software and continues until terminated.
|
|
165
|
+
|
|
166
|
+
10.2 This Agreement, and all licenses granted under it, terminate
|
|
167
|
+
automatically and without notice if you breach this Agreement, or if
|
|
168
|
+
your right to use the Service ends under the Terms. AbuseZero may also
|
|
169
|
+
terminate this Agreement at any time on notice to you.
|
|
170
|
+
|
|
171
|
+
10.3 On termination, you must stop using the Software and destroy all copies
|
|
172
|
+
in your possession or control, including copies incorporated into Your
|
|
173
|
+
Application. Sections 1, 3, 4, 5, 6, 7, 9, 10.3 and 11 through 16
|
|
174
|
+
survive termination.
|
|
175
|
+
|
|
176
|
+
11. DISCLAIMER OF WARRANTIES
|
|
177
|
+
|
|
178
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS
|
|
179
|
+
PROVIDED "AS IS" AND "AS AVAILABLE", WITH ALL FAULTS AND WITHOUT WARRANTY
|
|
180
|
+
OF ANY KIND. ABUSEZERO AND ITS LICENSORS DISCLAIM ALL WARRANTIES, WHETHER
|
|
181
|
+
EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING ANY WARRANTIES OF
|
|
182
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE,
|
|
183
|
+
NON-INFRINGEMENT, ACCURACY, QUIET ENJOYMENT AND ANY WARRANTIES ARISING
|
|
184
|
+
FROM COURSE OF DEALING OR USAGE OF TRADE. ABUSEZERO DOES NOT WARRANT THAT
|
|
185
|
+
THE SOFTWARE WILL BE UNINTERRUPTED, SECURE OR ERROR-FREE, THAT DEFECTS
|
|
186
|
+
WILL BE CORRECTED, OR THAT THE SOFTWARE OR THE SERVICE WILL DETECT OR
|
|
187
|
+
PREVENT ANY PARTICULAR ABUSE.
|
|
188
|
+
|
|
189
|
+
12. LIMITATION OF LIABILITY
|
|
190
|
+
|
|
191
|
+
12.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL
|
|
192
|
+
ABUSEZERO OR ITS LICENSORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
|
193
|
+
SPECIAL, CONSEQUENTIAL, EXEMPLARY OR PUNITIVE DAMAGES, OR FOR ANY LOSS
|
|
194
|
+
OF PROFITS, REVENUE, BUSINESS, GOODWILL, DATA OR USE, OR COSTS OF
|
|
195
|
+
SUBSTITUTE GOODS OR SERVICES, ARISING OUT OF OR RELATING TO THIS
|
|
196
|
+
AGREEMENT OR THE SOFTWARE, HOWEVER CAUSED AND UNDER ANY THEORY OF
|
|
197
|
+
LIABILITY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
198
|
+
|
|
199
|
+
12.2 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE TOTAL LIABILITY
|
|
200
|
+
OF ABUSEZERO AND ITS LICENSORS ARISING OUT OF OR RELATING TO THIS
|
|
201
|
+
AGREEMENT OR THE SOFTWARE WILL NOT EXCEED ONE HUNDRED UNITED STATES
|
|
202
|
+
DOLLARS (USD 100). THE SOFTWARE IS LICENSED FREE OF CHARGE, AND ANY
|
|
203
|
+
LIABILITY RELATING TO THE SERVICE IS GOVERNED SOLELY BY THE TERMS.
|
|
204
|
+
|
|
205
|
+
12.3 THE LIMITATIONS IN THIS SECTION APPLY EVEN IF A REMEDY FAILS OF ITS
|
|
206
|
+
ESSENTIAL PURPOSE, AND DO NOT APPLY TO LIABILITY THAT CANNOT BE LIMITED
|
|
207
|
+
OR EXCLUDED UNDER APPLICABLE LAW.
|
|
208
|
+
|
|
209
|
+
13. INDEMNIFICATION
|
|
210
|
+
|
|
211
|
+
You will defend, indemnify and hold harmless AbuseZero, its affiliates
|
|
212
|
+
and their respective officers, directors, employees, agents and licensors
|
|
213
|
+
from and against any claims, damages, losses, liabilities, costs and
|
|
214
|
+
expenses, including reasonable legal fees, arising out of or relating to
|
|
215
|
+
(a) Your Application, (b) your use of the Software in breach of this
|
|
216
|
+
Agreement, the Terms or applicable law, or (c) your failure to provide
|
|
217
|
+
notices or obtain consents required by Section 4.2.
|
|
218
|
+
|
|
219
|
+
14. EXPORT CONTROL AND SANCTIONS
|
|
220
|
+
|
|
221
|
+
You will comply with all applicable export control and economic
|
|
222
|
+
sanctions laws and regulations. You represent that you are not located
|
|
223
|
+
in, or organized under the laws of, any country or region subject to
|
|
224
|
+
comprehensive sanctions, and that you are not, and are not owned or
|
|
225
|
+
controlled by, a person identified on any applicable restricted-party
|
|
226
|
+
list. You will not export, re-export or transfer the Software in
|
|
227
|
+
violation of those laws.
|
|
228
|
+
|
|
229
|
+
15. GOVERNMENT END USERS
|
|
230
|
+
|
|
231
|
+
The Software is "commercial computer software" and "commercial computer
|
|
232
|
+
software documentation", as those terms are used in the applicable
|
|
233
|
+
procurement regulations. Any use, duplication or disclosure by or for a
|
|
234
|
+
government is subject to the rights granted in this Agreement, which are
|
|
235
|
+
the only rights granted.
|
|
236
|
+
|
|
237
|
+
16. GENERAL
|
|
238
|
+
|
|
239
|
+
16.1 Relationship to the Terms. This Agreement governs the Software. The
|
|
240
|
+
Terms govern the Service. If this Agreement and the Terms conflict with
|
|
241
|
+
respect to the Software, this Agreement controls, except that any
|
|
242
|
+
provision of the Terms that gives AbuseZero greater protection controls.
|
|
243
|
+
|
|
244
|
+
16.2 Governing law and disputes. This Agreement, and any dispute arising out
|
|
245
|
+
of or relating to it, is governed by the law, and subject to the
|
|
246
|
+
exclusive jurisdiction of the courts, specified in the Terms, without
|
|
247
|
+
regard to conflict of law rules. The United Nations Convention on
|
|
248
|
+
Contracts for the International Sale of Goods does not apply.
|
|
249
|
+
|
|
250
|
+
16.3 Equitable relief. A breach of Section 3 or Section 6 may cause
|
|
251
|
+
AbuseZero irreparable harm for which damages would be an inadequate
|
|
252
|
+
remedy. AbuseZero may seek injunctive or other equitable relief in any
|
|
253
|
+
court of competent jurisdiction, in addition to any other remedy.
|
|
254
|
+
|
|
255
|
+
16.4 Assignment. You may not assign or transfer this Agreement, by operation
|
|
256
|
+
of law or otherwise, without AbuseZero's prior written consent. Any
|
|
257
|
+
attempted assignment without consent is void. AbuseZero may assign this
|
|
258
|
+
Agreement without restriction.
|
|
259
|
+
|
|
260
|
+
16.5 Changes. AbuseZero may update this Agreement by publishing a new
|
|
261
|
+
version with the Software. Each version of the Software is governed by
|
|
262
|
+
the version of this Agreement included with it.
|
|
263
|
+
|
|
264
|
+
16.6 Severability and waiver. If any provision of this Agreement is held
|
|
265
|
+
unenforceable, it will be enforced to the maximum extent permissible
|
|
266
|
+
and the remaining provisions remain in full force and effect. A failure
|
|
267
|
+
or delay in enforcing any provision is not a waiver of it.
|
|
268
|
+
|
|
269
|
+
16.7 Entire agreement. This Agreement, together with the Terms, is the
|
|
270
|
+
entire agreement between you and AbuseZero regarding the Software and
|
|
271
|
+
supersedes all prior or contemporaneous understandings regarding it.
|
|
272
|
+
|
|
273
|
+
16.8 Notices. AbuseZero may give notices under this Agreement by email to
|
|
274
|
+
the address associated with your AbuseZero account, in the dashboard,
|
|
275
|
+
or by publishing them with the Software. You may give notices to
|
|
276
|
+
AbuseZero through the contact page at https://abusezero.com/contact.
|
|
277
|
+
|
|
278
|
+
16.9 Interpretation. Headings are for convenience only. "Including" means
|
|
279
|
+
"including without limitation".
|
data/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# AbuseZero Ruby SDK
|
|
2
|
+
|
|
3
|
+
Use the AbuseZero Ruby SDK to evaluate claims and manage your workspace from your server. AbuseZero is an abuse prevention API for SaaS.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gem install abusezero
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With Bundler, add it to your Gemfile:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'abusezero', '~> 0.1'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Supported runtimes: Ruby 3.3, 3.4 and 4.0. The gem's RBS type signatures, in `sig/`, need RBS 3.5 or later.
|
|
18
|
+
|
|
19
|
+
The package includes its SDK license as `LICENSE`. Dependencies retain their own licenses; see `THIRD-PARTY-NOTICES`.
|
|
20
|
+
|
|
21
|
+
## Evaluate and report a grant
|
|
22
|
+
|
|
23
|
+
Store your SECRET KEY or RESTRICTED KEY in `ABUSEZERO_SECRET_KEY` on the server. Use a stable claim ID and keep the same idempotency key when retrying the same action.
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require 'abusezero'
|
|
27
|
+
|
|
28
|
+
def create_client
|
|
29
|
+
AbuseZero::Client.new(key: ENV.fetch('ABUSEZERO_SECRET_KEY'), outage: 'throw')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def evaluate_and_grant(client, claim_id:, email:)
|
|
33
|
+
raise ArgumentError, 'Provide a grant block.' unless block_given?
|
|
34
|
+
result = client.evaluate({
|
|
35
|
+
'benefit' => 'pro_trial', 'claim_id' => claim_id,
|
|
36
|
+
'subject' => { 'email' => email }
|
|
37
|
+
}, idempotency_key: 'evaluate:' + claim_id)
|
|
38
|
+
return result if result['status'] == 'skipped'
|
|
39
|
+
return result if result['source'] == 'local_outage' || result['result'] != 'allow'
|
|
40
|
+
yield claim_id # Your transaction must finish successfully before returning.
|
|
41
|
+
client.outcome({ 'outcome' => 'granted' }, path: { 'id' => result['id'] },
|
|
42
|
+
idempotency_key: 'grant:' + claim_id)
|
|
43
|
+
result
|
|
44
|
+
end
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Create a client when your server starts, reuse it across requests and close it at shutdown. A client sends one request at a time, so in a multi-threaded server, create one client per thread. Call this helper from your authenticated handler with your own stored claim ID, authenticated user email and transactional grant block. The grant block must be idempotent for that claim ID. The helper reports `granted` only after the grant block succeeds; if reporting fails afterward, retry with the same claim ID and keys. On `deny`, don't grant the benefit. A skipped result is neither allow nor deny, including when its reason is new to your application.
|
|
48
|
+
|
|
49
|
+
## Credentials, public calls and webhooks
|
|
50
|
+
|
|
51
|
+
```ruby
|
|
52
|
+
public_client = AbuseZero::PublicClient.new
|
|
53
|
+
catalog = public_client.pricing
|
|
54
|
+
public_client.close
|
|
55
|
+
|
|
56
|
+
client = AbuseZero::Client.new(access_token: ENV.fetch('ABUSEZERO_ACCESS_TOKEN'),
|
|
57
|
+
workspace: ENV.fetch('ABUSEZERO_WORKSPACE'), outage: 'throw')
|
|
58
|
+
page = client.api_keys({ 'limit' => 20 })
|
|
59
|
+
client.close
|
|
60
|
+
|
|
61
|
+
event = AbuseZero.verify_webhook(payload: raw_body, headers: headers,
|
|
62
|
+
secret: [current_secret, previous_secret])
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Catch `AbuseZero::Error`. Its fields are `code`, `status`, `request_id`, `retryable` and `docs_url`. `status` is `0` when no response arrived. Catch `AbuseZero::WebhookVerificationError` for invalid webhook signatures. If setup, helper or path input can't be used, such as a malformed URL, phone number or ID, the SDK raises `ArgumentError`. Other input that doesn't match the API raises `AbuseZero::Error` with `INVALID_REQUEST`.
|
|
66
|
+
|
|
67
|
+
For tests or proxies, pass a `transport:` callable receiving method, URL, headers, body bytes and remaining seconds. Return a response with `code`, `body` and header lookup through `[]`. The callable must respect the remaining budget and verify TLS.
|
|
68
|
+
|
|
69
|
+
Methods with the `operations:management` scope need an OAuth access token; an API key alone can't run them. They include creating, rolling and revoking API keys and machine clients, changing members and invitations, buying credits, changing the plan, paying invoices, managing payment methods, changing data retention and reading webhook signing secrets. `API.md` lists each method's scope. Reads such as listing API keys, members and invoices, and settings such as billing details, work with an API key that has their scope. The selected workspace and the approving member's permissions still apply. Public clients send no credentials.
|
|
70
|
+
|
|
71
|
+
Verify webhook signatures over the original request bytes before reading event data. Verification checks the timestamp within 300 seconds by default (`tolerance_seconds:`), accepts rotating secrets and rejects a modified body. Deduplicate accepted events by their event ID in your application.
|
|
72
|
+
|
|
73
|
+
## Retries and results
|
|
74
|
+
|
|
75
|
+
Set `outage` to `throw`, `allow` or `deny`. The default is `throw`. Only `evaluate` can return `source: local_outage`; `dry_run_evaluation` and every other method raise an error. Rate limits always remain errors. Skipped responses remain skips, including unknown skip reasons. Responses can gain new fields and new values. The SDK passes them through unchanged, so handle a value you don't recognize as a generic case.
|
|
76
|
+
|
|
77
|
+
Calls make at most three attempts. Network errors, retryable API errors and HTTP 429, 502, 503 and 504 may be retried. `Retry-After` sets the minimum wait. Every attempt uses identical serialized input and the same idempotency key. The entire call, including retry waits and any wait for its client, has one budget: 1.8 seconds for evaluation and 5 seconds for other calls. An `events` long poll adds 5 seconds to its requested wait, so give long polls a client of their own. The server's own operation deadline can be shorter.
|
|
78
|
+
|
|
79
|
+
## Methods and pagination
|
|
80
|
+
|
|
81
|
+
Every public server operation has a method. Pass query fields in the input object and path fields separately in `path`. Mutation methods require an idempotency key. See `API.md` in the package for the complete method map and the [AbuseZero REST API reference](https://docs.abusezero.com/docs/api-reference).
|
|
82
|
+
|
|
83
|
+
List methods accept `cursor` and `limit` where documented. Process the returned `data`, then pass the returned `next_cursor` to the same method until it is null. Keep IDs and cursors as strings. Send null only when the field allows it. A field you leave out isn't sent, and the API applies its default where it has one, so `update_benefit` resets any configuration field you leave out. Send every configuration field you aren't changing.
|
|
84
|
+
|
|
85
|
+
## Incoming requests and identifiers
|
|
86
|
+
|
|
87
|
+
```ruby
|
|
88
|
+
secret = ENV.fetch('IDENTIFIER_HASH_SECRET')
|
|
89
|
+
phone = AbuseZero.create_phone_hash(secret: secret, key_version: 'v1', e164: '+14155550123')
|
|
90
|
+
loyalty = AbuseZero.create_custom_identifier(secret: secret, key_version: 'v1', key: 'loyalty_id', value: 'L-4821')
|
|
91
|
+
incoming = AbuseZero.incoming_request(method: 'POST', url: 'https://example.com/signup',
|
|
92
|
+
headers: { 'user-agent' => 'Mozilla/5.0' })
|
|
93
|
+
|
|
94
|
+
client.evaluate({
|
|
95
|
+
'benefit' => 'pro_trial', 'claim_id' => claim_id, 'subject' => { 'email' => email },
|
|
96
|
+
'identifiers' => { 'phone_hash' => phone, 'phone_verified' => true, 'custom' => [loyalty] },
|
|
97
|
+
'request' => incoming
|
|
98
|
+
}, idempotency_key: 'evaluate:' + claim_id)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`incoming_request` takes the HTTP method, absolute URL and headers. It removes credential headers before returning the request object to include in an evaluation. It doesn't infer a trusted client IP; use your application's trusted proxy configuration for that.
|
|
102
|
+
|
|
103
|
+
`create_phone_hash` requires an E.164 phone number. `create_custom_identifier` requires the identifier's key and a nonempty value; register the key before you send it. Keep the hash secret and `key_version` consistent across applications that should recognize the same identifier. The helpers return the public API's hash objects.
|
|
104
|
+
|
|
105
|
+
## Frameworks and transport
|
|
106
|
+
|
|
107
|
+
Framework adapters are documented in `examples/frameworks.md`; no framework dependency is required. For browser protection, add the versioned script from AbuseZero to your page and pass its device token to your server. Send the token unchanged as `identifiers.device_token` in the evaluation input. If your consent tool keeps the script from loading, send `unavailable:not_loaded`. The Ruby SDK is the only package to install. See [Set up browser protection](https://docs.abusezero.com/docs/guides/set-up-browser-protection).
|
|
108
|
+
|
|
109
|
+
The default API origin is `https://api.abusezero.com`. Custom origins require HTTPS; HTTP is accepted only for explicit loopback testing. Built-in transports verify TLS and refuse redirects. Custom transports are responsible for equivalent behavior. Never log credentials or raw authenticated requests.
|
|
110
|
+
|
|
111
|
+
See [authentication](https://docs.abusezero.com/docs/api-reference/authentication), [evaluation results](https://docs.abusezero.com/docs/api-reference/evaluations#response), [skipped evaluations](https://docs.abusezero.com/docs/api-reference/evaluations#skipped-evaluations) and [webhooks](https://docs.abusezero.com/docs/guides/receive-webhooks).
|
data/THIRD-PARTY-NOTICES
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This package uses Ruby's standard library and the separately distributed base64 gem. Their own licenses and notices ship with Ruby and with that gem. No dependency source is bundled.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'abusezero'
|
|
2
|
+
|
|
3
|
+
def create_client
|
|
4
|
+
AbuseZero::Client.new(key: ENV.fetch('ABUSEZERO_SECRET_KEY'), outage: 'throw')
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def evaluate_and_grant(client, claim_id:, email:)
|
|
8
|
+
raise ArgumentError, 'Provide a grant block.' unless block_given?
|
|
9
|
+
result = client.evaluate({
|
|
10
|
+
'benefit' => 'pro_trial', 'claim_id' => claim_id,
|
|
11
|
+
'subject' => { 'email' => email }
|
|
12
|
+
}, idempotency_key: 'evaluate:' + claim_id)
|
|
13
|
+
return result if result['status'] == 'skipped'
|
|
14
|
+
return result if result['source'] == 'local_outage' || result['result'] != 'allow'
|
|
15
|
+
yield claim_id # Your transaction must finish successfully before returning.
|
|
16
|
+
client.outcome({ 'outcome' => 'granted' }, path: { 'id' => result['id'] },
|
|
17
|
+
idempotency_key: 'grant:' + claim_id)
|
|
18
|
+
result
|
|
19
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Ruby on Rails
|
|
2
|
+
|
|
3
|
+
A client sends one request at a time, so give each server thread its own `AbuseZero::Client`. Call it from the authenticated action that grants your benefit.
|
|
4
|
+
|
|
5
|
+
```ruby
|
|
6
|
+
client = Thread.current.thread_variable_get(:abusezero) ||
|
|
7
|
+
Thread.current.thread_variable_set(:abusezero, AbuseZero::Client.new(key: ENV.fetch('ABUSEZERO_SECRET_KEY'), outage: 'throw'))
|
|
8
|
+
incoming = AbuseZero.incoming_request(method: request.request_method,
|
|
9
|
+
url: request.original_url, headers: request.headers.to_h.filter_map { |key, value|
|
|
10
|
+
next unless key.start_with?('HTTP_') && value.is_a?(String)
|
|
11
|
+
[key.delete_prefix('HTTP_').tr('_', '-'), value]
|
|
12
|
+
}.to_h)
|
|
13
|
+
result = client.evaluate({
|
|
14
|
+
'benefit' => 'pro_trial', 'claim_id' => trial.id.to_s,
|
|
15
|
+
'subject' => { 'email' => current_user.email }, 'request' => incoming
|
|
16
|
+
}, idempotency_key: "evaluate:#{trial.id}")
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use your own stored claim ID. Follow the README's result branches before granting the benefit. For webhooks, pass `request.raw_post` and the headers, built the same way as above, to `AbuseZero.verify_webhook`. Parse and act on the returned event only after verification succeeds.
|