mailboxer_multi_attach 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 5a0763dd1759a15f9f9b73b9e69e32aed1f51e74
4
- data.tar.gz: 6c99650728ab7ba73e276c2b6228ba54c34d460b
3
+ metadata.gz: e7b85f69a2f2c2af4400c40b50f1b236940e8999
4
+ data.tar.gz: 931aaf518572598b1da048757ebd5182d8670e2d
5
5
  SHA512:
6
- metadata.gz: c1a1a74f2f6947867bafbf7824747d7e8d8fb75a57d8e38be3d1c6022cf0724f71dfbf61bbf1b791014fc737266ed6e7f661b9fa7f0ce09820eef2420a2dd7dd
7
- data.tar.gz: ed0c5d508caf903fb23447789546e39dc0b036d937d267c266b5f19eb5fae1cb3f2a8b3eb74c70de863cb86875d3f6c9614474d103f73e73a8feba1a022fe9cb
6
+ metadata.gz: fd53d46ae68cc450cb8a0103a67a38d71d1544951dae621a210d14b0ece5766144f46783e2651e2210af89e252fca5d7c7a2144cb7bdca3a54ec241e494b8be2
7
+ data.tar.gz: b5594dc111b9bf95e143072f567352b51b253be5375f564fcf221df63d9e4f704e75d8b98bc919851488dbe85b8163449e866f204c0a29adb92005007b288947
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mailboxer_multi_attach (0.0.3)
4
+ mailboxer_multi_attach (0.0.4)
5
5
  carrierwave (= 0.10.0)
6
6
  mailboxer (= 0.13.0)
7
7
  rails (~> 3.2.22)
data/README.md CHANGED
@@ -12,11 +12,12 @@ Add to your gemfile and run the following
12
12
 
13
13
  ## Usage
14
14
 
15
- On any `messageable` object you utilize `send_message_mult_attach` or `reply_to_sender_mult_attach` to send messages. Once the message is sent you can access the attachments by calling `message_attachments` on the messageable model's message. The following works where the entity has the `messageable` reference on its model. Make sure to use the key `:file` when submitting the attachment!
15
+ On any `messageable` object you utilize `send_message_mult_attach`, `reply_to_sender_mult_attach`, or `reply_to_convo_mult_attach` to send messages. Once the message is sent you can access the attachments by calling `message_attachments` on the messageable model's message. The following works where the entity has the `messageable` reference on its model. Make sure to use the key `:file` when submitting the attachment!
16
16
 
17
17
  attachments = [{ :file => File.open('spec/testfile.txt') }, { :file => File.open('spec/1.mp4') }]
18
18
  receipt = entity1.send_message_mult_attach(entity2, "Body", "Subject", true, attachments)
19
19
  entity2.reply_to_sender_mult_attach(receipt, "Body", "Subject", true, attachments)
20
+ entity2.reply_to_convo_mult_attach(receipt.conversation, "Body", "Subject", true, attachments)
20
21
 
21
22
  You can also not pass in attachments like the following.
22
23
 
@@ -20,9 +20,8 @@ module Mailboxer
20
20
  message.deliver false, sanitize_text
21
21
  end
22
22
 
23
- def reply(conversation, recipients, reply_body,
24
- subject=nil, sanitize_text=true,
25
- attachment=nil)
23
+ def reply(conversation, recipients,
24
+ reply_body, subject=nil, sanitize_text=true)
26
25
  subject = subject || "#{conversation.subject}"
27
26
  build_message(conversation, recipients,
28
27
  reply_body, subject,
@@ -37,6 +36,21 @@ module Mailboxer
37
36
  message.deliver false, sanitize_text
38
37
  end
39
38
 
39
+ def reply_to_convo_mult_attach(conversation, reply_body,
40
+ subject=nil, should_untrash=true,
41
+ sanitize_text=true, attachments=nil)
42
+ #move conversation to inbox if it is currently in the trash and should_untrash parameter is true.
43
+ if should_untrash && mailbox.is_trashed?(conversation)
44
+ mailbox.receipts_for(conversation).untrash
45
+ mailbox.receipts_for(conversation).mark_as_not_deleted
46
+ end
47
+
48
+ message = reply(conversation, conversation.last_message.recipients,
49
+ reply_body, subject, sanitize_text)
50
+ attach_files(attachments, message)
51
+ message.deliver false, sanitize_text
52
+ end
53
+
40
54
  def build_convo(subject, message_timestamp)
41
55
  ::Mailboxer::ConversationBuilder.new(
42
56
  subject: subject,
@@ -45,7 +59,8 @@ module Mailboxer
45
59
  ).build
46
60
  end
47
61
 
48
- def build_message(convo, recipients, msg_body, subject, message_timestamp)
62
+ def build_message(convo, recipients,
63
+ msg_body, subject, message_timestamp)
49
64
  ::Mailboxer::MessageBuilder.new(
50
65
  sender: self,
51
66
  conversation: convo,
@@ -1,3 +1,3 @@
1
1
  module MailboxerMultiAttach
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
Binary file