renote_dac 0.0.191 → 0.0.192

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ef4d538078759dc3bbc7b90b418cccb01916fc6a1484a6a9bd6a30ec1e4ebda
4
- data.tar.gz: 0bbb772a205ef51f3e911590e1ee91c6678e49bb4d3fbf567baef3803ddb7671
3
+ metadata.gz: 15bd310ea63e26a8caddd7522ee314a7239e0788b2876ecb85989e3d765f1109
4
+ data.tar.gz: 1e40bda8666edccc0bb4555d71140fcc1debca0058e72822ded6cf4958352a65
5
5
  SHA512:
6
- metadata.gz: 8e7877b7075546443e4db0e7a49404a1214bbbfc8b0ed64d32beb40c4767048a11be02a69da4127363335711edc14e3925225aac3e273fb0b46e1d5c9cee6dbf
7
- data.tar.gz: 90fb0447c33f02be75e37622a326e725d0f901614ea6efdd9eb4efc86c2a77e922c1de426c5943b9ceaf125237d3f16c23442287b388222a8d5f9e7f339b7e20
6
+ metadata.gz: dd0f3c2d8f17086629a86f47fe24ec4ed3803f3fedb4e873a05f39f0801eaa82cf34bfa8ee6d50a89b6f8ff7236ef0104ab42692225a00f487799d605b233ef6
7
+ data.tar.gz: 4585af69bfaa7d26e0ee57abbbf926545a1e755f5e271902bdf872a437df791822a71f6cbe167198fa660347980a0ea93f8eeca7afcefa00874845bb93ed336d
@@ -8,6 +8,7 @@ class CreateRenoteDacEmails < ActiveRecord::Migration[5.2]
8
8
  t.string :template
9
9
  t.string :address
10
10
  t.json :params
11
+ t.json :attachment_params
11
12
  t.string :error
12
13
  t.datetime :sent_at
13
14
 
@@ -4,19 +4,21 @@ module RenoteDac
4
4
 
5
5
  InvalidTemplate = Class.new(StandardError)
6
6
 
7
- BATCH_ID = 0
8
- BATCH_TEMPLATE = 1
9
- BATCH_EMAIL = 2
10
- BATCH_PARAMS = 3
7
+ BATCH_ID = 0
8
+ BATCH_TEMPLATE = 1
9
+ BATCH_EMAIL = 2
10
+ BATCH_PARAMS = 3
11
+ BATCH_ATTACHMENT_PARAMS = 4
11
12
 
12
- def self.enqueue(template, email_address, params = {})
13
+ def self.enqueue(template, email_address, params = {}, attachment_params = {})
13
14
  meta = Mailer.get_template_meta(template)
14
15
 
15
16
  RenoteDac::Email.create!(
16
17
  priority: meta[:priority],
17
18
  template: template,
18
19
  address: email_address,
19
- params: params
20
+ params: params,
21
+ attachment_params: attachment_params
20
22
  )
21
23
  end
22
24
 
@@ -27,7 +29,7 @@ module RenoteDac
27
29
  .where(error: nil)
28
30
  .order(priority: :asc, id: :asc)
29
31
  .limit(size)
30
- .pluck(:id, :template, :address, :params)
32
+ .pluck(:id, :template, :address, :params, :attachment_params)
31
33
  end
32
34
 
33
35
  def self.get_template_meta(template)
@@ -62,9 +64,10 @@ module RenoteDac
62
64
  messages = []
63
65
 
64
66
  batch.each do |pending|
65
- template = pending[BATCH_TEMPLATE]
66
- params = pending[BATCH_PARAMS]
67
- meta = Mailer.get_template_meta(template)
67
+ template = pending[BATCH_TEMPLATE]
68
+ params = pending[BATCH_PARAMS]
69
+ meta = Mailer.get_template_meta(template)
70
+ file_attachment_params = pending[BATCH_ATTACHMENT_PARAMS]
68
71
 
69
72
  ids << pending[BATCH_ID]
70
73
 
@@ -73,7 +76,8 @@ module RenoteDac
73
76
  to: pending[BATCH_EMAIL],
74
77
  template_id: meta[:template_id],
75
78
  template_model: params,
76
- tag: template
79
+ tag: template,
80
+ attachments: file_attachment_params
77
81
  }
78
82
  end
79
83
 
@@ -1,3 +1,3 @@
1
1
  module RenoteDac
2
- VERSION = '0.0.191'
2
+ VERSION = '0.0.192'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renote_dac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.191
4
+ version: 0.0.192
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sidney Leatherwood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-21 00:00:00.000000000 Z
11
+ date: 2018-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails