loops_sdk 2.0.0 → 2.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 +4 -4
- data/README.md +105 -5
- data/lib/loops_sdk/contacts.rb +16 -0
- data/lib/loops_sdk/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65b81eba842a1765bb2bc99006cbcaab839e442b3ee90ea92076cef8fba8f942
|
|
4
|
+
data.tar.gz: 3e544adfb4c2ed0b1069fc1a455773397a27a8254d9e8fe75ebbc33be2dfa9e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 565a16854a58cf5510b8c6c189394f7b62bea1aa6b1448e41dbb1759268d6f25fe9f366190a29896b974a49648e2068478db8e4622c9db3bbb2a29ef25aba855
|
|
7
|
+
data.tar.gz: cd2b0f20ad57991723c3ca2bb68efe71b3759a0669a602be1c71583368fb7f3ae79dabbbb068ba9392918081edf9e465fcd4ee1f50c721ea5cbbcd2cc866d010
|
data/README.md
CHANGED
|
@@ -95,6 +95,7 @@ Each contact in Loops has a set of default properties. These will always be retu
|
|
|
95
95
|
- `subscribed`
|
|
96
96
|
- `userGroup`
|
|
97
97
|
- `userId`
|
|
98
|
+
- `optInStatus`
|
|
98
99
|
|
|
99
100
|
## Custom contact properties
|
|
100
101
|
|
|
@@ -107,6 +108,8 @@ You can use custom contact properties in API calls. Please make sure to [add cus
|
|
|
107
108
|
- [Contacts.update()](#contactsupdate)
|
|
108
109
|
- [Contacts.find()](#contactsfind)
|
|
109
110
|
- [Contacts.delete()](#contactsdelete)
|
|
111
|
+
- [Contacts.check_suppression()](#contactscheck_suppression)
|
|
112
|
+
- [Contacts.remove_suppression()](#contactsremove_suppression)
|
|
110
113
|
- [ContactProperties.create()](#contactpropertiescreate)
|
|
111
114
|
- [ContactProperties.list()](#contactpropertieslist)
|
|
112
115
|
- [MailingLists.list()](#mailinglistslist)
|
|
@@ -209,7 +212,7 @@ This method will return a success or error message:
|
|
|
209
212
|
|
|
210
213
|
Update a contact. This method will create a contact if one doesn't already exist.
|
|
211
214
|
|
|
212
|
-
Note: To update a contact's email address, the contact requires a `
|
|
215
|
+
Note: To update a contact's email address, the contact requires a `user_id` value. Then you can make a request with their `user_id` and an updated email address.
|
|
213
216
|
|
|
214
217
|
[API Reference](https://loops.so/docs/api-reference/update-contact)
|
|
215
218
|
|
|
@@ -234,12 +237,10 @@ response = LoopsSdk::Contacts.update(
|
|
|
234
237
|
properties: contact_properties
|
|
235
238
|
)
|
|
236
239
|
|
|
237
|
-
# Updating a contact's email address using
|
|
240
|
+
# Updating a contact's email address using user_id
|
|
238
241
|
response = LoopsSdk::Contacts.update(
|
|
239
242
|
email: "newemail@gmail.com",
|
|
240
|
-
|
|
241
|
-
userId: "1234",
|
|
242
|
-
}
|
|
243
|
+
user_id: "1234"
|
|
243
244
|
)
|
|
244
245
|
|
|
245
246
|
# Subscribing a contact to a mailing list
|
|
@@ -314,6 +315,7 @@ If no contact is found, an empty list will be returned.
|
|
|
314
315
|
"mailingLists": {
|
|
315
316
|
"cm06f5v0e45nf0ml5754o9cix": true
|
|
316
317
|
},
|
|
318
|
+
"optInStatus": null,
|
|
317
319
|
"favoriteColor": "Blue" /* Custom property */
|
|
318
320
|
}
|
|
319
321
|
]
|
|
@@ -364,6 +366,104 @@ This method will return a success or error message:
|
|
|
364
366
|
|
|
365
367
|
---
|
|
366
368
|
|
|
369
|
+
### Contacts.check_suppression()
|
|
370
|
+
|
|
371
|
+
Check if a contact is suppressed.
|
|
372
|
+
|
|
373
|
+
[API Reference](https://loops.so/docs/api-reference/check-contact-suppression)
|
|
374
|
+
|
|
375
|
+
#### Parameters
|
|
376
|
+
|
|
377
|
+
You must use one parameter in the request.
|
|
378
|
+
|
|
379
|
+
| Name | Type | Required | Notes |
|
|
380
|
+
| --------- | ------ | -------- | ----- |
|
|
381
|
+
| `email` | string | No | |
|
|
382
|
+
| `user_id` | string | No | |
|
|
383
|
+
|
|
384
|
+
#### Example
|
|
385
|
+
|
|
386
|
+
```ruby
|
|
387
|
+
response = LoopsSdk::Contacts.check_suppression(email: "hello@gmail.com")
|
|
388
|
+
|
|
389
|
+
response = LoopsSdk::Contacts.check_suppression(user_id: "12345")
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
#### Response
|
|
393
|
+
|
|
394
|
+
This method will return the suppression status for a contact and the suppression removal quota.
|
|
395
|
+
|
|
396
|
+
```json
|
|
397
|
+
{
|
|
398
|
+
"contact": {
|
|
399
|
+
"id": "cll6b3i8901a9jx0oyktl2m4u",
|
|
400
|
+
"email": "hello@gmail.com",
|
|
401
|
+
"userId": "12345"
|
|
402
|
+
},
|
|
403
|
+
"isSuppressed": true,
|
|
404
|
+
"removalQuota": {
|
|
405
|
+
"limit": 100,
|
|
406
|
+
"remaining": 4
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
```json
|
|
412
|
+
{
|
|
413
|
+
"success": false,
|
|
414
|
+
"message": "An email or userId is required."
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
### Contacts.remove_suppression()
|
|
421
|
+
|
|
422
|
+
Remove suppression for a contact.
|
|
423
|
+
|
|
424
|
+
[API Reference](https://loops.so/docs/api-reference/remove-contact-suppression)
|
|
425
|
+
|
|
426
|
+
#### Parameters
|
|
427
|
+
|
|
428
|
+
You must use one parameter in the request.
|
|
429
|
+
|
|
430
|
+
| Name | Type | Required | Notes |
|
|
431
|
+
| --------- | ------ | -------- | ----- |
|
|
432
|
+
| `email` | string | No | |
|
|
433
|
+
| `user_id` | string | No | |
|
|
434
|
+
|
|
435
|
+
#### Example
|
|
436
|
+
|
|
437
|
+
```ruby
|
|
438
|
+
response = LoopsSdk::Contacts.remove_suppression(email: "hello@gmail.com")
|
|
439
|
+
|
|
440
|
+
response = LoopsSdk::Contacts.remove_suppression(user_id: "12345")
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
#### Response
|
|
444
|
+
|
|
445
|
+
This method will return a success or error message:
|
|
446
|
+
|
|
447
|
+
```json
|
|
448
|
+
{
|
|
449
|
+
"success": true,
|
|
450
|
+
"message": "Email removed from suppression list.",
|
|
451
|
+
"removalQuota": {
|
|
452
|
+
"limit": 100,
|
|
453
|
+
"remaining": 4
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
```json
|
|
459
|
+
{
|
|
460
|
+
"success": false,
|
|
461
|
+
"message": "This contact is not suppressed."
|
|
462
|
+
}
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
367
467
|
### ContactProperties.create()
|
|
368
468
|
|
|
369
469
|
Create a new contact property.
|
data/lib/loops_sdk/contacts.rb
CHANGED
|
@@ -37,6 +37,22 @@ module LoopsSdk
|
|
|
37
37
|
body = email ? { email: email } : { userId: user_id }
|
|
38
38
|
make_request(method: :post, path: "v1/contacts/delete", body: body)
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
def check_suppression(email: nil, user_id: nil)
|
|
42
|
+
raise ArgumentError, "Only one parameter is permitted." if email && user_id
|
|
43
|
+
raise ArgumentError, "You must provide an email or user_id value." if email.nil? && user_id.nil?
|
|
44
|
+
|
|
45
|
+
params = email ? { email: email } : { userId: user_id }
|
|
46
|
+
make_request(method: :get, path: "v1/contacts/suppression", params: params)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def remove_suppression(email: nil, user_id: nil)
|
|
50
|
+
raise ArgumentError, "Only one parameter is permitted." if email && user_id
|
|
51
|
+
raise ArgumentError, "You must provide an email or user_id value." if email.nil? && user_id.nil?
|
|
52
|
+
|
|
53
|
+
params = email ? { email: email } : { userId: user_id }
|
|
54
|
+
make_request(method: :delete, path: "v1/contacts/suppression", params: params)
|
|
55
|
+
end
|
|
40
56
|
end
|
|
41
57
|
end
|
|
42
58
|
end
|
data/lib/loops_sdk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: loops_sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Rowden
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
66
|
version: '0'
|
|
67
67
|
requirements: []
|
|
68
|
-
rubygems_version: 3.
|
|
68
|
+
rubygems_version: 3.4.10
|
|
69
69
|
signing_key:
|
|
70
70
|
specification_version: 4
|
|
71
71
|
summary: The official Ruby SDK for Loops.
|