ficonabses 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ficonabses/base.rb +16 -3
- data/test/test_localone.rb +17 -7
- metadata +3 -3
data/lib/ficonabses/base.rb
CHANGED
@@ -65,6 +65,7 @@ module FiconabSES
|
|
65
65
|
end
|
66
66
|
def perform(url)
|
67
67
|
@uri=URI.parse(url)
|
68
|
+
# puts "url is #{url}"
|
68
69
|
raise 'credentials not set' if @account==nil
|
69
70
|
res=''
|
70
71
|
begin
|
@@ -76,6 +77,8 @@ module FiconabSES
|
|
76
77
|
res=self.clnt.get_content(self.uri,self.extheader)
|
77
78
|
end
|
78
79
|
rescue Timeout::Error,HTTPClient::BadResponseError
|
80
|
+
|
81
|
+
# puts "res is #{res.inspect}"
|
79
82
|
res='bad response or timeout'
|
80
83
|
puts "BAD RESPONSE or Timeout - retrying once #{self.uri} after five seconds"
|
81
84
|
sleep(5) # take a break to see if it is too busy
|
@@ -104,6 +107,10 @@ module FiconabSES
|
|
104
107
|
url="#{self.action_url('ficonabaction',destination)}&type=globalunsubscribe&user=#{URI.encode(username)}"
|
105
108
|
url
|
106
109
|
end
|
110
|
+
def get_template_list_url(destination,username)
|
111
|
+
url="#{self.action_url('ficonabaction',destination)}&type=gettemplates&user=#{URI.encode(username)}"
|
112
|
+
url
|
113
|
+
end
|
107
114
|
def template_url(destination,templatename)
|
108
115
|
url="#{self.action_url('ficonabsimpletemplate',destination)}&template=#{URI.encode(templatename)}"
|
109
116
|
url
|
@@ -134,19 +141,25 @@ module FiconabSES
|
|
134
141
|
end
|
135
142
|
def send_template_params(destination,templatename,options={})
|
136
143
|
url=self.template_url_params(destination,templatename,options)
|
137
|
-
|
144
|
+
# puts "url is: #{url}"
|
138
145
|
perform(url)
|
139
146
|
# res
|
140
147
|
end
|
141
148
|
def global_blacklist(destination,username)
|
142
149
|
url=self.global_blacklist_url(destination,username)
|
143
|
-
|
150
|
+
# puts "url is: #{url}"
|
144
151
|
perform(url)
|
145
152
|
# res
|
146
153
|
end
|
154
|
+
def get_template_list(destination,username)
|
155
|
+
url=self.get_template_list_url(destination,username)
|
156
|
+
# puts "url is: #{url}"
|
157
|
+
perform(url)
|
158
|
+
# res
|
159
|
+
end
|
147
160
|
def send_campaign_flow(destination,campaign_name,options={})
|
148
161
|
url=self.campaign_flow_params(destination,campaign_name,options)
|
149
|
-
|
162
|
+
# puts "url is: #{url}"
|
150
163
|
perform(url)
|
151
164
|
# res
|
152
165
|
end
|
data/test/test_localone.rb
CHANGED
@@ -20,21 +20,31 @@ class TestFiconabses < Test::Unit::TestCase
|
|
20
20
|
|
21
21
|
end
|
22
22
|
def test_global_blacklist_adding
|
23
|
-
|
24
|
-
options['hello']='TESTING'
|
23
|
+
|
25
24
|
res =@f.global_blacklist(@destination,'scott') #no text portion
|
26
|
-
puts "RES is: #{res}"
|
25
|
+
puts "GLOBAL BLACK LIST RES is: #{res}"
|
27
26
|
assert res.include? 'successfully'
|
28
|
-
|
27
|
+
assert false==(res.include? 'Error')
|
29
28
|
|
30
29
|
end
|
30
|
+
|
31
|
+
def test_get_template_list
|
32
|
+
puts "GET TEMPALTE LIST"
|
33
|
+
|
34
|
+
res =@f.get_template_list(@destination,'scott') #no text portion
|
35
|
+
puts "RES is: #{res}"
|
36
|
+
assert res.include? 'testtemplate'
|
37
|
+
assert false==(res.include? 'Error')
|
38
|
+
|
39
|
+
end
|
31
40
|
def test_local_blacklist
|
32
|
-
|
33
|
-
|
34
|
-
res =@f.send_template_params(
|
41
|
+
# assert_raise HTTPClient::BadResponse do
|
42
|
+
options={}
|
43
|
+
res =@f.send_template_params('blacklist','testblacklist',options) #no text portion
|
35
44
|
puts "RES is: #{res}"
|
36
45
|
assert res.include? '200'
|
37
46
|
assert false==(res.include? 'Error')
|
47
|
+
# end
|
38
48
|
|
39
49
|
end
|
40
50
|
def test_global_blacklist
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 6
|
9
|
+
version: 0.3.6
|
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-05-
|
17
|
+
date: 2012-05-06 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|