novu 1.2.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/Gemfile +3 -3
- data/README.md +11 -0
- data/lib/novu/api/events.rb +1 -1
- data/lib/novu/client.rb +9 -3
- data/lib/novu/version.rb +1 -1
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13285194bf6fb777c63ae981276763f4b10ea615966b965a81a6e8b58da3b556
|
4
|
+
data.tar.gz: 1cc512d33593d53bbd9156977c6db150e19d9e3337d17ede52d3b9f6b81e2cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dbddce6ca7f95be24963a26df40dc493ed4cc9d3b423b15a1b463c10b94defd001ee2a03f9fbaf304532b77ee37cec4eb3df2df45dc6bba570f735a82c7ed10
|
7
|
+
data.tar.gz: c4ce2d57cec6cef6fc64f70c9eb0ce98b609f16710cf0f041286d88e2ccf796217fb06e7615c8c641a6e074b473b6a0079e09f33d098ee77d5968a4f2dff2ee4
|
data/Gemfile
CHANGED
@@ -8,13 +8,13 @@ gemspec
|
|
8
8
|
gem "rake", "~> 13.0"
|
9
9
|
|
10
10
|
group :test do
|
11
|
-
gem
|
11
|
+
gem "rspec"
|
12
12
|
gem "webmock"
|
13
13
|
end
|
14
14
|
|
15
15
|
gem "exponential-backoff"
|
16
|
-
gem
|
16
|
+
gem "mocha"
|
17
17
|
gem "rubocop", "~> 1.21"
|
18
|
-
gem
|
18
|
+
gem "uuid", "~> 2.3", ">= 2.3.9"
|
19
19
|
|
20
20
|
# gem 'pry-debugger-jruby'
|
data/README.md
CHANGED
@@ -934,6 +934,17 @@ client = Novu::Client.new(
|
|
934
934
|
| enable_retry | enabling/disable the Exponential Retry mechanism | false | Boolean |
|
935
935
|
|
936
936
|
|
937
|
+
### Custom backend URL
|
938
|
+
|
939
|
+
To use a custom backend URL, for example to be able to use the EU Novu API, you can pass a custom `backend_url` when initializing the client.
|
940
|
+
|
941
|
+
```ruby
|
942
|
+
client = Novu::Client.new(
|
943
|
+
access_token: '<your-novu-api_key>',
|
944
|
+
backend_url: 'https://eu.api.novu.co/v1'
|
945
|
+
)
|
946
|
+
```
|
947
|
+
|
937
948
|
### For more information about these methods and their parameters, see the [API documentation](https://docs.novu.co/api-reference).
|
938
949
|
|
939
950
|
## Contributing
|
data/lib/novu/api/events.rb
CHANGED
@@ -50,7 +50,7 @@ module Novu
|
|
50
50
|
# - transactionId [String(optional)] - Transaction id for trigger
|
51
51
|
# @return [number] status - The status code. Returns 201 if the event has been successfully triggered.
|
52
52
|
def trigger_bulk_event(body)
|
53
|
-
post("/events/trigger/bulk", body: body)
|
53
|
+
post("/events/trigger/bulk", body: body.to_json, headers: {'Content-Type': 'application/json'})
|
54
54
|
end
|
55
55
|
|
56
56
|
# Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc.
|
data/lib/novu/client.rb
CHANGED
@@ -18,6 +18,7 @@ require "novu/api/organizations"
|
|
18
18
|
require "novu/api/subscribers"
|
19
19
|
require "novu/api/tenants"
|
20
20
|
require "novu/api/topics"
|
21
|
+
require_relative "version"
|
21
22
|
|
22
23
|
module Novu
|
23
24
|
class Client
|
@@ -41,7 +42,6 @@ module Novu
|
|
41
42
|
include Novu::Api::Tenants
|
42
43
|
include Novu::Api::Topics
|
43
44
|
|
44
|
-
base_uri "https://api.novu.co/v1"
|
45
45
|
format :json
|
46
46
|
|
47
47
|
attr_accessor :enable_retry, :max_retries, :initial_delay, :max_delay, :idempotency_key
|
@@ -53,7 +53,7 @@ module Novu
|
|
53
53
|
# - max_retries [Integer]
|
54
54
|
# - initial_delay [Integer]
|
55
55
|
# - max_delay [Integer]
|
56
|
-
def initialize(access_token: nil, idempotency_key: nil, enable_retry: false, retry_config: {} )
|
56
|
+
def initialize(access_token: nil, idempotency_key: nil, enable_retry: false, retry_config: {}, backend_url: "https://api.novu.co/v1")
|
57
57
|
raise ArgumentError, "Api Key cannot be blank or nil" if access_token.blank?
|
58
58
|
|
59
59
|
@idempotency_key = idempotency_key.blank? ? UUID.new.generate : idempotency_key
|
@@ -67,7 +67,13 @@ module Novu
|
|
67
67
|
@initial_delay = retry_config[:initial_delay]
|
68
68
|
@max_delay = retry_config[:max_delay]
|
69
69
|
|
70
|
-
self.class.
|
70
|
+
self.class.base_uri(backend_url)
|
71
|
+
|
72
|
+
self.class.default_options.merge!(headers: {
|
73
|
+
"Authorization" => "ApiKey #{@access_token}",
|
74
|
+
"User-Agent" => "novu/ruby/#{Novu::VERSION}"
|
75
|
+
}
|
76
|
+
)
|
71
77
|
|
72
78
|
# Configure the exponential backoff - specifying initial and maximal delays, default is 4s and 60s respectively
|
73
79
|
if @enable_retry
|
data/lib/novu/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: novu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Saini
|
@@ -10,28 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-03-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '6.1'
|
21
18
|
- - ">="
|
22
19
|
- !ruby/object:Gem::Version
|
23
|
-
version: 6.1
|
20
|
+
version: '6.1'
|
24
21
|
name: activesupport
|
25
22
|
type: :runtime
|
26
23
|
prerelease: false
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
requirements:
|
29
|
-
- - "~>"
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: '6.1'
|
32
26
|
- - ">="
|
33
27
|
- !ruby/object:Gem::Version
|
34
|
-
version: 6.1
|
28
|
+
version: '6.1'
|
35
29
|
- !ruby/object:Gem::Dependency
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
37
31
|
requirements:
|