jzimmek-reportme 0.2.0 → 0.2.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -1,35 +1,27 @@
1
1
  module Reportme
2
2
  class Mailer < ActionMailer::Base
3
- def message (from, recipients, subject, body, attachments=[])
4
- from 'jan.zimmek@toptarif.de'
5
- recipients 'jan.zimmek@toptarif.de'
6
- subject subject
7
- body body
3
+ def message (_from, _recipients, _subject, _body, attachments=[])
4
+
5
+ subject(_subject)
6
+ from(_from)
7
+ recipients(_recipients)
8
+ body(_body)
8
9
 
9
- attachments.each do |att|
10
- content_type = att[:content_type]
10
+ unless attachments.blank?
11
+ attachments.each do |att|
12
+ content_type = att[:content_type]
11
13
 
12
- attachment content_type do |a|
13
- a.filename = att[:filename]
14
+ attachment content_type do |a|
15
+ a.filename = att[:filename]
14
16
 
15
- a.body = File.read(att[:filepath]) if att[:filepath]
16
- a.body = att[:text] if att[:text]
17
+ a.body = File.read(att[:filepath]) if att[:filepath]
18
+ a.body = att[:text] if att[:text]
17
19
 
18
- a.transfer_encoding = 'quoted-printable' if content_type =~ /^text\//
20
+ a.transfer_encoding = 'quoted-printable' if content_type =~ /^text\//
21
+ end
19
22
  end
20
23
  end
21
24
 
22
- # # Include all the pdf files in the PDF subdirectory as attachments.
23
- # FileList['PDF/*.pdf'].each do |path|
24
- # file = File.basename(path)
25
- # mime_type = MIME::Types.of(file).first
26
- # content_type = mime_type ? mime_type.content_type : 'application/binary'
27
- # attachment (content_type) do |a|
28
- # a.body = File.read(path)
29
- # a.filename = file
30
- # a.transfer_encoding = 'quoted-printable' if content_type =~ /^text\//
31
- # end
32
- # end
33
25
  end
34
26
  end
35
27
  end
@@ -23,7 +23,6 @@ module Reportme
23
23
  end
24
24
 
25
25
  def connect
26
- puts "connection: #{@properties}"
27
26
  ActiveRecord::Base.establish_connection(@properties)
28
27
  end
29
28
 
@@ -36,7 +35,7 @@ module Reportme
36
35
  end
37
36
 
38
37
  def mail(from, recipients, subject, body, attachments=[])
39
- Mailer.deliver_message(subject, body, subject, body, attachments)
38
+ Mailer.deliver_message(from, recipients, subject, body, attachments)
40
39
  end
41
40
 
42
41
  def init(&block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jzimmek-reportme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Zimmek