mad_mimi_two 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mad_mimi_two/mad_mimi_mailer.rb +9 -2
- data/test/test_mad_mimi_two.rb +7 -1
- metadata +2 -2
@@ -23,12 +23,19 @@ module MadMimiTwo
|
|
23
23
|
end
|
24
24
|
# send http get url via http client wrapped with exception rescue code
|
25
25
|
def send_cmd(url)
|
26
|
+
flag=true
|
27
|
+
|
26
28
|
begin
|
27
29
|
client= HTTPClient.new
|
28
|
-
client.receive_timeout(
|
30
|
+
client.receive_timeout(100)
|
29
31
|
res=client.get_content(url)
|
32
|
+
|
30
33
|
rescue HTTPClient::BadResponseError
|
31
34
|
res="problem retrieving status: #{res.inspect}"
|
35
|
+
rescue HTTPClient::ReceiveTimeoutError
|
36
|
+
res="problem retrieving status: #{res.inspect}"
|
37
|
+
res=client.get_content(url) if flag
|
38
|
+
flag=false
|
32
39
|
end
|
33
40
|
res
|
34
41
|
end
|
@@ -71,7 +78,7 @@ module MadMimiTwo
|
|
71
78
|
end
|
72
79
|
def get_promotions
|
73
80
|
res={'select promotion'=>'select promotion'}
|
74
|
-
1.upto(
|
81
|
+
1.upto(7) { |i| #only up to three pages now
|
75
82
|
tmp=get_promotions_internal(i)
|
76
83
|
puts "i is #{i} tmp size is #{tmp.size}"
|
77
84
|
break if tmp.empty?
|
data/test/test_mad_mimi_two.rb
CHANGED
@@ -80,9 +80,15 @@ class TestMadMimiTwo < Test::Unit::TestCase
|
|
80
80
|
# puts "message id: 1159748168" (old message id) PUT IN ONE OF YOUR MESSAGE IDs to check
|
81
81
|
t=MadMimiTwo::MadMimiMessage.new
|
82
82
|
r=t.check_status('1159748168')
|
83
|
-
puts "'
|
83
|
+
puts "'check status is ' #{r}"
|
84
84
|
assert r.class==String, "response is not string r is: #{r} #{r.class}"
|
85
85
|
assert r=='sent', "message response not correct: #{r}"
|
86
86
|
|
87
87
|
end
|
88
|
+
def test_promos
|
89
|
+
t=MadMimiTwo::MadMimiMessage.new
|
90
|
+
r=t.get_promotions()
|
91
|
+
puts "get promos #{r}"
|
92
|
+
assert r!=nil, "r is nil"
|
93
|
+
end
|
88
94
|
end
|