trycourier 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +1 -1
- data/README.md +84 -0
- data/lib/trycourier/audit_events.rb +27 -0
- data/lib/trycourier/version.rb +1 -1
- data/lib/trycourier.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aa5b8cf9e2e4554e7238b5001707c706bb9e7c8cdceab309fce4ba805601e5a
|
4
|
+
data.tar.gz: 4396885d4f4f0da37c37896653850c74ba434eba8e01c44ba368bc4452892205
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec711df626dea24a00a5038f2da814f040499972cbf841e8d747ff841162ff4ed7207b081aae704aa4f7f1740f15bf6d6fc2867d2315d107577a70d7364fc9aa
|
7
|
+
data.tar.gz: 24c12be8b4042da8188d54059395fc849d95ddf1e1c4ac03d1a5f5199a5d6e3f87ee62376fd1b5d383704af592e7767934c58214a8d483f0fbbc739023333d9d
|
data/CHANGELOG.md
CHANGED
@@ -5,7 +5,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased][unreleased]
|
7
7
|
|
8
|
+
## [v1.6.0] - 2022-07-25
|
9
|
+
|
10
|
+
- Support for audit events API
|
11
|
+
|
8
12
|
## [v1.5.0] - 2022-03-28
|
13
|
+
|
9
14
|
- Support for audiences API
|
10
15
|
|
11
16
|
## [v1.4.0] - 2022-01-31
|
@@ -94,7 +99,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
94
99
|
|
95
100
|
Initial release by @troygoode
|
96
101
|
|
97
|
-
[unreleased]: https://github.com/trycourier/courier-ruby/compare/v1.
|
102
|
+
[unreleased]: https://github.com/trycourier/courier-ruby/compare/v1.6.0...HEAD
|
103
|
+
[v1.6.0]: https://github.com/trycourier/courier-ruby/compare/v1.5.0...v1.6.0
|
98
104
|
[v1.5.0]: https://github.com/trycourier/courier-ruby/compare/v1.4.0...v1.5.0
|
99
105
|
[v1.4.0]: https://github.com/trycourier/courier-ruby/compare/v1.3.0...v1.4.0
|
100
106
|
[v1.3.0]: https://github.com/trycourier/courier-ruby/compare/v1.2.0...v1.3.0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -107,6 +107,7 @@ res = client.send_message({
|
|
107
107
|
"utm" => {
|
108
108
|
"source" => "Ruby"
|
109
109
|
},
|
110
|
+
"tags" => ["tag-1", "tag-2"],
|
110
111
|
"trace_id" => "feed-me-hungry"
|
111
112
|
}
|
112
113
|
}
|
@@ -118,6 +119,75 @@ rescue Courier::CourierAPIError => re #error sent from from the API
|
|
118
119
|
end
|
119
120
|
```
|
120
121
|
|
122
|
+
### Sending a message to an individual with granular metadata
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
client = Courier::Client.new "your-auth-token" # or set via COURIER_AUTH_TOKEN env var
|
126
|
+
res = client.send_message({
|
127
|
+
"message" => {
|
128
|
+
"to" => {
|
129
|
+
"email" => "foo@bar.com"
|
130
|
+
},
|
131
|
+
"content" => {
|
132
|
+
"version" => "2020-01-01",
|
133
|
+
"elements" => [
|
134
|
+
{
|
135
|
+
"type" => "text",
|
136
|
+
"content" => "Thanks for signing up, {{name}}"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"type" => "action",
|
140
|
+
"content" => "Click Me!",
|
141
|
+
"href" => "https://www.example.com"
|
142
|
+
}
|
143
|
+
]
|
144
|
+
},
|
145
|
+
"routing" => {
|
146
|
+
"method" => "all",
|
147
|
+
"channels" => [
|
148
|
+
"email"
|
149
|
+
]
|
150
|
+
},
|
151
|
+
"data" => {
|
152
|
+
"name" => "Ruby"
|
153
|
+
},
|
154
|
+
"metadata" => {
|
155
|
+
"utm" => {
|
156
|
+
"source" => "Ruby"
|
157
|
+
},
|
158
|
+
},
|
159
|
+
"channels" => {
|
160
|
+
"email" => {
|
161
|
+
"routing_method" => "all",
|
162
|
+
"providers" => [
|
163
|
+
"sendgrid",
|
164
|
+
"mailjet"
|
165
|
+
],
|
166
|
+
"metadata" => {
|
167
|
+
"utm" => {
|
168
|
+
"medium" => "email"
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
},
|
173
|
+
"providers" => {
|
174
|
+
"sendgrid" => {
|
175
|
+
"metadata" => {
|
176
|
+
"utm" => {
|
177
|
+
"source" => "sendgrid"
|
178
|
+
}
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}
|
183
|
+
})
|
184
|
+
puts res.code # the HTTP response code
|
185
|
+
puts res.request_id # if the code is 202, this will be the Courier request ID for this message
|
186
|
+
rescue Courier::CourierAPIError => re #error sent from from the API
|
187
|
+
puts re.message
|
188
|
+
end
|
189
|
+
```
|
190
|
+
|
121
191
|
## Advanced Usage
|
122
192
|
|
123
193
|
### Lists
|
@@ -507,6 +577,20 @@ rescue Courier::CourierAPIError => re #error sent from from the API
|
|
507
577
|
end
|
508
578
|
```
|
509
579
|
|
580
|
+
### Audit Events
|
581
|
+
|
582
|
+
```Ruby
|
583
|
+
"""
|
584
|
+
Example: List audit events
|
585
|
+
"""
|
586
|
+
resp = client.audit_events.list()
|
587
|
+
|
588
|
+
"""
|
589
|
+
Example: Get a specific audit event
|
590
|
+
"""
|
591
|
+
resp = client.audit_events.get(audit_event_id: "audit-event-id")
|
592
|
+
```
|
593
|
+
|
510
594
|
## Development
|
511
595
|
|
512
596
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Courier
|
2
|
+
class AuditEvents
|
3
|
+
KEY = "/audit-events"
|
4
|
+
|
5
|
+
def initialize(session)
|
6
|
+
@session = session
|
7
|
+
end
|
8
|
+
|
9
|
+
def get(audit_event_id:)
|
10
|
+
path = "#{KEY}/#{audit_event_id}"
|
11
|
+
res = @session.send(path, "GET")
|
12
|
+
ErrorHandler.check_err(res)
|
13
|
+
end
|
14
|
+
|
15
|
+
def list(cursor: nil)
|
16
|
+
path = "#{KEY}"
|
17
|
+
|
18
|
+
params = {}
|
19
|
+
if cursor
|
20
|
+
params["cursor"] = cursor
|
21
|
+
end
|
22
|
+
|
23
|
+
res = @session.send(path, "GET", params: params)
|
24
|
+
ErrorHandler.check_err(res)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/trycourier/version.rb
CHANGED
data/lib/trycourier.rb
CHANGED
@@ -7,6 +7,7 @@ require "trycourier/messages"
|
|
7
7
|
require "trycourier/automations"
|
8
8
|
require "trycourier/bulk"
|
9
9
|
require "trycourier/audiences"
|
10
|
+
require "trycourier/audit_events"
|
10
11
|
require "trycourier/version"
|
11
12
|
require "trycourier/exceptions"
|
12
13
|
|
@@ -65,6 +66,7 @@ module Courier
|
|
65
66
|
@automations = Courier::Automations.new(@session)
|
66
67
|
@bulk = Courier::Bulk.new(@session)
|
67
68
|
@audiences = Courier::Audiences.new(@session)
|
69
|
+
@audit_events = Courier::AuditEvents.new(@session)
|
68
70
|
end
|
69
71
|
|
70
72
|
def send(body)
|
@@ -135,6 +137,7 @@ module Courier
|
|
135
137
|
|
136
138
|
attr_reader :audiences
|
137
139
|
|
140
|
+
attr_reader :audit_events
|
138
141
|
|
139
142
|
end
|
140
143
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trycourier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Courier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- bin/setup
|
63
63
|
- lib/trycourier.rb
|
64
64
|
- lib/trycourier/audiences.rb
|
65
|
+
- lib/trycourier/audit_events.rb
|
65
66
|
- lib/trycourier/automations.rb
|
66
67
|
- lib/trycourier/brands.rb
|
67
68
|
- lib/trycourier/bulk.rb
|