imap_to_rss 1.0.1 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,134 @@
1
+ require 'imap_to_rss/test_case'
2
+
3
+ class IMAPToRSS::Handler::HSBC
4
+ attr_reader :description
5
+ attr_reader :url
6
+ end
7
+
8
+ class TestIMAPToRSSHandlerHSBC < IMAPToRSS::TestCase
9
+
10
+ def setup
11
+ super IMAPToRSS::Handler::HSBC.new
12
+ end
13
+
14
+ def test_handle_a2atransfer
15
+ @handler.mail = util_mail :body => <<-BODY
16
+ Dear ERIC,
17
+
18
+ The funds transfer referenced below has completed.
19
+
20
+ *******************************************************************
21
+ Item #: 00000000
22
+
23
+ *******************************************************************
24
+
25
+ As of, August 13, 2009, the funds have been credited to the destination account and deducted from the account from which you requested the funds be transfered.
26
+
27
+ You may always review this transfer request on the Consolidated History page.
28
+
29
+ Sincerely,
30
+
31
+ Jean Carrow
32
+ Vice President,
33
+ Customer Relationship Center
34
+
35
+ http://www.us.hsbc.com
36
+
37
+ Please do not reply to this e-mail as your reply will go to an unmonitored mailbox. If you have any questions, you may send a secure BankMail from Internet Banking or call our Customer Relationship Center at 1-800-975-HSBC (1-800-975-4722).
38
+
39
+ This E-mail is confidential. It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return E-mail. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions.
40
+
41
+
42
+ Email ID: YY111
43
+
44
+ BODY
45
+
46
+ @handler.handle_a2atransfer
47
+
48
+ expected = <<-EXPECTED.strip
49
+ <p>The funds transfer referenced below has completed.</p>
50
+
51
+ <p>Item #: 00000000</p>
52
+
53
+ <p>As of, August 13, 2009, the funds have been credited to the destination account and deducted from the account from which you requested the funds be transfered.</p>
54
+
55
+ <p>You may always review this transfer request on the Consolidated History page.</p>
56
+ EXPECTED
57
+
58
+ assert_equal expected, @handler.description
59
+ assert_equal nil, @handler.url
60
+ end
61
+
62
+ def test_handle_alert
63
+ @handler.mail = util_mail :subject => "Your HSBC eStatement is ready to be viewed",
64
+ :body => <<-BODY
65
+ Dear ERIC,
66
+
67
+ Your September 20, 2007 HSBC statement for your HSBC Direct
68
+ Account ending: 6260 is now available online.
69
+ To view your eStatement, go to www.hsbcdirect.com, log-on via
70
+ "Account Access", and click on eStatements. Your online account
71
+ statement will be available for up to 12 months through HSBC Direct
72
+ Internet Banking.
73
+
74
+ If you have any questions, please call our
75
+ Customer Relationship Center at 1-888-404-4050. Representatives
76
+ are available to help you 24 hours a day, 7 days a week.
77
+
78
+ Thank you for growing your money with HSBC Direct.
79
+
80
+ Your HSBC Direct Customer Service Team
81
+ BODY
82
+
83
+ @handler.handle_alert
84
+
85
+ expected = <<-EXPECTED.strip
86
+ Your September 20, 2007 HSBC statement for your HSBC Direct \r
87
+ Account ending: 6260 is now available online. \r
88
+ To view your eStatement, go to www.hsbcdirect.com, log-on via \r
89
+ \"Account Access\", and click on eStatements. Your online account \r
90
+ statement will be available for up to 12 months through HSBC Direct \r
91
+ Internet Banking.
92
+ EXPECTED
93
+
94
+ assert_equal expected, @handler.description
95
+ assert_equal nil, @handler.url
96
+ end
97
+
98
+ def test_handle_hsbc
99
+ @handler.mail = util_mail :body => <<-BODY
100
+ Please add hsbc@email.hsbcusa.com to your address book
101
+ to ensure email delivery.
102
+
103
+ Dear Eric Hodel,
104
+
105
+ You requested to be notified when purchase exceeding a certain dollar amount
106
+ had posted to your HSBC Credit Card Account. The transactions described
107
+ below exceed that dollar amount.
108
+
109
+ Description: PURCHASE NAME
110
+
111
+ Amount: $ 0000000.00
112
+
113
+ You can log in to your Account to view
114
+ your recent transactions 24 hours a day at hsbccreditcard.com.
115
+
116
+ Thank you,
117
+
118
+
119
+ HSBC Credit Card Customer Care
120
+ BODY
121
+
122
+ @handler.handle_hsbc
123
+
124
+ expected = <<-EXPECTED
125
+ <p>Your purchase of PURCHASE NAME was for $0000000.00 which exceeds your
126
+ notification limit
127
+ EXPECTED
128
+
129
+ assert_equal expected, @handler.description
130
+ assert_equal nil, @handler.url
131
+ end
132
+
133
+ end
134
+
@@ -0,0 +1,104 @@
1
+ require 'imap_to_rss/test_case'
2
+
3
+ class IMAPToRSS::Handler::Itunes
4
+ attr_accessor :_mail
5
+
6
+ def each_message(a, b)
7
+ yield nil, @_mail
8
+ end
9
+ end
10
+
11
+ class TestIMAPToRSSHandlerItunes < IMAPToRSS::TestCase
12
+
13
+ def setup
14
+ super IMAPToRSS::Handler::Itunes.new
15
+ end
16
+
17
+ def test_handle
18
+ @handler._mail = util_mail :body => <<-BODY
19
+ Apple Receipt
20
+ -----------------------------------------------------------
21
+
22
+
23
+ Billed to:
24
+ nobody@example.com
25
+ Eric Hodel
26
+ 123 Any Street
27
+
28
+
29
+ Any Town, ZZ 00000
30
+
31
+
32
+
33
+ Order Number: A1BB22CCCC
34
+ Receipt Date: 01/02/03
35
+ Order Total: $2.18
36
+ Billed To: MasterCard .... 0000
37
+
38
+
39
+
40
+
41
+
42
+
43
+ Item Number Description Unit Price
44
+ -----------------------------------------------------------------------------------
45
+ 1 Ragdoll Blaster - A Physics Puzzler, v1.1, Seller: $1.99
46
+
47
+ -----------------------------------------------------------------------------------
48
+ Subtotal: $1.99
49
+
50
+ Tax: $0.19
51
+ -----------------------------------------------------------------------------------
52
+ Credit Card Total: $2.18
53
+ -----------------------------------------------------------------------------------
54
+ Order Total: $2.18
55
+
56
+
57
+ Please retain for your records.
58
+ Please See Below For Terms And Conditions Pertaining To This Order.
59
+
60
+
61
+ Apple Inc.
62
+ You can find the iTunes Store Terms of Sale and Sales Policies by launching your iTunes application and clicking on http://www.apple.com/legal/itunes/us/sales.html
63
+
64
+
65
+
66
+ Answers to frequently asked questions regarding the iTunes Store can be found at
67
+ http://www.apple.com/support/itunes/store/
68
+
69
+
70
+
71
+ Account Information: https://phobos.apple.com/WebObjects/MZFinance.woa/wa/accountSummary
72
+ Purchase History: https://phobos.apple.com/WebObjects/MZFinance.woa/wa/purchaseHistory
73
+
74
+ Apple respects your privacy.
75
+ Information regarding your personal information can be viewed at
76
+ http://www.apple.com/legal/privacy/
77
+
78
+ Copyright (C) 2008 Apple Inc. All rights reserved
79
+ http://www.apple.com/legal/
80
+ BODY
81
+
82
+ @handler.handle nil
83
+
84
+ refute_empty @itor.rss_items
85
+ item = @itor.rss_items.first
86
+
87
+ expected = <<-DESCRIPTION.strip
88
+ <table>
89
+ <tr><th>Item<th>Price
90
+ <tr><td>Ragdoll Blaster - A Physics Puzzler, v1.1, Seller:<td>$1.99
91
+ </table>
92
+ <p>Total: $2.18
93
+ DESCRIPTION
94
+
95
+ assert_equal 'iTunes Receipt #A1BB22CCCC, $2.18', item.title
96
+ assert_equal expected, item.description
97
+ assert_equal 'https://phobos.apple.com/WebObjects/MZFinance.woa/wa/purchaseHistory',
98
+ item.link
99
+ assert_equal 'iTunes', item.category
100
+
101
+ end
102
+
103
+ end
104
+
@@ -0,0 +1,72 @@
1
+ require 'imap_to_rss/test_case'
2
+
3
+ class IMAPToRSS::Handler::UPS
4
+ attr_accessor :_mail
5
+
6
+ def each_message(a, b)
7
+ yield nil, @_mail
8
+ end
9
+ end
10
+
11
+ class TestIMAPToRSSHandlerUPS < IMAPToRSS::TestCase
12
+ def setup
13
+ super IMAPToRSS::Handler::UPS.new
14
+ end
15
+
16
+ def test_handle
17
+ @handler._mail = util_mail :body => <<-BODY
18
+ ***Do not reply to this e-mail. UPS and NAME will not rec=
19
+ eive your reply.
20
+
21
+ This message was sent to you at the request of NAME to not=
22
+ ify you that the electronic shipment information below has been transmitted=
23
+ to UPS. The physical package(s) may or may not have actually been tendered=
24
+ to UPS for shipment. To verify the actual transit status of your shipment,=
25
+ click on the tracking link below to view the status of your request.
26
+
27
+
28
+ Important Delivery Information
29
+ _______________________________________________________________
30
+
31
+ Scheduled Delivery: 00-XXX-1111
32
+
33
+ Shipment Detail
34
+ _______________________________________________________________
35
+ Ship To:
36
+
37
+ Eric Hodel
38
+ 1234 Any Street
39
+ Any Town
40
+ ZZ
41
+ 00000
42
+ US
43
+
44
+ Number of Packages 1
45
+ UPS Service: GROUND
46
+ Weight: 3.0 LBS
47
+
48
+ Tracking Number: 1AAA22222222222222
49
+ Reference Number 1: 3333333
50
+ Reference Number 2: B444444
51
+
52
+ You can track your shipment by visiting http://wwwapps.ups.com/WebTracking/=
53
+ processRequest?HTMLVersion=3D5.0&Requester=3DNES&AgreeToTermsAndConditions=
54
+ =3Dyes&loc=3Den_US&tracknum=3D1AAA22222222222222 on the Internet.
55
+
56
+ _______________________________________________________________
57
+ BODY
58
+
59
+ @handler.handle nil
60
+
61
+ refute_empty @itor.rss_items
62
+ item = @itor.rss_items.first
63
+
64
+ url = 'http://wwwapps.ups.com/WebTracking/processRequest?tracknum=1AAA22222222222222'
65
+ desc = "Package shipped: <a href=\"#{url}\">1AAA22222222222222</a>"
66
+
67
+ assert_equal desc, item.description
68
+ assert_equal url, item.link
69
+ assert_equal 'UPS', item.category
70
+ end
71
+
72
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap_to_rss
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: "1.1"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -30,7 +30,7 @@ cert_chain:
30
30
  x52qPcexcYZR7w==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-05-18 00:00:00 -07:00
33
+ date: 2009-09-01 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -71,7 +71,7 @@ dependencies:
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 1.12.1
74
+ version: 2.3.3
75
75
  version:
76
76
  description: |-
77
77
  IMAPToRSS turns messages on an IMAP server into RSS entries when the match a
@@ -98,7 +98,13 @@ files:
98
98
  - lib/imap_to_rss/handler.rb
99
99
  - lib/imap_to_rss/handler/amazon.rb
100
100
  - lib/imap_to_rss/handler/hsbc.rb
101
+ - lib/imap_to_rss/handler/itunes.rb
101
102
  - lib/imap_to_rss/handler/ups.rb
103
+ - lib/imap_to_rss/test_case.rb
104
+ - test/test_imap_to_rss_handler_amazon.rb
105
+ - test/test_imap_to_rss_handler_hsbc.rb
106
+ - test/test_imap_to_rss_handler_itunes.rb
107
+ - test/test_imap_to_rss_handler_ups.rb
102
108
  has_rdoc: true
103
109
  homepage: http://seattlerb.rubyforge.org/imap_to_rss
104
110
  licenses: []
@@ -124,9 +130,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
130
  requirements: []
125
131
 
126
132
  rubyforge_project: seattlerb
127
- rubygems_version: 1.3.3
133
+ rubygems_version: 1.3.5
128
134
  signing_key:
129
135
  specification_version: 3
130
136
  summary: IMAPToRSS turns messages on an IMAP server into RSS entries when the match a handler
131
- test_files: []
132
-
137
+ test_files:
138
+ - test/test_imap_to_rss_handler_amazon.rb
139
+ - test/test_imap_to_rss_handler_hsbc.rb
140
+ - test/test_imap_to_rss_handler_itunes.rb
141
+ - test/test_imap_to_rss_handler_ups.rb
metadata.gz.sig CHANGED
Binary file