nuntius 1.4.5 → 1.4.6
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 +42 -0
- data/app/jobs/nuntius/application_job.rb +1 -0
- data/app/models/nuntius/message.rb +1 -1
- data/app/tables/nuntius/messages_table.rb +8 -0
- data/lib/nuntius/version.rb +1 -1
- metadata +2 -17
- data/app/providers/nuntius/houston_push_provider.rb +0 -40
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f029622578d7ecf61fc16ad2c6de88f213c7407660728ac4e94de0ecf08bbee4
|
|
4
|
+
data.tar.gz: 30b3bb181d3b197b4cf4bac2ffd35c9ded3a09407dda114d99807bc6f3ecb78a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea15a418498280e75e81e30d0cb0341049ac564d1f405c5bc480270f8d5d886af57bcba93fd68ed3a90814b0fe0f24d792b207c2e95be2d27c52b27842e10076
|
|
7
|
+
data.tar.gz: a74e34d4437828ed70bb320ff41b4e3912b210a249545440b7409ec57d34c4474d513a62c5b16363230a200d1b4083e67ccf23ec07cd27e9853425732c2c60e5
|
data/README.md
CHANGED
|
@@ -152,6 +152,48 @@ Beter even is using Sidekiq::Cron or GoodJob
|
|
|
152
152
|
Nuntius will automatically prevent sending duplicates within the timerange you define.
|
|
153
153
|
It will also ONLY send messages for objects (the one in template class), created after you created this template, this prevents sending dozens of emails which may make no sense, when you add a new template.
|
|
154
154
|
|
|
155
|
+
### Locales
|
|
156
|
+
|
|
157
|
+
Nuntius supports locale support in it's mails. You can add locales for your emails per language:
|
|
158
|
+
|
|
159
|
+
Add a locale with key `en`:
|
|
160
|
+
```yaml
|
|
161
|
+
en:
|
|
162
|
+
salutation: "Hello %{name}"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Then in your template you can do:
|
|
166
|
+
```liquid
|
|
167
|
+
{{'salutation' | t name: {{car.owner}} }}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Metadata
|
|
171
|
+
|
|
172
|
+
You can use metadata in your template to guide some text and information in your layout.
|
|
173
|
+
|
|
174
|
+
Say you need to change the header of an email, based on the template. In your layout you can then do this:
|
|
175
|
+
|
|
176
|
+
```html
|
|
177
|
+
<h2>{{template.metadata.header}}</h2>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
And in you template metadata:
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
header: You lost your password?
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Say your layout has a logo image, which needs to change based on the brand of the car.
|
|
187
|
+
In your layout html you can do the following, to grab
|
|
188
|
+
|
|
189
|
+
```html
|
|
190
|
+
<img src="{%render template.metadata.logo_url%}" alt="logo"/>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
in your template metadata:
|
|
194
|
+
```yaml
|
|
195
|
+
logo_path: "{{car.brand.logo_path}}"
|
|
196
|
+
```
|
|
155
197
|
### Direct
|
|
156
198
|
|
|
157
199
|
Another more direct way of using Nuntius is by just instantiating a message:
|
|
@@ -69,7 +69,7 @@ module Nuntius
|
|
|
69
69
|
# FIXME: This is a possible security problem
|
|
70
70
|
attachment[:io] = File.open(uri.path)
|
|
71
71
|
elsif uri
|
|
72
|
-
client = Faraday.new
|
|
72
|
+
client = Faraday.new do |builder|
|
|
73
73
|
builder.response :follow_redirects
|
|
74
74
|
builder.adapter Faraday.default_adapter
|
|
75
75
|
end
|
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
module Nuntius
|
|
4
4
|
class MessagesTable < Nuntius::ApplicationTable
|
|
5
|
+
|
|
5
6
|
definition do
|
|
6
7
|
model Nuntius::Message
|
|
7
8
|
|
|
8
9
|
column(:to)
|
|
9
10
|
column(:created_at)
|
|
10
11
|
column(:last_sent_at)
|
|
12
|
+
action :resend do
|
|
13
|
+
link { |message| nuntius.resend_admin_message_path(message) }
|
|
14
|
+
icon "fal fa-rotate-right"
|
|
15
|
+
link_attributes data: {"turbo-confirm": "Are you sure you want to resend the message?", "turbo-method": :post}
|
|
16
|
+
show ->(message) { true }
|
|
17
|
+
end
|
|
18
|
+
|
|
11
19
|
column(:campaign_id) do
|
|
12
20
|
render do
|
|
13
21
|
html do |message|
|
data/lib/nuntius/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nuntius
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom de Grunt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: apnotic
|
|
@@ -66,20 +66,6 @@ dependencies:
|
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '1.0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: houston
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - "~>"
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '2.4'
|
|
76
|
-
type: :runtime
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - "~>"
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '2.4'
|
|
83
69
|
- !ruby/object:Gem::Dependency
|
|
84
70
|
name: faraday
|
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -497,7 +483,6 @@ files:
|
|
|
497
483
|
- app/providers/nuntius/apnotic_push_provider.rb
|
|
498
484
|
- app/providers/nuntius/base_provider.rb
|
|
499
485
|
- app/providers/nuntius/firebase_push_provider.rb
|
|
500
|
-
- app/providers/nuntius/houston_push_provider.rb
|
|
501
486
|
- app/providers/nuntius/message_bird_sms_provider.rb
|
|
502
487
|
- app/providers/nuntius/slack_slack_provider.rb
|
|
503
488
|
- app/providers/nuntius/smstools_sms_provider.rb
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "houston"
|
|
4
|
-
|
|
5
|
-
module Nuntius
|
|
6
|
-
class HoustonPushProvider < BaseProvider
|
|
7
|
-
transport :push
|
|
8
|
-
|
|
9
|
-
setting_reader :certificate,
|
|
10
|
-
required: true,
|
|
11
|
-
description: "The contents of a valid APNS push certificate in .pem format"
|
|
12
|
-
setting_reader :passphrase,
|
|
13
|
-
required: false,
|
|
14
|
-
description: "If the APNS certificate is protected by a passphrase, " \
|
|
15
|
-
"provide this variable to use when decrypting it."
|
|
16
|
-
setting_reader :environment,
|
|
17
|
-
required: false,
|
|
18
|
-
default: :production,
|
|
19
|
-
description: "Development or production, defaults to production"
|
|
20
|
-
|
|
21
|
-
def deliver
|
|
22
|
-
return message if message.to.size != 64
|
|
23
|
-
|
|
24
|
-
apn = (environment.to_sym == :development) ? Houston::Client.development : Houston::Client.production
|
|
25
|
-
apn.certificate = certificate
|
|
26
|
-
apn.passphrase = passphrase
|
|
27
|
-
|
|
28
|
-
notification = Houston::Notification.new((message.payload || {}).merge(device: message.to,
|
|
29
|
-
alert: message.text, sound: "default"))
|
|
30
|
-
apn.push(notification)
|
|
31
|
-
|
|
32
|
-
message.status = if notification.sent?
|
|
33
|
-
"sent"
|
|
34
|
-
elsif !notification.valid? || notification.error
|
|
35
|
-
"undelivered"
|
|
36
|
-
end
|
|
37
|
-
message
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|