loops_sdk 1.2.0 → 1.2.1
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 +24 -1
- data/lib/loops_sdk/base.rb +7 -11
- data/lib/loops_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef2e34971e3c98b0ceaf334bb80415ab912b3b3c384f9bc0f3daee486af3137
|
4
|
+
data.tar.gz: 43bd7500763bdc8eec606220a122cd5c2acb9ce24e3fa7070917fb13ffa0c541
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99dffd773f4da8f24ea7679433c8e1c239d96f2b8df98b8fbf7d93cd732b6ca241fe6e1380864a0c74439a31b756b4671d908d8dd2c2cffec43c88347938772f
|
7
|
+
data.tar.gz: '0128fc22eac586c9c3500283493b5519ab279cf5d46fcc46ea92e15c2d057eb106a75fdd9322413ae101d4b460fe0dd33ec6cc244ea8c9751b3cc76903b217c8'
|
data/README.md
CHANGED
@@ -539,6 +539,7 @@ Send an event to trigger an email in Loops. [Read more about events](https://loo
|
|
539
539
|
| `contact_properties` | object | No | An object containing contact properties, which will be updated or added to the contact when the event is received.<br />Please [add custom properties](https://loops.so/docs/contacts/properties#custom-contact-properties) in your Loops account before using them with the SDK.<br />Values can be of type `string`, `number`, `nil` (to reset a value), `boolean` or `date` ([see allowed date formats](https://loops.so/docs/contacts/properties#dates)). |
|
540
540
|
| `event_properties` | object | No | An object containing event properties, which will be made available in emails that are triggered by this event.<br />Values can be of type `string`, `number`, `boolean` or `date` ([see allowed date formats](https://loops.so/docs/events/properties#important-information-about-event-properties)). |
|
541
541
|
| `mailing_lists` | object | No | An object of mailing list IDs and boolean subscription statuses. |
|
542
|
+
| `headers` | object | No | Additional headers to send with the request. |
|
542
543
|
|
543
544
|
#### Examples
|
544
545
|
|
@@ -575,6 +576,15 @@ response = LoopsSdk::Events.send(
|
|
575
576
|
plan: "pro",
|
576
577
|
},
|
577
578
|
)
|
579
|
+
|
580
|
+
# Example with Idempotency-Key header
|
581
|
+
response = LoopsSdk::Events.send(
|
582
|
+
event_name: "signup",
|
583
|
+
email: "hello@gmail.com",
|
584
|
+
headers: {
|
585
|
+
"Idempotency-Key" => "550e8400-e29b-41d4-a716-446655440000"
|
586
|
+
},
|
587
|
+
)
|
578
588
|
```
|
579
589
|
|
580
590
|
#### Response
|
@@ -608,12 +618,13 @@ Send a transactional email to a contact. [Learn about sending transactional emai
|
|
608
618
|
| ---------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
609
619
|
| `transactional_id` | string | Yes | The ID of the transactional email to send. |
|
610
620
|
| `email` | string | Yes | The email address of the recipient. |
|
611
|
-
| `add_to_audience` | boolean | No | If `true`, a contact will be created in your audience using the `email` value (if a matching contact doesn
|
621
|
+
| `add_to_audience` | boolean | No | If `true`, a contact will be created in your audience using the `email` value (if a matching contact doesn't already exist). |
|
612
622
|
| `data_variables` | object | No | An object containing data as defined by the data variables added to the transactional email template.<br />Values can be of type `string` or `number`. |
|
613
623
|
| `attachments` | object[] | No | A list of attachments objects.<br />**Please note**: Attachments need to be enabled on your account before using them with the API. [Read more](https://loops.so/docs/transactional/attachments) |
|
614
624
|
| `attachments[].filename` | string | No | The name of the file, shown in email clients. |
|
615
625
|
| `attachments[].content_type` | string | No | The MIME type of the file. |
|
616
626
|
| `attachments[].data` | string | No | The base64-encoded content of the file. |
|
627
|
+
| `headers` | object | No | Additional headers to send with the request. |
|
617
628
|
|
618
629
|
#### Examples
|
619
630
|
|
@@ -626,6 +637,18 @@ response = LoopsSdk::Transactional.send(
|
|
626
637
|
},
|
627
638
|
)
|
628
639
|
|
640
|
+
# Example with Idempotency-Key header
|
641
|
+
response = LoopsSdk::Transactional.send(
|
642
|
+
transactional_id: "clfq6dinn000yl70fgwwyp82l",
|
643
|
+
email: "hello@gmail.com",
|
644
|
+
data_variables: {
|
645
|
+
loginUrl: "https://myapp.com/login/",
|
646
|
+
},
|
647
|
+
headers: {
|
648
|
+
"Idempotency-Key" => "550e8400-e29b-41d4-a716-446655440000"
|
649
|
+
},
|
650
|
+
)
|
651
|
+
|
629
652
|
# Please contact us to enable attachments on your account.
|
630
653
|
response = LoopsSdk::Transactional.send(
|
631
654
|
transactional_id: "clfq6dinn000yl70fgwwyp82l",
|
data/lib/loops_sdk/base.rb
CHANGED
@@ -21,19 +21,15 @@ module LoopsSdk
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def make_request(method:, path:, headers: {}, params: {}, body: nil)
|
24
|
-
# Merge default headers with request-specific headers
|
25
24
|
merged_headers = LoopsSdk.configuration.connection.headers.merge(headers)
|
26
|
-
|
27
|
-
response = LoopsSdk.configuration.connection.send(
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
body: body
|
33
|
-
) do |req|
|
34
|
-
req.body = body.to_json if body
|
35
|
-
req
|
25
|
+
|
26
|
+
response = LoopsSdk.configuration.connection.send(method) do |req|
|
27
|
+
req.url path
|
28
|
+
req.headers = merged_headers
|
29
|
+
req.params = params
|
30
|
+
req.body = body ? body.to_json : nil
|
36
31
|
end
|
32
|
+
|
37
33
|
handle_response(response)
|
38
34
|
end
|
39
35
|
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: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Rowden
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|