mad_mimi_two 0.5.3 → 0.5.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/History.txt +2 -2
- data/README.rdoc +2 -0
- data/bin/send_mimi.rb +46 -0
- data/lib/mad_mimi_two/mad_mimi_mailer.rb +1 -1
- data/lib/mad_mimi_two/mad_mimi_message.rb +1 -3
- data/lib/mad_mimi_two/support.rb +70 -0
- metadata +7 -5
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -24,12 +24,14 @@ Currently tested and working with rails 3 beta and Rails 2 (same code works)
|
|
24
24
|
== SYNOPSIS:
|
25
25
|
== API CONFIG
|
26
26
|
Setup your api key in application.rb (at the end of the file, after the end for the config)
|
27
|
+
require 'mad_mimi_two' #not certain why this is needed...sigh.
|
27
28
|
MadMimiTwo::MadMimiMessage.api_settings = {
|
28
29
|
:username => 'your_username@xys.com',
|
29
30
|
:api_key => 'your api key'
|
30
31
|
}
|
31
32
|
|
32
33
|
== GEMFILE:
|
34
|
+
gem 'httpclient'
|
33
35
|
gem 'mad_mimi_two'
|
34
36
|
|
35
37
|
== MIMI MODEL
|
data/bin/send_mimi.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# == Synopsis
|
3
|
+
# send mad mimi email
|
4
|
+
# == Usage
|
5
|
+
# send_mimi.rb -e email -p promotion -k key -u mimiusername -h hashvalues -s subject
|
6
|
+
# == Author
|
7
|
+
# Scott Sproule --- Ficonab.com (scott.sproule@ficonab.com)
|
8
|
+
# == Example
|
9
|
+
# send_mimi.rb -e xxxx@ficonab.com -p new_crm -k xxxx -u xxxx@estormtech.com -s testing -h "{:user => 'test', :url => 'test.estormtech.com' }"
|
10
|
+
# == Copyright
|
11
|
+
# Copyright (c) 2010 Ficonab Pte. Ltd.
|
12
|
+
# See license for license details
|
13
|
+
require 'yaml'
|
14
|
+
require 'rubygems'
|
15
|
+
gem 'mad_mimi_two'
|
16
|
+
require 'mad_mimi_two'
|
17
|
+
require 'optparse'
|
18
|
+
require 'rdoc/usage'
|
19
|
+
#require 'java' if RUBY_PLATFORM =~ /java/
|
20
|
+
# start the processing
|
21
|
+
arg_hash=MadMimiTwo::Options.parse_options(ARGV)
|
22
|
+
RDoc::usage if arg_hash[:help]==true
|
23
|
+
require 'pp'
|
24
|
+
|
25
|
+
options = arg_hash
|
26
|
+
# set up variables using hash
|
27
|
+
# note the strange spacing needed to put the ' in the string
|
28
|
+
MadMimiTwo::MadMimiMessage.api_settings = {
|
29
|
+
:username => options[:username].to_s,
|
30
|
+
:api_key => options[:key].to_s
|
31
|
+
}
|
32
|
+
thash=eval(options[:hashvalues]) # THIS IS KLUDGE expecting ruby String like "{:user => 'test', :url => 'test.estormtech.com' }"
|
33
|
+
t=MadMimiTwo::MadMimiMessage.new do
|
34
|
+
subject options[:subject]
|
35
|
+
to options[:email]
|
36
|
+
# cc admin
|
37
|
+
promotion options[:promotion]
|
38
|
+
from options[:from] || 'support@estormtech.com'
|
39
|
+
bcc ["scott.sproule@estormtech.com"]
|
40
|
+
# sent_on Time.now
|
41
|
+
email_placeholders thash # :user => tuser, :url => turl
|
42
|
+
content_type "text/html"
|
43
|
+
end
|
44
|
+
# t.email_placeholders(thash)
|
45
|
+
r=t.deliver_mimi_message
|
46
|
+
puts r
|
@@ -97,7 +97,7 @@ module MadMimiTwo
|
|
97
97
|
'hidden' => serialize(self.hidden)
|
98
98
|
}
|
99
99
|
params['body']= self.email_placeholders.to_yaml
|
100
|
-
puts "params: #{params.inspect} to string #{params.to_s}"
|
100
|
+
# puts "params: #{params.inspect} to string #{params.to_s}"
|
101
101
|
#scott params['unconfirmed'] = '1' if mail.unconfirmed
|
102
102
|
|
103
103
|
#scott) if use_erb?(mail)
|
@@ -2,15 +2,13 @@ require 'rubygems'
|
|
2
2
|
gem 'mail'
|
3
3
|
require "mail"
|
4
4
|
require "net/https"
|
5
|
-
require '
|
5
|
+
require 'mad_mimi_mailer'
|
6
6
|
gem 'activesupport'
|
7
7
|
require 'active_support/core_ext/class/attribute_accessors'
|
8
8
|
|
9
9
|
|
10
10
|
module MadMimiTwo
|
11
11
|
class MadMimiMessage < Mail::Message
|
12
|
-
|
13
|
-
|
14
12
|
@@api_settings = {}
|
15
13
|
cattr_accessor :api_settings
|
16
14
|
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'rdoc/usage'
|
3
|
+
|
4
|
+
|
5
|
+
module MadMimiTwo
|
6
|
+
class Options
|
7
|
+
def self.parse_options(params)
|
8
|
+
opts = OptionParser.new
|
9
|
+
# puts "argv are #{params}"
|
10
|
+
temp_hash = {}
|
11
|
+
opts.on("-u","--username VAL", String) {|val| temp_hash[:username] = val
|
12
|
+
puts "# username is #{val}" }
|
13
|
+
opts.on("-e","--email VAL", String) {|val| temp_hash[:email] = val
|
14
|
+
puts "# email is #{temp_hash[:email]}" }
|
15
|
+
opts.on("-h","--hashvalues VAL", String) {|val| temp_hash[:hashvalues] = val
|
16
|
+
puts "# hashvalues are #{temp_hash[:hashvalues]}" }
|
17
|
+
opts.on("-p","--promotion VAL", String) {|val|
|
18
|
+
temp_hash[:promotion] = val
|
19
|
+
puts "# promotion is #{temp_hash[:promotion]}" }
|
20
|
+
opts.on("-f","--from VAL", String) {|val|
|
21
|
+
temp_hash[:from] = val
|
22
|
+
puts "# from is #{val}" }
|
23
|
+
opts.on("-s","--subject VAL", String) {|val|
|
24
|
+
temp_hash[:subject] = val
|
25
|
+
puts "# subject is #{val}" }
|
26
|
+
opts.on("-d","--debug", "turn on debug") { |val| temp_hash[:debug ] = true }
|
27
|
+
opts.on("-k","--key VAL", String) { |val| temp_hash[:key ] = val
|
28
|
+
puts "# api key #{temp_hash[:key]}" }
|
29
|
+
opts.on("-H","--help", "get help message") { |val| temp_hash[:help ] = true }
|
30
|
+
|
31
|
+
opts.parse(params)
|
32
|
+
# puts " in HTTP #{hostname} port #{port} url: #{url}"
|
33
|
+
|
34
|
+
return temp_hash
|
35
|
+
|
36
|
+
end # parse options
|
37
|
+
end #class
|
38
|
+
# help build xml commands from messages
|
39
|
+
|
40
|
+
end #module
|
41
|
+
|
42
|
+
def RDoc.usage_no_exit(*args)
|
43
|
+
# main_program_file = caller[1].sub(/:\d+$/, '')
|
44
|
+
main_program_file = caller[1].split(':')[0]
|
45
|
+
#puts "main program is #{main_program_file}"
|
46
|
+
# puts " caller is #{caller.inspect}"
|
47
|
+
comment = File.open(main_program_file) do |file|
|
48
|
+
find_comment(file)
|
49
|
+
end
|
50
|
+
|
51
|
+
comment = comment.gsub(/^\s*#/, '')
|
52
|
+
|
53
|
+
markup = SM::SimpleMarkup.new
|
54
|
+
flow_convertor = SM::ToFlow.new
|
55
|
+
|
56
|
+
flow = markup.convert(comment, flow_convertor)
|
57
|
+
|
58
|
+
format = "plain"
|
59
|
+
|
60
|
+
unless args.empty?
|
61
|
+
flow = extract_sections(flow, args)
|
62
|
+
end
|
63
|
+
|
64
|
+
options = RI::Options.instance
|
65
|
+
if args = ENV["RI"]
|
66
|
+
options.parse(args.split)
|
67
|
+
end
|
68
|
+
formatter = options.formatter.new(options, "")
|
69
|
+
formatter.display_flow(flow)
|
70
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mad_mimi_two
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 5
|
10
|
+
version: 0.5.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- scott sproule
|
@@ -56,8 +56,8 @@ description: |-
|
|
56
56
|
All of the terrible stuff is by me. Apologies for taking an elegant solution and just crafting something that works.
|
57
57
|
email:
|
58
58
|
- scott.sproule@ficonab.com
|
59
|
-
executables:
|
60
|
-
|
59
|
+
executables:
|
60
|
+
- send_mimi.rb
|
61
61
|
extensions: []
|
62
62
|
|
63
63
|
extra_rdoc_files:
|
@@ -73,11 +73,13 @@ files:
|
|
73
73
|
- lib/mad_mimi_two.rb
|
74
74
|
- lib/mad_mimi_two/mad_mimi_mailer.rb
|
75
75
|
- lib/mad_mimi_two/mad_mimi_message.rb
|
76
|
+
- lib/mad_mimi_two/support.rb
|
76
77
|
- script/console
|
77
78
|
- script/destroy
|
78
79
|
- script/generate
|
79
80
|
- test/test_helper.rb
|
80
81
|
- test/test_mad_mimi_two.rb
|
82
|
+
- bin/send_mimi.rb
|
81
83
|
has_rdoc: true
|
82
84
|
homepage: http://github.com/semdinsp/mad_mimi_two
|
83
85
|
licenses: []
|