mailpy 0.1.5 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0ea15a7a97c63fbc9591369eb70a93bdac281045e2ed74a15cfdbf0f831348f
4
- data.tar.gz: 72701364bcf2a1d5ae7a3b8635bba4ce3210be0755ca9e8860de2e4a78e6e77b
3
+ metadata.gz: 21476287a915391df402c2d12dd74a6665e594c1b5eec0a5e19d75f59544fc1e
4
+ data.tar.gz: 49f4380a0e2d0ec8e7fb07063b7a969d46374ac332dfef8487066372a97e5e1b
5
5
  SHA512:
6
- metadata.gz: ddccfb1cbd44831e1573e49e6080505b0dbd9bc093a170355410fa8b5b88ca983a6fcaefec17862761f05b469eddf45418b9578ffa1675fdcca8d43b662ccac1
7
- data.tar.gz: 67dd42bc47dc4ff925ed8d03fc831b6166cb4d4061116a789fcd9489f5f56d05a5339431df6532cde15bed17c59ceb657fa4801f0776e5d239b0e0f5cfd522b0
6
+ metadata.gz: 3ca3d484f041f422d8c9d1b97102d3177e678ce5795014220237c9716f8b2fd099cab5d544928ec1cc57e43b93ca9171899a24a97894e6d1e45ab8f3c4055c09
7
+ data.tar.gz: f09f2eae711235ab0320344db3e535c690844261f611be0cc7c600c8b556849ad6e0490025b31aaf0264b6e2725b1826d083820ea28958b8928cb9cf18e3b997
data/README.md CHANGED
@@ -17,7 +17,9 @@ Add configuration to your application environments. development.rb, staging.rb,
17
17
  config.action_mailer.delivery_method = :mailpy
18
18
  config.action_mailer.mailpy_settings = {
19
19
  endpoint: ENV['MAILER_API_ENDPOINT'],
20
- token: ENV['MAILER_API_KEY_OR_AUTH_TOKEN']
20
+ headers: {
21
+ Authorization: ENV['MAILER_API_KEY_OR_AUTH_TOKEN']
22
+ }
21
23
  }
22
24
  ```
23
25
 
@@ -24,11 +24,22 @@ class MailerApi
24
24
  bcc: mail.bcc.try(:join, ', '),
25
25
  from: mail.from.try(:join, ', '),
26
26
  subject: mail.subject,
27
- body: mail.body.to_s
28
- }.to_json
27
+ body: body_data,
28
+ attachment: attachment_data
29
+ }
30
+ end
31
+
32
+ def body_data
33
+ mail.body.parts.present? ? mail.body.parts[0].body.to_s : mail.body.to_s
34
+ end
35
+
36
+ def attachment_data
37
+ attachments = {}
38
+ mail.attachments.each { |attachment| attachments[attachment.filename] = attachment.body }
39
+ attachments
29
40
  end
30
41
 
31
42
  def headers
32
- { 'Content-Type': 'application/json' }.merge!(options[:headers])
43
+ options[:headers]
33
44
  end
34
45
  end
@@ -1,3 +1,3 @@
1
1
  module Mailpy
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailpy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nasrul Gunawan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-31 00:00:00.000000000 Z
11
+ date: 2021-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty