trycourier 1.9.0 → 2.0.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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/trycourier/auth_tokens.rb +23 -0
- data/lib/trycourier/{accounts.rb → tenants.rb} +10 -10
- data/lib/trycourier/version.rb +1 -1
- data/lib/trycourier.rb +7 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed06b560fed0c9881240f285a4d5cbcb173a0f4e39bf1c7f02d6a21f0a49e063
|
4
|
+
data.tar.gz: 4a1ff4327690053cbe006031adddcab34c35dd2fe793c377199cd2f28e779ba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 017c2f33d4f3157e9caaa5f05005ee69f7a5f4c5f6742e79c366a2075a343233dcb5483b2882748585a1738ca60c22bd79b6ff2f064e9280981e5e5bb2cbaaa9
|
7
|
+
data.tar.gz: ac4c4ffa940d694f87806ba01d59d1c5dfa4097e6e17a02250469735609fb0eda54558bc864d19d22d793b1331e7d7a1314a301d6717ff564f5e0a65a4323d9c
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Courier
|
2
|
+
class AuthTokens
|
3
|
+
KEY = "/auth"
|
4
|
+
|
5
|
+
def initialize(session)
|
6
|
+
@session = session
|
7
|
+
end
|
8
|
+
|
9
|
+
def issue_token(scope:, expires_in: nil, data: nil, profile: nil, recipient: nil, template: nil)
|
10
|
+
path = "#{KEY}/issue-token"
|
11
|
+
payload = {
|
12
|
+
"scope": scope
|
13
|
+
}
|
14
|
+
|
15
|
+
if expires_in
|
16
|
+
payload["expires_in"] = expires_in
|
17
|
+
end
|
18
|
+
|
19
|
+
res = @session.send(path, "POST", body: payload, headers: {})
|
20
|
+
ErrorHandler.check_err(res)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module Courier
|
2
|
-
class
|
3
|
-
KEY = "/
|
2
|
+
class Tenants
|
3
|
+
KEY = "/tenants"
|
4
4
|
|
5
5
|
def initialize(session)
|
6
6
|
@session = session
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
path = "#{KEY}/#{
|
9
|
+
def get_tenant(tenant_id:)
|
10
|
+
path = "#{KEY}/#{tenant_id}"
|
11
11
|
res = @session.send(path, "GET")
|
12
12
|
ErrorHandler.check_err(res)
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def get_tenants(limit: nil, cursor: nil)
|
16
16
|
params = {}
|
17
17
|
if limit
|
18
18
|
params["limit"] = limit
|
@@ -26,15 +26,15 @@ module Courier
|
|
26
26
|
ErrorHandler.check_err(res)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
path = "#{KEY}/#{
|
29
|
+
def put_tenant(tenant_id:, tenant:)
|
30
|
+
path = "#{KEY}/#{tenant_id}"
|
31
31
|
|
32
|
-
res = @session.send(path, "PUT", body:
|
32
|
+
res = @session.send(path, "PUT", body: tenant, headers: {})
|
33
33
|
ErrorHandler.check_err(res)
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
path = "#{KEY}/#{
|
36
|
+
def delete_tenant(tenant_id:)
|
37
|
+
path = "#{KEY}/#{tenant_id}"
|
38
38
|
res = @session.send(path, "DELETE")
|
39
39
|
ErrorHandler.check_err_non_json(res)
|
40
40
|
end
|
data/lib/trycourier/version.rb
CHANGED
data/lib/trycourier.rb
CHANGED
@@ -8,7 +8,8 @@ require "trycourier/automations"
|
|
8
8
|
require "trycourier/bulk"
|
9
9
|
require "trycourier/audiences"
|
10
10
|
require "trycourier/audit_events"
|
11
|
-
require "trycourier/
|
11
|
+
require "trycourier/tenants"
|
12
|
+
require "trycourier/auth_tokens"
|
12
13
|
require "trycourier/version"
|
13
14
|
require "trycourier/exceptions"
|
14
15
|
|
@@ -68,7 +69,8 @@ module Courier
|
|
68
69
|
@bulk = Courier::Bulk.new(@session)
|
69
70
|
@audiences = Courier::Audiences.new(@session)
|
70
71
|
@audit_events = Courier::AuditEvents.new(@session)
|
71
|
-
@
|
72
|
+
@tenants = Courier::Tenants.new(@session)
|
73
|
+
@auth_tokens = Courier::AuthTokens.new(@session)
|
72
74
|
end
|
73
75
|
|
74
76
|
def send(body)
|
@@ -141,7 +143,9 @@ module Courier
|
|
141
143
|
|
142
144
|
attr_reader :audit_events
|
143
145
|
|
144
|
-
attr_reader :
|
146
|
+
attr_reader :tenants
|
147
|
+
|
148
|
+
attr_reader :auth_tokens
|
145
149
|
|
146
150
|
end
|
147
151
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Courier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -61,9 +61,9 @@ files:
|
|
61
61
|
- bin/console
|
62
62
|
- bin/setup
|
63
63
|
- lib/trycourier.rb
|
64
|
-
- lib/trycourier/accounts.rb
|
65
64
|
- lib/trycourier/audiences.rb
|
66
65
|
- lib/trycourier/audit_events.rb
|
66
|
+
- lib/trycourier/auth_tokens.rb
|
67
67
|
- lib/trycourier/automations.rb
|
68
68
|
- lib/trycourier/brands.rb
|
69
69
|
- lib/trycourier/bulk.rb
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/trycourier/messages.rb
|
74
74
|
- lib/trycourier/profiles.rb
|
75
75
|
- lib/trycourier/session.rb
|
76
|
+
- lib/trycourier/tenants.rb
|
76
77
|
- lib/trycourier/version.rb
|
77
78
|
- trycourier.gemspec
|
78
79
|
homepage: https://github.com/trycourier/courier-ruby
|