rockdove 0.0.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/.gitignore +5 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +4 -0
- data/Guardfile +9 -0
- data/LICENSE +22 -0
- data/README.md +87 -0
- data/Rakefile +6 -0
- data/lib/generators/rockdove/install_generator.rb +12 -0
- data/lib/rockdove/collect_mail.rb +120 -0
- data/lib/rockdove/config.rb +42 -0
- data/lib/rockdove/dovetie.rb +18 -0
- data/lib/rockdove/email_parser.rb +46 -0
- data/lib/rockdove/exchange_mail.rb +52 -0
- data/lib/rockdove/script/rockdove_server.rb +46 -0
- data/lib/rockdove/version.rb +3 -0
- data/lib/rockdove.rb +24 -0
- data/rockdove.gemspec +31 -0
- data/spec/rockdove/collect_mail_spec.rb +92 -0
- data/spec/rockdove/emails/auto_reply_mail.yml +52 -0
- data/spec/rockdove/emails/forwarded_mail.yml +77 -0
- data/spec/rockdove/emails/gmail_fwd_mail.yml +46 -0
- data/spec/rockdove/emails/mail_type_text.yml +47 -0
- data/spec/rockdove/emails/new_mail.yml +52 -0
- data/spec/rockdove/emails/replied_mail.yml +49 -0
- data/spec/rockdove/emails/undeliverable_mail.yml +52 -0
- data/spec/rockdove/fetch_incoming_mail_spec.rb +77 -0
- data/spec/rockdove/rockdove_shared_spec.rb +51 -0
- data/spec/spec_helper.rb +25 -0
- metadata +171 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Rockdove::EWS
|
2
|
+
item_id:
|
3
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBXAAA=
|
4
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACChg
|
5
|
+
parent_folder_id:
|
6
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
7
|
+
change_key: AQAAAA==
|
8
|
+
subject: "Automatic reply: Out of Office Message"
|
9
|
+
sensitivity:
|
10
|
+
text: Normal
|
11
|
+
body_type: HTML
|
12
|
+
body: ! "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html;
|
13
|
+
charset=utf-8\">\r\n</head>\r\n<body>I am out of office and will reply to your mails after my vacation.\r\n<div><br>\r\n</div>\r\n--
|
14
|
+
<br>\r\n<font face=\"comic sans ms,sans-serif\">Thanks & Regards,</font><br>\r\n<font
|
15
|
+
face=\"comic sans ms,sans-serif\"> </font><font face=\"comic sans ms,sans-serif\"><img
|
16
|
+
src=\"http://etc.usf.edu/clipart/2400/2430/k_1_lg.gif\" height=\"51\" width=\"51\"></font><font
|
17
|
+
face=\"comic sans ms,sans-serif\">iran</font><font face=\"comic sans ms,sans-serif\">\r\n
|
18
|
+
LastName</font><br>\r\n<font face=\"comic sans ms,sans-serif\">"Th</font><font
|
19
|
+
face=\"comic sans ms,sans-serif\">e Journey Goes on..."<br>\r\nCatch me
|
20
|
+
<a href=\"https://socio.ewsdomain.com/u/505\" target=\"_blank\">@network</a><br>\r\n</font><br>\r\n</body>\r\n</html>\r\n"
|
21
|
+
size:
|
22
|
+
text: '1324'
|
23
|
+
date_time_sent:
|
24
|
+
text: '2012-06-25T12:56:50Z'
|
25
|
+
date_time_created:
|
26
|
+
text: '2012-06-25T12:56:54Z'
|
27
|
+
has_attachments:
|
28
|
+
text: 'false'
|
29
|
+
to_recipients:
|
30
|
+
mailbox:
|
31
|
+
name:
|
32
|
+
text: network
|
33
|
+
email_address:
|
34
|
+
text: network@ewsdomain.com
|
35
|
+
routing_type:
|
36
|
+
text: SMTP
|
37
|
+
is_read_receipt_requested:
|
38
|
+
text: 'false'
|
39
|
+
from:
|
40
|
+
name:
|
41
|
+
text: LastName, User (ewsdomain)
|
42
|
+
email_address: User.LastName@ewsdomain.com
|
43
|
+
routing_type:
|
44
|
+
text: SMTP
|
45
|
+
is_read:
|
46
|
+
text: 'false'
|
47
|
+
shallow: true
|
48
|
+
item_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBXAAA=
|
49
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACChg
|
50
|
+
text_only: false
|
51
|
+
updates: {}
|
52
|
+
parent_folder_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Rockdove::EWS
|
2
|
+
item_id:
|
3
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBWAAA=
|
4
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACChW
|
5
|
+
parent_folder_id:
|
6
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
7
|
+
change_key: AQAAAA==
|
8
|
+
subject: 'Fwd: Ashish Prasad liked your post'
|
9
|
+
sensitivity:
|
10
|
+
text: Normal
|
11
|
+
body_type: HTML
|
12
|
+
body: ! "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html;
|
13
|
+
charset=utf-8\">\r\n</head>\r\n<body>\r\nFYI<br>\r\n<br>\r\n<div class=\"gmail_quote\">----------
|
14
|
+
Forwarded message ----------<br>\r\nFrom: <b class=\"gmail_sendername\">Ashish
|
15
|
+
Prasad (network*)</b> <span dir=\"ltr\">\r\n<<a href=\"mailto:no-reply-network@ewsdomain.com\">no-reply-network@ewsdomain.com</a>></span><br>\r\nDate:
|
16
|
+
Mon, Jun 25, 2012 at 12:59 PM<br>\r\nSubject: Ashish Prasad liked your post<br>\r\nTo:
|
17
|
+
User LastName <<a href=\"mailto:User.LastName@ewsdomain.com\">User.LastName@ewsdomain.com</a>><br>\r\n<br>\r\n<br>\r\n<div
|
18
|
+
style=\"font-family:'Trebuchet MS'\">\r\n<div style=\"\">\r\n<div style=\"border-left:1px
|
19
|
+
#bcbcbc solid;border-right:1px #bcbcbc solid;width:750px\">\r\n<div style=\"background-color:#173f68;border-bottom:1px
|
20
|
+
solid #040000;color:#cccccc;padding:6px 0;width:100%;min-height:32px\">\r\n<img
|
21
|
+
src=\"https://socio.ewsdomain.com//images/logo_small.png\"> </div>\r\n<div
|
22
|
+
style=\"font-size:13px;margin-left:12px\">\r\n<p style=\"margin-left:7%;width:600px;text-align:justify;font-family:'Trebuchet
|
23
|
+
MS';font-size:14px;word-wrap:break-word\">\r\nAshish Prasad liked your post:
|
24
|
+
Many Many Happy Returns of the day to the Twins, Mouli TR and Karthik Rajashekaran
|
25
|
+
!!! #birthdays\r\n<br>\r\n</p>\r\n<a href=\"https://socio.ewsdomain.com/posts/19776\"
|
26
|
+
style=\"color:#1e496a;font-size:13px;font-weight:bold;word-spacing:3px;text-align:center;margin-left:50px;width:200px;min-height:40px;text-decoration:none;padding:0.25em
|
27
|
+
0.5em 0.3em 0.5em\" target=\"_blank\">View\r\n post > </a>\r\n<p></p>\r\n</div>\r\n<div><img
|
28
|
+
src=\"https://socio.ewsdomain.com//images/notifiers/notifier_layout/GTO_Logo_small.png\"
|
29
|
+
alt=\"ewsdomain\">\r\n<img src=\"https://socio.ewsdomain.com//images/notifiers/notifier_layout/AW_Logo_small.png\"
|
30
|
+
alt=\"ewsdomain\">\r\n</div>\r\n<div style=\"margin-top:2%;background-color:#d2dde4;text-align:center;font-size:11px;word-spacing:1px\">\r\nThis
|
31
|
+
email was sent by network. If you'd like to stop getting emails like this,\r\n<a
|
32
|
+
href=\"https://socio.ewsdomain.com/user/edit\" target=\"_blank\">click here</a>
|
33
|
+
to change your notification settings.\r\n</div>\r\n</div>\r\n</div>\r\nThis
|
34
|
+
e-mail and any files transmitted with it are for the sole use of the intended
|
35
|
+
recipient(s) and may contain confidential and privileged information. If you
|
36
|
+
are not the intended recipient(s), please reply to the sender and destroy all
|
37
|
+
copies of the original\r\n message. Any unauthorized review, use, disclosure,
|
38
|
+
dissemination, forwarding, printing or copying of this email, and/or any action
|
39
|
+
taken in reliance on the contents of this e-mail is strictly prohibited and
|
40
|
+
may be unlawful.\r\n</div>\r\n</div>\r\n<br>\r\n<br clear=\"all\">\r\n<div><br>\r\n</div>\r\n--
|
41
|
+
<br>\r\n<font face=\"comic sans ms,sans-serif\">Thanks & Regards,</font><br>\r\n<font
|
42
|
+
face=\"comic sans ms,sans-serif\"> </font><font face=\"comic sans ms,sans-serif\"><img
|
43
|
+
src=\"http://etc.usf.edu/clipart/2400/2430/k_1_lg.gif\" height=\"51\" width=\"51\"></font><font
|
44
|
+
face=\"comic sans ms,sans-serif\">iran</font><font face=\"comic sans ms,sans-serif\">\r\n
|
45
|
+
LastName</font><br>\r\n<font face=\"comic sans ms,sans-serif\">"Th</font><font
|
46
|
+
face=\"comic sans ms,sans-serif\">e Journey Goes on..."<br>\r\nCatch me
|
47
|
+
<a href=\"https://socio.ewsdomain.com/u/505\" target=\"_blank\">@network</a><br>\r\n</font><br>\r\n</body>\r\n</html>\r\n"
|
48
|
+
size:
|
49
|
+
text: '3863'
|
50
|
+
date_time_sent:
|
51
|
+
text: '2012-06-25T11:32:50Z'
|
52
|
+
date_time_created:
|
53
|
+
text: '2012-06-25T11:32:53Z'
|
54
|
+
has_attachments:
|
55
|
+
text: 'false'
|
56
|
+
to_recipients:
|
57
|
+
name:
|
58
|
+
text: network
|
59
|
+
email_address: network@ewsdomain.com
|
60
|
+
routing_type:
|
61
|
+
text: SMTP
|
62
|
+
is_read_receipt_requested:
|
63
|
+
text: 'false'
|
64
|
+
from:
|
65
|
+
name:
|
66
|
+
text: LastName, User (ewsdomain)
|
67
|
+
email_address: User.LastName@ewsdomain.com
|
68
|
+
routing_type:
|
69
|
+
text: SMTP
|
70
|
+
is_read:
|
71
|
+
text: 'true'
|
72
|
+
shallow: true
|
73
|
+
item_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBWAAA=
|
74
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACChW
|
75
|
+
text_only: false
|
76
|
+
updates: {}
|
77
|
+
parent_folder_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Rockdove::EWS
|
2
|
+
item_id:
|
3
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBZAAA=
|
4
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACDSJ
|
5
|
+
parent_folder_id:
|
6
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
7
|
+
change_key: AQAAAA==
|
8
|
+
subject: 'RE: New Post'
|
9
|
+
sensitivity:
|
10
|
+
text: Normal
|
11
|
+
body_type: Text
|
12
|
+
body: ! "I get proper rendering as well.\r\n\r\nOn Dec 16, 2011, at 12:47 PM, Corey Donohoe<reply@reply.github.com>wrote:\r\n\r\n> Was this caching related or fixed already? I get proper rendering here.\r\n>\r\n> \r\n>\r\n> ---\r\n> Reply to this email directly or view it on GitHub:\r\n> https://github.com/github/github/issues/2278#issuecomment-3182418"
|
13
|
+
size:
|
14
|
+
text: '1658'
|
15
|
+
date_time_sent:
|
16
|
+
text: '2012-06-25T13:09:07Z'
|
17
|
+
date_time_created:
|
18
|
+
text: '2012-06-25T13:09:08Z'
|
19
|
+
has_attachments:
|
20
|
+
text: 'false'
|
21
|
+
to_recipients:
|
22
|
+
mailbox:
|
23
|
+
name:
|
24
|
+
text: network
|
25
|
+
email_address:
|
26
|
+
text: network@ewsdomain.com
|
27
|
+
routing_type:
|
28
|
+
text: SMTP
|
29
|
+
is_read_receipt_requested:
|
30
|
+
text: 'false'
|
31
|
+
is_delivery_receipt_requested:
|
32
|
+
text: 'false'
|
33
|
+
from:
|
34
|
+
name:
|
35
|
+
text: network
|
36
|
+
email_address: User.LastName@ewsdomain.com
|
37
|
+
routing_type:
|
38
|
+
text: SMTP
|
39
|
+
is_read:
|
40
|
+
text: 'true'
|
41
|
+
shallow: true
|
42
|
+
item_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBZAAA=
|
43
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACDSJ
|
44
|
+
text_only: false
|
45
|
+
updates: {}
|
46
|
+
parent_folder_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Rockdove::EWS
|
2
|
+
item_id:
|
3
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBZAAA=
|
4
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACDSJ
|
5
|
+
parent_folder_id:
|
6
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
7
|
+
change_key: AQAAAA==
|
8
|
+
subject: 'RE: New Post'
|
9
|
+
sensitivity:
|
10
|
+
text: Normal
|
11
|
+
body_type: Text
|
12
|
+
body: ! "This is a new post\r\nThanks & Regards,\r\n [http://etc.usf.edu/clipart/2400/2430/k_1_lg.gif]
|
13
|
+
iran lastname\r\n\"The Journey Goes on...\"\r\nCatch me @network<https://socio.ewsdomain.com/u/505>\r\n\r\n"
|
14
|
+
size:
|
15
|
+
text: '1658'
|
16
|
+
date_time_sent:
|
17
|
+
text: '2012-06-25T13:09:07Z'
|
18
|
+
date_time_created:
|
19
|
+
text: '2012-06-25T13:09:08Z'
|
20
|
+
has_attachments:
|
21
|
+
text: 'false'
|
22
|
+
to_recipients:
|
23
|
+
mailbox:
|
24
|
+
name:
|
25
|
+
text: network
|
26
|
+
email_address:
|
27
|
+
text: network@ewsdomain.com
|
28
|
+
routing_type:
|
29
|
+
text: SMTP
|
30
|
+
is_read_receipt_requested:
|
31
|
+
text: 'false'
|
32
|
+
is_delivery_receipt_requested:
|
33
|
+
text: 'false'
|
34
|
+
from:
|
35
|
+
name:
|
36
|
+
text: network
|
37
|
+
email_address: User.LastName@ewsdomain.com
|
38
|
+
routing_type:
|
39
|
+
text: SMTP
|
40
|
+
is_read:
|
41
|
+
text: 'true'
|
42
|
+
shallow: true
|
43
|
+
item_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBZAAA=
|
44
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACDSJ
|
45
|
+
text_only: false
|
46
|
+
updates: {}
|
47
|
+
parent_folder_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Rockdove::EWS
|
2
|
+
item_id:
|
3
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBXAAA=
|
4
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACChg
|
5
|
+
parent_folder_id:
|
6
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
7
|
+
change_key: AQAAAA==
|
8
|
+
subject: New Post
|
9
|
+
sensitivity:
|
10
|
+
text: Normal
|
11
|
+
body_type: HTML
|
12
|
+
body: ! "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html;
|
13
|
+
charset=utf-8\">\r\n</head>\r\n<body>\r\nHi, This is a new post<br clear=\"all\">\r\n<div><br>\r\n</div>\r\n--
|
14
|
+
<br>\r\n<font face=\"comic sans ms,sans-serif\">Thanks & Regards,</font><br>\r\n<font
|
15
|
+
face=\"comic sans ms,sans-serif\"> </font><font face=\"comic sans ms,sans-serif\"><img
|
16
|
+
src=\"http://etc.usf.edu/clipart/2400/2430/k_1_lg.gif\" height=\"51\" width=\"51\"></font><font
|
17
|
+
face=\"comic sans ms,sans-serif\">iran</font><font face=\"comic sans ms,sans-serif\">\r\n
|
18
|
+
LastName</font><br>\r\n<font face=\"comic sans ms,sans-serif\">"Th</font><font
|
19
|
+
face=\"comic sans ms,sans-serif\">e Journey Goes on..."<br>\r\nCatch me
|
20
|
+
<a href=\"https://socio.ewsdomain.com/u/505\" target=\"_blank\">@network</a><br>\r\n</font><br>\r\n</body>\r\n</html>\r\n"
|
21
|
+
size:
|
22
|
+
text: '1324'
|
23
|
+
date_time_sent:
|
24
|
+
text: '2012-06-25T12:56:50Z'
|
25
|
+
date_time_created:
|
26
|
+
text: '2012-06-25T12:56:54Z'
|
27
|
+
has_attachments:
|
28
|
+
text: 'false'
|
29
|
+
to_recipients:
|
30
|
+
mailbox:
|
31
|
+
name:
|
32
|
+
text: network
|
33
|
+
email_address:
|
34
|
+
text: network@ewsdomain.com
|
35
|
+
routing_type:
|
36
|
+
text: SMTP
|
37
|
+
is_read_receipt_requested:
|
38
|
+
text: 'false'
|
39
|
+
from:
|
40
|
+
name:
|
41
|
+
text: LastName, User (ewsdomain)
|
42
|
+
email_address: User.LastName@ewsdomain.com
|
43
|
+
routing_type:
|
44
|
+
text: SMTP
|
45
|
+
is_read:
|
46
|
+
text: 'false'
|
47
|
+
shallow: true
|
48
|
+
item_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBXAAA=
|
49
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACChg
|
50
|
+
text_only: false
|
51
|
+
updates: {}
|
52
|
+
parent_folder_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Rockdove::EWS
|
2
|
+
item_id:
|
3
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBZAAA=
|
4
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACDSJ
|
5
|
+
parent_folder_id:
|
6
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
7
|
+
change_key: AQAAAA==
|
8
|
+
subject: 'RE: New Post'
|
9
|
+
sensitivity:
|
10
|
+
text: Normal
|
11
|
+
body_type: Text
|
12
|
+
body: ! "This is a replied post from outlook\r\n________________________________________\r\nFrom:
|
13
|
+
lastname, User (ewsdomain)\r\nSent: Monday, June 25, 2012 6:26 PM\r\nTo: network\r\nSubject:
|
14
|
+
New Post\r\n\r\nHi, This is a new post\r\n\r\n--\r\nThanks & Regards,\r\n [http://etc.usf.edu/clipart/2400/2430/k_1_lg.gif]
|
15
|
+
iran lastname\r\n\"The Journey Goes on...\"\r\nCatch me @network<https://socio.ewsdomain.com/u/505>\r\n\r\n"
|
16
|
+
size:
|
17
|
+
text: '1658'
|
18
|
+
date_time_sent:
|
19
|
+
text: '2012-06-25T13:09:07Z'
|
20
|
+
date_time_created:
|
21
|
+
text: '2012-06-25T13:09:08Z'
|
22
|
+
has_attachments:
|
23
|
+
text: 'false'
|
24
|
+
to_recipients:
|
25
|
+
mailbox:
|
26
|
+
name:
|
27
|
+
text: network
|
28
|
+
email_address:
|
29
|
+
text: network@ewsdomain.com
|
30
|
+
routing_type:
|
31
|
+
text: SMTP
|
32
|
+
is_read_receipt_requested:
|
33
|
+
text: 'false'
|
34
|
+
is_delivery_receipt_requested:
|
35
|
+
text: 'false'
|
36
|
+
from:
|
37
|
+
name:
|
38
|
+
text: network
|
39
|
+
email_address: User.LastName@ewsdomain.com
|
40
|
+
routing_type:
|
41
|
+
text: SMTP
|
42
|
+
is_read:
|
43
|
+
text: 'true'
|
44
|
+
shallow: true
|
45
|
+
item_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBZAAA=
|
46
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACDSJ
|
47
|
+
text_only: false
|
48
|
+
updates: {}
|
49
|
+
parent_folder_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Rockdove::EWS
|
2
|
+
item_id:
|
3
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBXAAA=
|
4
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACChg
|
5
|
+
parent_folder_id:
|
6
|
+
id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
7
|
+
change_key: AQAAAA==
|
8
|
+
subject: "Undeliverable: New Post"
|
9
|
+
sensitivity:
|
10
|
+
text: Normal
|
11
|
+
body_type: HTML
|
12
|
+
body: ! "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html;
|
13
|
+
charset=utf-8\">\r\n</head>\r\n<body>Devlivery Failure to the recipient user.last@ewsdomain.com \r\nHi, This is a new post<br clear=\"all\">\r\n<div><br>\r\n</div>\r\n--
|
14
|
+
<br>\r\n<font face=\"comic sans ms,sans-serif\">Thanks & Regards,</font><br>\r\n<font
|
15
|
+
face=\"comic sans ms,sans-serif\"> </font><font face=\"comic sans ms,sans-serif\"><img
|
16
|
+
src=\"http://etc.usf.edu/clipart/2400/2430/k_1_lg.gif\" height=\"51\" width=\"51\"></font><font
|
17
|
+
face=\"comic sans ms,sans-serif\">iran</font><font face=\"comic sans ms,sans-serif\">\r\n
|
18
|
+
LastName</font><br>\r\n<font face=\"comic sans ms,sans-serif\">"Th</font><font
|
19
|
+
face=\"comic sans ms,sans-serif\">e Journey Goes on..."<br>\r\nCatch me
|
20
|
+
<a href=\"https://socio.ewsdomain.com/u/505\" target=\"_blank\">@network</a><br>\r\n</font><br>\r\n</body>\r\n</html>\r\n"
|
21
|
+
size:
|
22
|
+
text: '1324'
|
23
|
+
date_time_sent:
|
24
|
+
text: '2012-06-25T12:56:50Z'
|
25
|
+
date_time_created:
|
26
|
+
text: '2012-06-25T12:56:54Z'
|
27
|
+
has_attachments:
|
28
|
+
text: 'false'
|
29
|
+
to_recipients:
|
30
|
+
mailbox:
|
31
|
+
name:
|
32
|
+
text: network
|
33
|
+
email_address:
|
34
|
+
text: network@ewsdomain.com
|
35
|
+
routing_type:
|
36
|
+
text: SMTP
|
37
|
+
is_read_receipt_requested:
|
38
|
+
text: 'false'
|
39
|
+
from:
|
40
|
+
name:
|
41
|
+
text: LastName, User (ewsdomain)
|
42
|
+
email_address: User.LastName@ewsdomain.com
|
43
|
+
routing_type:
|
44
|
+
text: SMTP
|
45
|
+
is_read:
|
46
|
+
text: 'false'
|
47
|
+
shallow: true
|
48
|
+
item_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OABGAAAAAAD/yBU79ZvXQ6rBazqQ3s20BwBjikxovOdMSKu/0PoKjGIOAAADx+aDAAB8I0zOaEn9R5HiOejwHZwCAAAACCBXAAA=
|
49
|
+
change_key: CQAAABYAAAB8I0zOaEn9R5HiOejwHZwCAAAACChg
|
50
|
+
text_only: false
|
51
|
+
updates: {}
|
52
|
+
parent_folder_id: AAMkADZjZWE3MWJkLWJmZDctNGViOC1iMmFjLTgxOWE5MDk5NDg5OAAuAAAAAAD/yBU79ZvXQ6rBazqQ3s20AQBjikxovOdMSKu/0PoKjGIOAAADx+aDAAA=
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe "FetchIncomingMail" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@connection = Rockdove::Config
|
7
|
+
@mail_retriever = Rockdove::CollectMail.new()
|
8
|
+
@log_stream = StringIO.new
|
9
|
+
Rockdove.stub!(:logger).and_return(Logger.new(@log_stream))
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should validate the exchange server info provided" do
|
13
|
+
@connection.url.should_not be_nil
|
14
|
+
@connection.username.should_not be_nil
|
15
|
+
@connection.password.should_not be_nil
|
16
|
+
@connection.incoming_folder.should_not be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should raise error for retrieval of inbox when there is no connection to exchange server" do
|
20
|
+
@mail_retriever.inbox.should raise_error
|
21
|
+
end
|
22
|
+
|
23
|
+
it "is trying to fetch mail when there is no incoming mail" do
|
24
|
+
@mail_retriever.should_receive(:inbox).and_return(nil)
|
25
|
+
@mail_retriever.group_of_mails.should == nil
|
26
|
+
end
|
27
|
+
|
28
|
+
it "is trying to fetch a new forwarded mail" do
|
29
|
+
mail = fetch_mail("forwarded_mail")
|
30
|
+
mail.should be_an_instance_of(Rockdove::EWS)
|
31
|
+
result = @mail_retriever.retrieve_mail(mail)
|
32
|
+
result.should be_an_instance_of(Rockdove::ExchangeMail)
|
33
|
+
result.body.should == "FYI"
|
34
|
+
match_results(result, mail)
|
35
|
+
convert_from_hash(mail)
|
36
|
+
result.from.should == "User.LastName@ewsdomain.com"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "is trying to fetch a new mail" do
|
40
|
+
mail = fetch_mail("new_mail")
|
41
|
+
mail.should be_an_instance_of(Rockdove::EWS)
|
42
|
+
result = @mail_retriever.retrieve_mail(mail)
|
43
|
+
result.should be_an_instance_of(Rockdove::ExchangeMail)
|
44
|
+
result.body.should == "Hi, This is a new post"
|
45
|
+
match_results(result, mail)
|
46
|
+
convert_from_hash(mail)
|
47
|
+
result.from.should == "User.LastName@ewsdomain.com"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "is trying to fetch a new replied mail" do
|
51
|
+
mail = fetch_mail("replied_mail")
|
52
|
+
mail.should be_an_instance_of(Rockdove::EWS)
|
53
|
+
result = @mail_retriever.retrieve_mail(mail)
|
54
|
+
result.should be_an_instance_of(Rockdove::ExchangeMail)
|
55
|
+
result.body.should == "This is a replied post from outlook"
|
56
|
+
match_results(result, mail)
|
57
|
+
convert_from_hash(mail)
|
58
|
+
result.from.should == "User.LastName@ewsdomain.com"
|
59
|
+
end
|
60
|
+
|
61
|
+
def match_results(result, mail)
|
62
|
+
result.subject.should == mail.subject
|
63
|
+
result.attachments.should == mail.attachments
|
64
|
+
result.date_time_created.should == mail.date_time_created
|
65
|
+
result.date_time_sent.should == mail.date_time_sent
|
66
|
+
end
|
67
|
+
|
68
|
+
def convert_from_hash(mail)
|
69
|
+
from_object = convert_to_class(mail.from)
|
70
|
+
mail.should_receive(:from).twice.and_return(from_object)
|
71
|
+
end
|
72
|
+
|
73
|
+
def convert_to_class(hash)
|
74
|
+
Hash2Class.new(hash)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
module Rockdove
|
4
|
+
class EWS
|
5
|
+
attr_accessor :to_recipients, :date_time_created, :date_time_sent, :from
|
6
|
+
attr_accessor :subject, :body, :body_type, :attachments
|
7
|
+
|
8
|
+
def id
|
9
|
+
rand(10)
|
10
|
+
end
|
11
|
+
|
12
|
+
def response(value)
|
13
|
+
value
|
14
|
+
end
|
15
|
+
|
16
|
+
def find_items(value = nil)
|
17
|
+
value
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_item(item)
|
21
|
+
item
|
22
|
+
end
|
23
|
+
|
24
|
+
def move!(destination)
|
25
|
+
response("Archived the Mail Item")
|
26
|
+
end
|
27
|
+
|
28
|
+
def delete!
|
29
|
+
response("Deleted the Mail Item")
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Hash2Class
|
36
|
+
def initialize(hash)
|
37
|
+
hash.each do |k,v|
|
38
|
+
self.instance_variable_set("@#{k}", v)
|
39
|
+
self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})
|
40
|
+
self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def fetch_mail(name)
|
46
|
+
YAML.load(fetch_mail_path(name.to_sym))
|
47
|
+
end
|
48
|
+
|
49
|
+
def fetch_mail_path(name)
|
50
|
+
IO.read EMAIL_FIXTURES.join("#{name}.yml").to_s
|
51
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter '/vendor/bundle/'
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'rockdove'
|
7
|
+
require 'rockdove/rockdove_shared_spec.rb'
|
8
|
+
require 'pathname'
|
9
|
+
|
10
|
+
dir = Pathname.new File.expand_path(File.dirname(__FILE__))
|
11
|
+
|
12
|
+
EMAIL_FIXTURES = dir + 'rockdove' + 'emails'
|
13
|
+
|
14
|
+
Rockdove::Config.configure do |config|
|
15
|
+
config.ews_url 'https://ewsdomain.com/ews/exchange.asmx'
|
16
|
+
config.ews_username 'username'
|
17
|
+
config.ews_password 'password'
|
18
|
+
config.ews_folder 'Inbox'
|
19
|
+
config.ews_archive_folder 'Archive'
|
20
|
+
config.ews_watch_interval 60
|
21
|
+
end
|
22
|
+
|
23
|
+
RSpec.configure do |c|
|
24
|
+
end
|
25
|
+
|