ficonabses 0.2.4 → 0.2.5

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 CHANGED
@@ -40,7 +40,7 @@ A simple way to send emails from your application using amazon ses. Register at
40
40
  res =f.send_template(@destination,'testtemplate')
41
41
 
42
42
  == SYNOPSIS USING A TEMPLATE PLUS PARAMETERS
43
- * This allows you to have a dynamic template and fill in the details in the template dynamically. (eg insert url, customer name) into the template just by attaching the values to the call in a ruby hash.
43
+ * This allows you to have a dynamic template and fill in the details in the template dynamically. (eg insert url, customer name) into the template just by attaching the values to the call in a ruby hash. If the destination is part of a black list you will receive HTTP Status code 412 (precondition failed)
44
44
 
45
45
  * res =FiconabSES::Base.send_template_params_direct(@account,@passwd,@destination,templatename,options)
46
46
  * or similarly using objects
@@ -59,7 +59,11 @@ A simple way to send emails from your application using amazon ses. Register at
59
59
 
60
60
  ==BINARY FILES
61
61
  * ficonabses_template_test.rb - Send a template to a destination. Type 'ficonabses_template_test.rb --help' in a terminal on your cmpueter for more information
62
- * fionabses_csv.rb - Send the contents of csv file to the system. The file should be in destination,templatename,param1,params2 format with headers.
62
+ * fionabses_csv.rb - Send the contents of csv file to the system for email broadcash. The file should be in destination,templatename,param1,params2 format with headers. A sample file follows:
63
+ sample file:
64
+ * destination,template,param1,receipt
65
+ * scott.sproule@estormtech.com,testtemplate,test,test2
66
+ * eka.mardiarti@estormtech.com,testtemplate,test,test2
63
67
 
64
68
 
65
69
  == REQUIREMENTS:
@@ -77,6 +81,8 @@ A simple way to send emails from your application using amazon ses. Register at
77
81
  == TESTS
78
82
  * See the tests files attached to the gem or on this website
79
83
 
84
+ == CAVEATS
85
+ * The parameters need to be passed in as a hash as the code relies on it being a hash to build the URL string.
80
86
  == LICENSE:
81
87
 
82
88
  (The MIT License)
@@ -4,8 +4,10 @@ usage=<<EOF_USAGE
4
4
  # == Synopsis
5
5
  # read a csv file and send through FiconabSES
6
6
  # == Usage
7
- # ficonabses_csv.rb -u username -p password -f csvfile.name
7
+ # ficonabses_csv.rb -u username -p password -f csvfile.name -C
8
8
  # csv file needs to be in the format (including headers) with destination, template, asmanyparameters as needed separated by commas
9
+ # -C sends campaignflow
10
+ # For campaigns csv file needs to be in the format (including headers) with destination, campaign, asmanyparameters as needed separated by commas
9
11
  # == Author
10
12
  # Scott Sproule --- Ficonab.com (scott.sproule@ficonab.com)
11
13
  # == Example
@@ -24,12 +26,18 @@ require 'ficonabses'
24
26
  require 'optparse'
25
27
  #require 'java' if RUBY_PLATFORM =~ /java/
26
28
  # start the processing
27
- def send_row(ficonab,row)
29
+ def send_row(ficonab,row,flag)
30
+ #puts "row destination: #{row['destination']} template: #{row['template']} campaign: #{row['campaign']} campaign flag: #{flag}"
28
31
  row['destination'].strip!
29
- row['template'].strip!
32
+ row['campaign'].strip! if flag
33
+ row['template'].strip! if !flag
30
34
  sleep(1)
31
- res =ficonab.send_template_params(row['destination'],row['template'],row) if row['row']!=''
32
-
35
+ if row!=nil then
36
+
37
+ res =ficonab.send_template_params(row['destination'],row['template'],row) if !flag
38
+ res =ficonab.send_campaign_flow(row['destination'],row['campaign'],row) if flag
39
+ end
40
+ res
33
41
  end
34
42
 
35
43
  def readfile(filename)
@@ -47,6 +55,8 @@ require 'pp'
47
55
  @f.set_credentials(options[:username],options[:password])
48
56
  @f.set_debug if options[:debug] # if debug sends to localhost
49
57
  count=0
58
+ flag=false
59
+ flag=options[:campaign] if options[:campaign]
50
60
  #send_template(options[:template],'7923044488','scott.sproule@gmail.com',count+=1)
51
61
  rows=readfile(options[:filename])
52
62
  rows.each {|row|
@@ -54,7 +64,7 @@ require 'pp'
54
64
  begin
55
65
  hash={}
56
66
  hash=hash.merge row
57
- res=send_row(@f,hash)
67
+ res=send_row(@f,hash.clone,flag)
58
68
  puts "COUNT: #{count} result: #{res} row: #{hash} "
59
69
  count+=1
60
70
 
@@ -31,7 +31,7 @@ require 'pp'
31
31
  @f=FiconabSES::Base.new
32
32
  @f.set_credentials(options[:username],options[:password])
33
33
  @f.set_debug if options[:debug] # if debug sends to localhost
34
- res =@f.send_template_params(options[:destination],options[:template],{})
34
+ res =@f.send_template_params(options[:destination],options[:template],{})
35
35
 
36
36
  # puts "response is list is #{list.to_yaml} #{finallist.to_yaml}"
37
37
  puts "[#{Time.now}] FINISHED: result is: #{res}"
@@ -15,7 +15,7 @@ module FiconabSES
15
15
  backtrace=backtrace.join("\n").to_s if backtrace.class!=String
16
16
  length=[3800,backtrace.size].min
17
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}"
18
+ message= "EXCEPTION:\n#{exception.inspect.to_s}\nTIME:\n\n#{Time.now}\nOTHER:\n#{other.to_s}\n\nBACKTRACE:\n\n#{backtrace.to_s}"
19
19
  res =ficonab_obj.send_textemail(tolist,subj.to_s,message)
20
20
  rescue Exception => e
21
21
  puts "Exception in send exception..OOOPS! #{e.message} #{e.backtrace}"
@@ -22,6 +22,7 @@ module FiconabSES
22
22
  # opts.on("-s","--start VAL", Integer) {|val| temp_hash[:start] = val
23
23
  # puts "# start mapping is #{temp_hash[:start]}" }
24
24
  opts.on("-D","--debug", "turn on debug") { |val| temp_hash[:debug ] = true }
25
+ opts.on("-C","--campaign_flow", "turn on campaign flow") { |val| temp_hash[:campaign] = true }
25
26
 
26
27
  opts.on("-t","--template VAL", String) { |val| temp_hash[:template] = val
27
28
  puts "# tsipid key #{temp_hash[:template]}" }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 4
9
- version: 0.2.4
8
+ - 5
9
+ version: 0.2.5
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-02-18 00:00:00 +08:00
17
+ date: 2012-03-01 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20