trikle-mail 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/trikle-mail +2 -0
- data/lib/triklemailer.rb +7 -4
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fab487bbbcc70e117b9884b48d1b006b605b4c1403562563b3c6dc3cae68d96
|
4
|
+
data.tar.gz: f3540074f297409efce8c7e80a61a485d11f187683f51f3df5e8739b32760e1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e11e92874661ec21e1da315cf4558972a541a7a6ea2143041d941879ce4e867760bfc16b18ebcfd2aa6d18a99522e6e48c8dca6cff12175f0ba1deef2e3314c
|
7
|
+
data.tar.gz: 24eec0f470a08d21c079f01c0ea1df8032be712d4c380c0e49f04eac7e97775ab5222a109f5756dd1dc6b8990bce8209535be83afd176f3fda288c890249070d
|
data/bin/trikle-mail
CHANGED
@@ -30,6 +30,7 @@ class TrikleMail
|
|
30
30
|
c.option '--html', 'toggle using html to format email, defaults to no'
|
31
31
|
c.option '--hours INTEGER', Integer, 'The number of hours over which to send the emails'
|
32
32
|
c.option '--minutes INTEGER', Integer, 'The number of minutes over which to send the emails'
|
33
|
+
c.option '--oauth2-token', String, 'Authenticates your request with an Oauth 2.0 token instead of a password'
|
33
34
|
|
34
35
|
c.action do |args, options|
|
35
36
|
recipients = CSV.new(File.new(args[0]), headers: true, header_converters: :symbol).map(&:to_h)
|
@@ -52,6 +53,7 @@ class TrikleMail
|
|
52
53
|
host: options.host,
|
53
54
|
username: options.username,
|
54
55
|
password: options.password,
|
56
|
+
oauth2_token: options.oauth2_token,
|
55
57
|
domain: options.domain,
|
56
58
|
attachment: options.attachment
|
57
59
|
)
|
data/lib/triklemailer.rb
CHANGED
@@ -2,11 +2,11 @@ require 'mail'
|
|
2
2
|
require 'csv'
|
3
3
|
|
4
4
|
module Triklemailer
|
5
|
-
VERSION = '0.0
|
5
|
+
VERSION = '0.1.0'
|
6
6
|
Options = Struct.new(
|
7
7
|
:template, :template_name, :is_html, :from, :subject,
|
8
8
|
:host, :port, :username, :password, :bcc, :domain,
|
9
|
-
:attachment,
|
9
|
+
:attachment, :oauth2_token,
|
10
10
|
keyword_init: true
|
11
11
|
)
|
12
12
|
|
@@ -68,12 +68,15 @@ module Triklemailer
|
|
68
68
|
if block_given?
|
69
69
|
yield(mail, recipient)
|
70
70
|
else
|
71
|
+
oauth2_token = recipient.fetch(:oauth2_token, options.oauth2_token)
|
72
|
+
password = recrecipient.fetch(:password, options.password)
|
73
|
+
|
71
74
|
mail.delivery_method :smtp, {
|
72
75
|
address: recipient.fetch(:host, options.host),
|
73
76
|
port: recipient.fetch(:port, options.port),
|
74
77
|
user_name: recipient.fetch(:username, options.username),
|
75
|
-
password:
|
76
|
-
authentication: :login,
|
78
|
+
password: oauth2_token || password,
|
79
|
+
authentication: oauth2_token ? :xoauth2 : :login,
|
77
80
|
enable_starttls_auto: true
|
78
81
|
}
|
79
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trikle-mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jasper Lyons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mail_xoauth2
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
136
|
- !ruby/object:Gem::Version
|
123
137
|
version: '0'
|
124
138
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.2.32
|
126
140
|
signing_key:
|
127
141
|
specification_version: 4
|
128
142
|
summary: Send a trickle of mail
|