ficonabses 0.2.1 → 0.2.2
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/README.rdoc +10 -1
- data/bin/ficonabses_template_test.rb +0 -0
- data/lib/ficonabses/addons.rb +30 -0
- data/test/test_localhost.rb +6 -0
- data/test/test_localone.rb +34 -6
- data/test/test_smartroam.rb +12 -0
- data/test/test_smartroam2.rb +25 -0
- metadata +6 -3
data/README.rdoc
CHANGED
@@ -9,7 +9,7 @@ A simple way to send emails from your application using amazon ses. Register at
|
|
9
9
|
|
10
10
|
== FEATURES/PROBLEMS:
|
11
11
|
|
12
|
-
* A simple way to send text and html emails from your application. Templates for the contents of the email can be configured at admin.ses.sg.estormtech.com[http:admin.ses.sg.estormtech.com]
|
12
|
+
* A simple way to send text and html emails from your application. Templates for the contents of the email can be configured at admin.ses.sg.estormtech.com[http:admin.ses.sg.estormtech.com].
|
13
13
|
|
14
14
|
* You can send spontaneous emails directly in your code. Or more elegantly you can set up a template on the system and send it with contents inserted in the parameters of the call. That way you can change the template (eg have a different design for Halloween or Eid or Christmas) while not touching your production code.
|
15
15
|
|
@@ -50,10 +50,19 @@ A simple way to send emails from your application using amazon ses. Register at
|
|
50
50
|
f.set_credentials(@account,@passwd,options)
|
51
51
|
res =f.send_template(@destination,'testtemplate')
|
52
52
|
|
53
|
+
== SYNOPSIS SENDING RUBY EXCEPTION
|
54
|
+
* This allows you mail a ruby exception report directly from your application.
|
55
|
+
* res =FiconabSES::Addons.send_exception_direct(@account,@passwd,@destination,exception)
|
56
|
+
|
57
|
+
== CAMPAIGN FLOWS
|
58
|
+
* This allows you structure a sequence of emails/customer interaction based on parameters. (eg you could email the customer something and send them an apple push notification at the same time)
|
59
|
+
|
60
|
+
|
53
61
|
== REQUIREMENTS:
|
54
62
|
|
55
63
|
* httpclient gem and ses.sg.estormtech.com is up and you have an account/password at admin.ses.sg.estormtech.com.
|
56
64
|
|
65
|
+
|
57
66
|
== INSTALL:
|
58
67
|
|
59
68
|
* sudo gem install ficonabses httpclient
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module FiconabSES
|
2
|
+
class Addons
|
3
|
+
def self.send_exception_direct(account,password,destination,exception)
|
4
|
+
f=FiconabSES::Base.new
|
5
|
+
f.set_credentials(account,password)
|
6
|
+
FiconabSES::Addons.send_ruby_exception(f,exception,destination,nil)
|
7
|
+
end
|
8
|
+
def self.send_ruby_exception(ficonab_obj,exception,tolist, other, cclist=[],prefix2='[Exception]')
|
9
|
+
begin
|
10
|
+
backtrace=exception.backtrace|| 'No backtrace available'
|
11
|
+
puts "backtrace is #{backtrace}"
|
12
|
+
other=other.to_s||'no additional data'
|
13
|
+
prefix = "#{prefix2}"
|
14
|
+
subj = "#{prefix2} (#{exception.class}) #{exception.message.inspect}"
|
15
|
+
backtrace=backtrace.join("\n").to_s if backtrace.class!=String
|
16
|
+
length=[3800,backtrace.size].min
|
17
|
+
backtrace=backtrace.to_s[0..length-1]
|
18
|
+
message= "EXCEPTION:\n#{exception.inspect.to_s}\nTime:\n#{Time.now}\nOTHER:\n#{other.to_s}\n\nBACKTRACE:\n\n#{backtrace.to_s}"
|
19
|
+
res =ficonab_obj.send_textemail(tolist,subj.to_s,message)
|
20
|
+
rescue Exception => e
|
21
|
+
puts "Exception in send exception..OOOPS! #{e.message} #{e.backtrace}"
|
22
|
+
ensure
|
23
|
+
# puts "in ensure"
|
24
|
+
res=nil
|
25
|
+
message=nil
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end #class
|
30
|
+
end #module
|
data/test/test_localhost.rb
CHANGED
@@ -35,6 +35,12 @@ class TestFiconabses < Test::Unit::TestCase
|
|
35
35
|
assert res.include? '200'
|
36
36
|
assert false==(res.include? 'Error')
|
37
37
|
end
|
38
|
+
def test_exception_addons
|
39
|
+
e=Exception.new
|
40
|
+
res= FiconabSES::Addons.send_ruby_exception(@f,e,'scott.sproule@estormtech.com', nil)
|
41
|
+
assert res.include? '200'
|
42
|
+
end
|
43
|
+
|
38
44
|
|
39
45
|
def test_local_apn_template_params
|
40
46
|
options={}
|
data/test/test_localone.rb
CHANGED
@@ -10,12 +10,40 @@ class TestFiconabses < Test::Unit::TestCase
|
|
10
10
|
@tsipid ='7923044488'
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
#
|
18
|
-
|
13
|
+
def test_local_apn_template_params
|
14
|
+
options={}
|
15
|
+
options['hello']='TESTING'
|
16
|
+
res =@f.send_template_params(@tsipid,'testApn',options) #no text portion
|
17
|
+
puts "RES is: #{res}"
|
18
|
+
assert res.include? '200'
|
19
|
+
assert false==(res.include? 'Error')
|
20
|
+
|
21
|
+
end
|
22
|
+
def test_local_blacklisturl
|
23
|
+
options={}
|
24
|
+
options['hello']='TESTING'
|
25
|
+
res =@f.send_template_params(@destination,'testblacklist',options) #no text portion
|
26
|
+
puts "RES is: #{res}"
|
27
|
+
assert res.include? '200'
|
28
|
+
assert false==(res.include? 'Error')
|
29
|
+
|
30
|
+
end
|
31
|
+
def test_global_blacklisturl
|
32
|
+
options={}
|
33
|
+
options['hello']='TESTING'
|
34
|
+
res =@f.send_template_params('blacklist','testblacklist',options) #no text portion
|
35
|
+
puts "RES is: #{res}"
|
36
|
+
assert res.include? 'Global'
|
37
|
+
assert false==(res.include? '200')
|
38
|
+
|
39
|
+
end
|
40
|
+
def test_local_send_text
|
41
|
+
res= @f.send_textemail(@destination,"'LOCALHOST': #{@f.host}",'contents of the email')
|
42
|
+
puts "RES is: #{res}"
|
43
|
+
assert res.include? '200'
|
44
|
+
assert false==(res.include? 'Error')
|
45
|
+
end
|
46
|
+
|
19
47
|
def test_local_campaign_flow
|
20
48
|
options={}
|
21
49
|
options['hello']='TESTING'
|
data/test/test_smartroam.rb
CHANGED
@@ -28,6 +28,18 @@ class TestFiconabses < Test::Unit::TestCase
|
|
28
28
|
assert res.include? '200'
|
29
29
|
assert false==(res.include? 'Error')
|
30
30
|
end
|
31
|
+
def test_smartroam_mgm_introduction
|
32
|
+
res =@f.send_template_params(@destination,'mgm_introduction',{'mgm_link'=>'testing'}) #no text portion
|
33
|
+
puts "RES is: #{res}"
|
34
|
+
assert res.include? '200'
|
35
|
+
assert false==(res.include? 'Error')
|
36
|
+
end
|
37
|
+
def test_smartroam_account_info
|
38
|
+
res =@f.send_template_params(@destination,'account_info_chattime',{'mgm_link'=>'testing'}) #no text portion
|
39
|
+
puts "RES is: #{res}"
|
40
|
+
assert res.include? '200'
|
41
|
+
assert false==(res.include? 'Error')
|
42
|
+
end
|
31
43
|
|
32
44
|
|
33
45
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestFiconabses < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@f=FiconabSES::Base.new
|
7
|
+
@f.set_credentials('smartroam','smartroam123')
|
8
|
+
@destination='scott.sproule@gmail.com'
|
9
|
+
@tsipid ='7923044488'
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_smartroam_account_info
|
13
|
+
res =@f.send_template_params(@destination,'account_info_chattime',{'mgm_link'=>'testing'}) #no text portion
|
14
|
+
puts "RES is: #{res}"
|
15
|
+
assert res.include? '200'
|
16
|
+
assert false==(res.include? 'Error')
|
17
|
+
end
|
18
|
+
def test_smartroam_account_info_mgm
|
19
|
+
res =@f.send_template_params(@destination,'account_info_chattime_mgm_us',{'mgm_link'=>'testing'}) #no text portion
|
20
|
+
puts "RES is: #{res}"
|
21
|
+
assert res.include? '200'
|
22
|
+
assert false==(res.include? 'Error')
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Scott Sproule
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-
|
17
|
+
date: 2012-02-16 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -27,6 +27,7 @@ extensions: []
|
|
27
27
|
extra_rdoc_files: []
|
28
28
|
|
29
29
|
files:
|
30
|
+
- lib/ficonabses/addons.rb
|
30
31
|
- lib/ficonabses/base.rb
|
31
32
|
- lib/ficonabses.rb
|
32
33
|
- test/test_ficonabses.rb
|
@@ -36,7 +37,9 @@ files:
|
|
36
37
|
- test/test_localone.rb
|
37
38
|
- test/test_secret.rb
|
38
39
|
- test/test_smartroam.rb
|
40
|
+
- test/test_smartroam2.rb
|
39
41
|
- test/test_templates.rb
|
42
|
+
- bin/ficonabses_template_test.rb
|
40
43
|
- History.txt
|
41
44
|
- Manifest.txt
|
42
45
|
- PostInstall.txt
|