reelagram-mail 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/reelagram/mail/parsers/shipping_parser.rb +7 -4
- data/lib/reelagram/version.rb +1 -1
- data/test/fixtures/heroku_email.txt +1 -0
- data/test/parsers/shipping_parser_test.rb +13 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bbb8369fbfe31fbf02164727d4304d778c0815b
|
4
|
+
data.tar.gz: 7d72de3368db5ee798c9c0ac7f41a4beb121b8a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f13253effc740aa8bfebd561be22a0a544242eea1a7203438e4fb99bc9573dcec899709006a25dd83ee4e3e43cbaaa998effe093b5e551e602f6d62ef8961eea
|
7
|
+
data.tar.gz: ae861d7b3caa73188eeadbf68a50e842a205d0baaa2aa2118585107c3ed533b3a971582f3945c0d2b1686436f95cd11be460015bd58857b2dc6e4939d9fa1d6d
|
data/Gemfile.lock
CHANGED
@@ -18,19 +18,18 @@ module Reelagram
|
|
18
18
|
|
19
19
|
def carrier
|
20
20
|
return "Unavailable" unless shipping_info_row
|
21
|
-
@row.children[
|
21
|
+
@row.children[0].text
|
22
22
|
end
|
23
23
|
|
24
24
|
def tracking_number
|
25
25
|
return "Unavailable" unless shipping_info_row
|
26
|
-
|
26
|
+
tracking_link.text
|
27
27
|
end
|
28
28
|
|
29
29
|
def tracking_link
|
30
30
|
return unless shipping_info_row
|
31
31
|
begin
|
32
|
-
|
33
|
-
.css("a")
|
32
|
+
tracking_link.css("a")
|
34
33
|
.attr("href")
|
35
34
|
.value
|
36
35
|
rescue
|
@@ -56,6 +55,10 @@ module Reelagram
|
|
56
55
|
|
57
56
|
private
|
58
57
|
|
58
|
+
def tracking_link
|
59
|
+
@row.children[2].css("a")
|
60
|
+
end
|
61
|
+
|
59
62
|
def shipping_info_table
|
60
63
|
@shipping_info_table ||= doc.css("table")[-2]
|
61
64
|
end
|
data/lib/reelagram/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
"<style type=\"text/css\">\nbody,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }\n</style>\n<body style=\"background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;\">\n<div style=\"background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;\">\n<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n<tr>\n <td align=\"center\" valign=\"top\" style=\"padding:20px 0 20px 0\">\n <table bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\" width=\"650\" style=\"border:1px solid #E0E0E0;\">\n <!-- [ header starts here] -->\n <tr>\n <td valign=\"top\"><a href=\"http://www.image3d.com/store/index.php/\"><img src=\"https://www.image3d.com/store/media/email/logo/default/logosmall1.jpg\" alt=\"Image3D\" style=\"margin-bottom:10px;\" border=\"0\"/></a></td>\n </tr>\n <!-- [ middle starts here] -->\n <tr>\n <td valign=\"top\">\n <h1 style=\"font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;\"\">Hello, Sait Mesutcan Ilhaner</h1>\n <p style=\"font-size:12px; line-height:16px; margin:0;\">\n<br />\nWe are happy to say that your order is complete and has left our facility! \n<br />You can check the status of your shipment by clicking the tracking number below. \n<br />Please know that tracking numbers can take up to 24 hours to be updated. \n \n <br /><br /> <p style=\"font-size:12px; line-height:16px; margin:0;\">Be sure to sign up for our <a href=\"http://bit.ly/I3Demails\">E-Newsltter</a> to get the latest deals and info, you even get a coupon just for subscribing! Then, follow the fun on <a href=\"https://www.facebook.com/USA.Image3D\" title=\"Image3D on Facebook\">Facebook</a>, <a href=\"https://twitter.com/Image3Dusa\" title=\"Image3D on Twitter\">Twitter</a>, <a href=\"http://www.youtube.com/image3dusa\" title=\"Image3D on YouTube\">YouTube</a>, and <a href=\"http://pinterest.com/image3d/\" title=\"Image3D on Pinterest\">Pinterest</a>. </p>\n\n<br /><br /> If you have any questions, email us at <a href=\"mailto:Celebrate@image3d.com\" style=\"color:#1E7EC8;\">Celebrate@image3d.com</a> or give us a ring at <span class=\"nobr\">503-632-2470</span>.\n </p>\n </tr>\n <tr>\n <td>\n <h2 style=\"font-size:18px; font-weight:normal; margin:0;\">Your Order #27780000265 <small>(placed on July 5, 2014 9:49:00 PM PDT)</small></h2>\n </td>\n </tr>\n <tr>\n <td>\n <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"650\">\n <thead>\n <tr>\n <th align=\"left\" width=\"325\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:5px 9px 6px 9px; line-height:1em;\">Billing Information:</th>\n <th width=\"10\"></th>\n <th align=\"left\" width=\"325\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:5px 9px 6px 9px; line-height:1em;\">Payment Method:</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td valign=\"top\" style=\"font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;\">\n Sait Mesutcan Ilhaner<br/>\n\n2400 W. Empire Ave Ste 300<br />\n\n\n\nBurbank, CA, 91504<br/>\n<br/>\nT: 510-289-9049\n\n\n </td>\n <td> </td>\n <td valign=\"top\" style=\"font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;\">\n <br />Purchase Order <br /><br />Purchase Order Number: 7780000265\n\n\n\n\n\n </td>\n </tr>\n </tbody>\n </table>\n <br/>\n \n <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"650\">\n <thead>\n <tr>\n <th align=\"left\" width=\"325\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:5px 9px 6px 9px; line-height:1em;\">Shipping Information:</th>\n <th width=\"10\"></th>\n <th align=\"left\" width=\"325\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:5px 9px 6px 9px; line-height:1em;\">Shipping Method:</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td valign=\"top\" width=\"50%\" style=\"font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;\">\n Sait Mesutcan Ilhaner<br/>\n\n2400 W. Empire Ave Ste 300<br />\n\n\n\nBurbank, CA, 91504<br/>\n<br/>\nT: 510-289-9049\n\n\n \n </td>\n <td> </td>\n <td valign=\"top\" width=\"50%\" style=\"font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;\">\n <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"300\" style=\"border:1px solid #EAEAEA;\">\n <thead>\n <tr>\n <th align=\"left\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:3px 9px\">Shipped By</th>\n <th align=\"center\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:3px 9px\">Tracking Number</th>\n </tr>\n </thead>\n <tbody>\n <tr bgcolor=\"#F6F6F6\">\n <td align=\"left\" valign=\"top\" style=\"padding:3px 9px\">United States Postal Service</td>\n <td align=\"center\" valign=\"top\" style=\"padding:3px 9px\"><a href='http://wwwapps.ups.com/WebTracking/track?HTMLVersion=5.0&loc=en_US&Requester=UPSHome&WBPM_lid=homepage%2Fct1.html_pnl_trk&trackNums=92748999982943513015002409&track.x=Track target='_blank'>92748999982943513015002409</a><br /><br />Please allow 24 hours for your tracking number to update</td>\n </tr>\n </tbody>\n</table>\n\n\n </td>\n </tr>\n </tbody>\n </table>\n <br/>\n \n <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"650\" style=\"border:1px solid #EAEAEA;\">\n <thead>\n <tr>\n <th align=\"left\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:3px 9px\">Item</th>\n <th align=\"left\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:3px 9px\">Sku</th>\n <th align=\"center\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:3px 9px\">Qty</th>\n <th align=\"right\" bgcolor=\"#EAEAEA\" style=\"font-size:13px; padding:3px 9px\">Subtotal</th>\n </tr>\n </thead>\n\n <tbody bgcolor=\"#F6F6F6\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;\">\n <strong style=\"font-size:11px;\">Reel & Viewer Set</strong>\n <dl style=\"margin:0; padding:0;\">\n <dt><strong><em>Reel ID</em></strong></dt>\n <dd style=\"margin:0; padding:0 0 0 9px;\">\n \t </dd>\n <dt><strong><em>Viewer Color</em></strong></dt>\n <dd style=\"margin:0; padding:0 0 0 9px;\">\n Black </dd>\n </dl>\n </td>\n <td align=\"left\" valign=\"top\" style=\"font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;\">VIEWER-4510</td>\n <td align=\"center\" valign=\"top\" style=\"font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;\">1</td>\n <td align=\"right\" valign=\"top\" style=\"font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;\">\n <span class=\"price\">$29.95</span> \n\n \n\n </td>\n</tr>\n </tbody>\n \n <tbody>\n <tr class=\"subtotal\">\n <td colspan=\"3\" align=\"right\" style=\"padding:3px 9px\">\n Subtotal </td>\n <td align=\"right\" style=\"padding:3px 9px\">\n <span class=\"price\">$29.95</span> </td>\n </tr>\n <tr class=\"shipping\">\n <td colspan=\"3\" align=\"right\" style=\"padding:3px 9px\">\n Shipping & Handling </td>\n <td align=\"right\" style=\"padding:3px 9px\">\n <span class=\"price\">$7.50</span> </td>\n </tr>\n <tr class=\"grand_total\">\n <td colspan=\"3\" align=\"right\" style=\"padding:3px 9px\">\n <strong>Grand Total</strong>\n </td>\n <td align=\"right\" style=\"padding:3px 9px\">\n <strong><span class=\"price\">$37.45</span></strong>\n </td>\n </tr>\n </tbody>\n</table>\n\n <p style=\"font-size:12px; margin:0 0 10px 0\"></p>\n </td>\n </tr>\n <tr>\n <td bgcolor=\"#EAEAEA\" align=\"center\" style=\"background:#EAEAEA; text-align:center;\"><center><p style=\"font-size:12px; margin:0;\">Thank you!<strong>Image3D</strong></p></center></td>\n </tr>\n </table>\n </td>\n</tr>\n</table>\n</div>\n</body>\n"
|
@@ -48,6 +48,15 @@ class ShippingParserTest < MiniTest::Unit::TestCase
|
|
48
48
|
assert_nil(parser.instance_variable_get("@row"))
|
49
49
|
end
|
50
50
|
|
51
|
+
def test_parses_heroku_email
|
52
|
+
parser.reset!
|
53
|
+
parser.run heroku_style_email
|
54
|
+
assert_equal("7780000265", parser.order_number)
|
55
|
+
assert_equal("92748999982943513015002409", parser.tracking_number)
|
56
|
+
assert_equal("http://wwwapps.ups.com/WebTracking/track?HTMLVersion=5.0&loc=en_US&Requester=UPSHome&WBPM_lid=homepage%2Fct1.html_pnl_trk&trackNums=92748999982943513015002409&track.x=Track target=", parser.tracking_link)
|
57
|
+
assert_equal("United States Postal Service", parser.carrier)
|
58
|
+
end
|
59
|
+
|
51
60
|
private
|
52
61
|
|
53
62
|
def parser
|
@@ -61,4 +70,8 @@ class ShippingParserTest < MiniTest::Unit::TestCase
|
|
61
70
|
def no_shipping_data
|
62
71
|
""
|
63
72
|
end
|
73
|
+
|
74
|
+
def heroku_style_email
|
75
|
+
FixtureHelper.fixture("heroku_email.txt")
|
76
|
+
end
|
64
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reelagram-mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Wheeler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-gmail
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- test/fetchers/base_fetcher_test.rb
|
113
113
|
- test/fetchers/shipping_fetcher_test.rb
|
114
114
|
- test/fixtures/email_body.txt
|
115
|
+
- test/fixtures/heroku_email.txt
|
115
116
|
- test/parsers/shipping_parser_test.rb
|
116
117
|
- test/processors/shipping_processor_test.rb
|
117
118
|
- test/support/config_helper.rb
|
@@ -146,6 +147,7 @@ test_files:
|
|
146
147
|
- test/fetchers/base_fetcher_test.rb
|
147
148
|
- test/fetchers/shipping_fetcher_test.rb
|
148
149
|
- test/fixtures/email_body.txt
|
150
|
+
- test/fixtures/heroku_email.txt
|
149
151
|
- test/parsers/shipping_parser_test.rb
|
150
152
|
- test/processors/shipping_processor_test.rb
|
151
153
|
- test/support/config_helper.rb
|