ficonabses 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/lib/ficonabses/base.rb +12 -2
- data/test/test_localhost.rb +3 -3
- data/test/test_localone.rb +29 -0
- data/test/test_smartroam.rb +33 -0
- metadata +5 -3
data/README.rdoc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
* http://github.com/semdinsp/ficonabses
|
4
4
|
|
5
|
-
==
|
5
|
+
== REASONABLY PRODUCTION READY:
|
6
6
|
== DESCRIPTION:
|
7
7
|
|
8
8
|
A simple way to send emails from your application using amazon ses. Register at admin.ses.sg.estormtech.com[http:admin.ses.sg.estormtech.com] to create your account. Templates can be emails or Apple Push Notifications. APNs require more configuration so please contact estormtech directly to implement this functionality but the same code will send either in your application.
|
@@ -68,7 +68,7 @@ A simple way to send emails from your application using amazon ses. Register at
|
|
68
68
|
|
69
69
|
(The MIT License)
|
70
70
|
|
71
|
-
Copyright (c) 2011
|
71
|
+
Copyright (c) 2011 Estorm Technologies Pte Ltd.
|
72
72
|
|
73
73
|
Permission is hereby granted, free of charge, to any person obtaining
|
74
74
|
a copy of this software and associated documentation files (the
|
data/lib/ficonabses/base.rb
CHANGED
@@ -51,7 +51,7 @@ module FiconabSES
|
|
51
51
|
def self.send_template_params_direct(account,password,destination,templatename,options={})
|
52
52
|
f=FiconabSES::Base.new
|
53
53
|
f.set_credentials(account,password)
|
54
|
-
f.
|
54
|
+
f.send_template_params(destination,templatename,options)
|
55
55
|
end
|
56
56
|
def perform(url)
|
57
57
|
@uri=URI.parse(url)
|
@@ -59,7 +59,7 @@ module FiconabSES
|
|
59
59
|
res=''
|
60
60
|
begin
|
61
61
|
# Don't take longer than 60 seconds -- incase there is a problem with our server continue
|
62
|
-
Timeout::timeout(
|
62
|
+
Timeout::timeout(90) do
|
63
63
|
@clnt=HTTPClient.new
|
64
64
|
@clnt.set_auth(nil, @account, @password)
|
65
65
|
@extheader = { 'Content-Type' => 'application/xml' }
|
@@ -89,6 +89,10 @@ module FiconabSES
|
|
89
89
|
url="#{self.action_url('ficonabcomplextemplate',destination)}&template=#{URI.encode(templatename)}&#{options.to_param}"
|
90
90
|
url
|
91
91
|
end
|
92
|
+
def campaign_flow_params(destination,templatename,options)
|
93
|
+
url="#{self.action_url('ficonabcampaignflow',destination)}&template=#{URI.encode(templatename)}&#{options.to_param}"
|
94
|
+
url
|
95
|
+
end
|
92
96
|
def html_url(destination,subject,contents,html)
|
93
97
|
contents='' if contents==nil
|
94
98
|
url="#{self.text_url(destination,subject,contents)}&html=#{URI.encode(html)}"
|
@@ -111,6 +115,12 @@ module FiconabSES
|
|
111
115
|
perform(url)
|
112
116
|
# res
|
113
117
|
end
|
118
|
+
def send_campaign_flow(destination,campaign_name,options={})
|
119
|
+
url=self.campaign_flow_params(destination,campaign_name,options)
|
120
|
+
puts "url is: #{url}"
|
121
|
+
perform(url)
|
122
|
+
# res
|
123
|
+
end
|
114
124
|
def send_htmlemail(destination,subject,htmlcontents,textcontents=nil)
|
115
125
|
textcontents='-' if textcontents==nil
|
116
126
|
url=self.html_url(destination,subject,textcontents,htmlcontents)
|
data/test/test_localhost.rb
CHANGED
@@ -30,7 +30,7 @@ class TestFiconabses < Test::Unit::TestCase
|
|
30
30
|
assert false==(res.include? 'Error')
|
31
31
|
end
|
32
32
|
def test_local_apn_template
|
33
|
-
res =@f.send_template(@tsipid,'
|
33
|
+
res =@f.send_template(@tsipid,'testApn') #no text portion
|
34
34
|
puts "RES is: #{res}"
|
35
35
|
assert res.include? '200'
|
36
36
|
assert false==(res.include? 'Error')
|
@@ -39,7 +39,7 @@ class TestFiconabses < Test::Unit::TestCase
|
|
39
39
|
def test_local_apn_template_params
|
40
40
|
options={}
|
41
41
|
options['hello']='TESTING'
|
42
|
-
res =@f.send_template_params(@tsipid,'
|
42
|
+
res =@f.send_template_params(@tsipid,'testApn',options) #no text portion
|
43
43
|
puts "RES is: #{res}"
|
44
44
|
assert res.include? '200'
|
45
45
|
assert false==(res.include? 'Error')
|
@@ -49,7 +49,7 @@ class TestFiconabses < Test::Unit::TestCase
|
|
49
49
|
options={}
|
50
50
|
options['hello']='TESTING'
|
51
51
|
options['bcinfo']='+6590683565'
|
52
|
-
res =@f.send_template_params(@tsipid,'
|
52
|
+
res =@f.send_template_params(@tsipid,'testApn',options) #no text portion
|
53
53
|
puts "RES is: #{res}"
|
54
54
|
assert res.include? '200'
|
55
55
|
assert false==(res.include? 'Error')
|
@@ -0,0 +1,29 @@
|
|
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('scott','scott123')
|
8
|
+
@f.set_debug
|
9
|
+
@destination='scott.sproule@gmail.com'
|
10
|
+
@tsipid ='7923044488'
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_local_send_text
|
14
|
+
res= @f.send_textemail(@destination,"'LOCALHOST': #{@f.host}",'contents of the email')
|
15
|
+
puts "RES is: #{res}"
|
16
|
+
assert res.include? '200'
|
17
|
+
assert false==(res.include? 'Error')
|
18
|
+
end
|
19
|
+
def test_local_apn_template_params
|
20
|
+
options={}
|
21
|
+
options['hello']='TESTING'
|
22
|
+
res =@f.send_template_params(@tsipid,'buycredit',options) #no text portion
|
23
|
+
puts "RES is: #{res}"
|
24
|
+
assert res.include? '200'
|
25
|
+
assert false==(res.include? 'Error')
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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
|
+
|
9
|
+
@destination='scott.sproule@gmail.com'
|
10
|
+
@tsipid ='7923044488'
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_local_smartroam_payg
|
14
|
+
res =@f.send_template(@destination,'payg_receipt') #no text portion
|
15
|
+
puts "RES is: #{res}"
|
16
|
+
assert res.include? '200'
|
17
|
+
assert false==(res.include? 'Error')
|
18
|
+
end
|
19
|
+
def test_local_ct_now_free
|
20
|
+
res =@f.send_template_params(@tsipid,'apn_ct_now_free_newapp',{'chattime_buddy'=>'testing'}) #no text portion
|
21
|
+
puts "RES is: #{res}"
|
22
|
+
assert res.include? '200'
|
23
|
+
assert false==(res.include? 'Error')
|
24
|
+
end
|
25
|
+
def test_local_smartroam_payg_params
|
26
|
+
res =@f.send_template_params(@destination,'payg_receipt',{'mgm_link'=>'testing'}) #no text portion
|
27
|
+
puts "RES is: #{res}"
|
28
|
+
assert res.include? '200'
|
29
|
+
assert false==(res.include? 'Error')
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 8
|
9
|
+
version: 0.1.8
|
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:
|
17
|
+
date: 2012-01-19 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -33,7 +33,9 @@ files:
|
|
33
33
|
- test/test_hashparams.rb
|
34
34
|
- test/test_helper.rb
|
35
35
|
- test/test_localhost.rb
|
36
|
+
- test/test_localone.rb
|
36
37
|
- test/test_secret.rb
|
38
|
+
- test/test_smartroam.rb
|
37
39
|
- test/test_templates.rb
|
38
40
|
- History.txt
|
39
41
|
- Manifest.txt
|