appmail 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/app_mail.rb +4 -0
- data/lib/app_mail/client.rb +10 -0
- data/lib/app_mail/send_message.rb +4 -0
- data/lib/app_mail/send_raw_message.rb +37 -0
- data/lib/app_mail/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ee3732c7781832a279ec3de521f3ee47a955644
|
4
|
+
data.tar.gz: 53ce38e91861e7756c2aa023700b39511266ff60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48b81964751d37f35f5195ab31df8080554e73c5256aad0a585a3efbaa1998f7639b4749879cd147ae1f7cd217c48e5b1ab8a5c1bbb3be3be7075445f6d1261f
|
7
|
+
data.tar.gz: 74319ac1e5a905c2c782eb85963b018d5832d39e5d245336bafebb00aada90bc79bfbd86505a726100e71203ee20bd839264298a078fd1656607a70367691281
|
data/lib/app_mail.rb
CHANGED
data/lib/app_mail/client.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'moonrope_client'
|
2
2
|
require 'app_mail/message_scope'
|
3
3
|
require 'app_mail/send_message'
|
4
|
+
require 'app_mail/send_raw_message'
|
4
5
|
|
5
6
|
module AppMail
|
6
7
|
class Client
|
@@ -37,6 +38,15 @@ module AppMail
|
|
37
38
|
message.send!
|
38
39
|
end
|
39
40
|
|
41
|
+
#
|
42
|
+
# Send a raw message
|
43
|
+
#
|
44
|
+
def send_raw_message(&block)
|
45
|
+
message = SendRawMessage.new(self)
|
46
|
+
block.call(message)
|
47
|
+
message.send!
|
48
|
+
end
|
49
|
+
|
40
50
|
#
|
41
51
|
# Return the backend moonrope instance for this client
|
42
52
|
#
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'app_mail/send_result'
|
3
|
+
|
4
|
+
module AppMail
|
5
|
+
class SendRawMessage
|
6
|
+
|
7
|
+
def initialize(client)
|
8
|
+
@client = client
|
9
|
+
@attributes = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def send!
|
13
|
+
api = @client.moonrope.request(:send, :raw, @attributes)
|
14
|
+
if api.success?
|
15
|
+
SendResult.new(@client, api.data)
|
16
|
+
elsif api.status == 'error'
|
17
|
+
raise SendError.new(api.data['code'], api.data['message'])
|
18
|
+
else
|
19
|
+
raise Error, "Couldn't send message"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def mail_from(address)
|
24
|
+
@attributes[:mail_from] = address
|
25
|
+
end
|
26
|
+
|
27
|
+
def rcpt_to(*addresses)
|
28
|
+
@attributes[:rcpt_to] ||= []
|
29
|
+
@attributes[:rcpt_to] += addresses
|
30
|
+
end
|
31
|
+
|
32
|
+
def data(data)
|
33
|
+
@attributes[:data] = Base64.encode64(data)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/lib/app_mail/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appmail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: moonrope-client
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- lib/app_mail/message.rb
|
47
47
|
- lib/app_mail/message_scope.rb
|
48
48
|
- lib/app_mail/send_message.rb
|
49
|
+
- lib/app_mail/send_raw_message.rb
|
49
50
|
- lib/app_mail/send_result.rb
|
50
51
|
- lib/app_mail/version.rb
|
51
52
|
- lib/appmail.rb
|