sendara 0.1.0 → 0.2.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 +4 -3
- data/lib/sendara/resources/messages.rb +16 -7
- data/lib/sendara/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: 36b63c37d1614f2443d015ee439a65a2504238aa6f53608909b4d38ef686dd3c
|
|
4
|
+
data.tar.gz: 31e7a59ebfd8b679dc2e27e518d1220d75e4dd60f68c1478244c663233493294
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6189e38a294454656bb302f5009e1383fec9919e451c26f4b90ccdb59087aa3e1fd35369b68dd1eb505327c632a3f029b7f2c29bbbd2c86114fbcfae3f94013
|
|
7
|
+
data.tar.gz: 99ea454fab47746eb0b36780a43c8b02ee9ffac82447b812b60681b092b8cd4bf4d72476d581535ee34dfaed0579b0082a280379b4259175d74b8cb94421a69b
|
data/README.md
CHANGED
|
@@ -158,10 +158,10 @@ client.broadcasts.bulk_send(
|
|
|
158
158
|
|
|
159
159
|
## Messages & pagination
|
|
160
160
|
|
|
161
|
-
Fetch a single page with `messages.page
|
|
161
|
+
Fetch a single page with `messages.page` (aliased as `messages.list`), which returns a `Sendara::MessagePage`:
|
|
162
162
|
|
|
163
163
|
```ruby
|
|
164
|
-
page = client.messages.
|
|
164
|
+
page = client.messages.list(status: "delivered", limit: 50)
|
|
165
165
|
|
|
166
166
|
page.messages.each { |message| puts message["id"] }
|
|
167
167
|
page.has_more? # => true / false
|
|
@@ -182,10 +182,11 @@ Called without a block it returns an `Enumerator`, so the full `Enumerable` API
|
|
|
182
182
|
recent = client.messages.each(channel: "email", limit: 100).first(10)
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
Filters: `channel`, `status`, `from`, `to`, `limit`, `cursor`. Fetch one message by id:
|
|
185
|
+
Filters: `channel`, `status`, `search`, `from`, `to`, `limit`, `cursor`. Fetch one message with its full event timeline, by id or by the idempotency key from the original send:
|
|
186
186
|
|
|
187
187
|
```ruby
|
|
188
188
|
client.messages.get("msg_123")
|
|
189
|
+
client.messages.get(idempotency_key: "order-42")
|
|
189
190
|
```
|
|
190
191
|
|
|
191
192
|
## Webhook verification
|
|
@@ -5,10 +5,11 @@ module Sendara
|
|
|
5
5
|
class Messages < Resource
|
|
6
6
|
include Enumerable
|
|
7
7
|
|
|
8
|
-
def page(channel: nil, status: nil, from: nil, to: nil, limit: nil, cursor: nil)
|
|
8
|
+
def page(channel: nil, status: nil, search: nil, from: nil, to: nil, limit: nil, cursor: nil)
|
|
9
9
|
query = compact_params(
|
|
10
10
|
"channel" => channel,
|
|
11
11
|
"status" => status,
|
|
12
|
+
"search" => search,
|
|
12
13
|
"from" => from,
|
|
13
14
|
"to" => to,
|
|
14
15
|
"limit" => limit,
|
|
@@ -18,15 +19,17 @@ module Sendara
|
|
|
18
19
|
MessagePage.from_response(response)
|
|
19
20
|
end
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
alias list page
|
|
23
|
+
|
|
24
|
+
def each(channel: nil, status: nil, search: nil, from: nil, to: nil, limit: nil, cursor: nil, &block)
|
|
22
25
|
unless block_given?
|
|
23
|
-
return enum_for(:each, channel: channel, status: status,
|
|
24
|
-
to: to, limit: limit, cursor: cursor)
|
|
26
|
+
return enum_for(:each, channel: channel, status: status, search: search,
|
|
27
|
+
from: from, to: to, limit: limit, cursor: cursor)
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
loop do
|
|
28
|
-
current = page(channel: channel, status: status,
|
|
29
|
-
to: to, limit: limit, cursor: cursor)
|
|
31
|
+
current = page(channel: channel, status: status, search: search,
|
|
32
|
+
from: from, to: to, limit: limit, cursor: cursor)
|
|
30
33
|
current.messages.each(&block)
|
|
31
34
|
break if current.next_cursor.nil?
|
|
32
35
|
|
|
@@ -34,7 +37,13 @@ module Sendara
|
|
|
34
37
|
end
|
|
35
38
|
end
|
|
36
39
|
|
|
37
|
-
def get(id)
|
|
40
|
+
def get(id = nil, idempotency_key: nil)
|
|
41
|
+
if idempotency_key
|
|
42
|
+
return request(:get, "/v1/messages", query: { "idempotency_key" => idempotency_key }) || {}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
raise ArgumentError, "get requires an id or idempotency_key" if id.nil?
|
|
46
|
+
|
|
38
47
|
request(:get, "/v1/messages/#{encode(id)}") || {}
|
|
39
48
|
end
|
|
40
49
|
end
|
data/lib/sendara/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sendara
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sendara
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|