ficonabses 0.1.0

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 ADDED
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2011-11-13
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,12 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/ficonabses.rb
7
+ lib/ficonabses/base.rb
8
+ script/console
9
+ script/destroy
10
+ script/generate
11
+ test/test_ficonabses.rb
12
+ test/test_helper.rb
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on ficonabses, see http://ficonabses.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.rdoc ADDED
@@ -0,0 +1,48 @@
1
+ = ficonabses
2
+
3
+ * http://github.com/semdinsp/ficonabses
4
+
5
+ == DESCRIPTION:
6
+
7
+ A simple way to send emails from your application using amazon ses. Register at admin.ses.sg.estormtech.com to create your account.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2011 FIXME full name
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/ficonabses'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'ficonabses' do
14
+ self.developer 'scott sproule', 'scott.sproule@estormtech.com'
15
+ self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
+ self.rubyforge_name = self.name # TODO this is default value
17
+ # self.extra_deps = [['activesupport','>= 2.0.2']]
18
+
19
+ end
20
+
21
+ require 'newgem/tasks'
22
+ Dir['tasks/**/*.rake'].each { |t| load t }
23
+
24
+ # TODO - want other tests/tasks run by default? Add them to the list
25
+ # remove_task :default
26
+ # task :default => [:spec, :features]
27
+ begin
28
+ require 'jeweler'
29
+ Jeweler::Tasks.new do |gemspec|
30
+ gemspec.name = "ficonabses"
31
+ gemspec.summary = "Usage of SES based emails simply from your application"
32
+ gemspec.description = "EstormTech's solution to Amazon SES"
33
+ gemspec.email = "scott.sproule@estormtech.com"
34
+ gemspec.homepage = "http://github.com/semdinsp/ficonabses"
35
+ gemspec.authors = ["Scott Sproule"]
36
+ end
37
+ Jeweler::GemcutterTasks.new
38
+ rescue LoadError
39
+ puts "Jeweler not available. Install it with: sudo gem install jeweler -s http://gemcutter.org"
40
+ end
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'timeout'
3
+ gem 'httpclient'
4
+ require 'httpclient'
5
+ gem 'nokogiri'
6
+ require 'nokogiri'
7
+
8
+ module Ficonab
9
+ class Base
10
+ attr_accessor :host,:account,:password,:uri,:clnt,:extheader
11
+
12
+ @@host= 'localhost:8083'
13
+ def self.send_textemail(account,password,destination,subject,contents)
14
+ f=Ficonab::Base.new
15
+ f.send_textemail(account,password,destination,subject,contents)
16
+ end
17
+ def perform(account,password,url)
18
+ @uri=URI.parse(url)
19
+ res=''
20
+ begin
21
+ # Don't take longer than 60 seconds -- incase there is a problem with the server continue
22
+ Timeout::timeout(60) do
23
+ @clnt=HTTPClient.new
24
+ @clnt.set_auth(nil, account, password)
25
+ @extheader = { 'Content-Type' => 'application/xml' }
26
+ res=self.clnt.get_content(self.uri,self.extheader)
27
+ end
28
+ rescue Timeout::Error
29
+ # Too slow!!
30
+ res="failure to connect"
31
+ end
32
+
33
+ res
34
+
35
+ end
36
+ def send_textemail(account,password,destination,subject,contents)
37
+
38
+
39
+ url="http://#{@@host}/ficonabsendemail?destination=#{URI.encode(destination)}&text=#{URI.encode(contents)}&subject=#{URI.encode(subject)}"
40
+ puts "url is: #{url}"
41
+ perform(account,password,url)
42
+ # res
43
+ end
44
+
45
+ end # Class
46
+ end #Module
data/lib/ficonabses.rb ADDED
@@ -0,0 +1,7 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+ Dir[File.join(File.dirname(__FILE__), 'ficonabses/**/*.rb')].sort.each { |lib| require lib }
4
+
5
+ module Ficonabses
6
+ VERSION = '0.0.1'
7
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestFiconabses < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_send_text
9
+ res =Ficonab::Base.send_textemail('scott','scott123','scott.sproule@gmail.com','This is the subject','contents of the email')
10
+ puts "RES is: #{res}"
11
+ assert res.include? '200'
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/ficonabses'
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ficonabses
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Scott Sproule
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-11-13 00:00:00 +08:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Simple way to send emails from your application.
22
+ email: scott.sproule@estormtech.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/ficonabses/base.rb
31
+ - lib/ficonabses.rb
32
+ - test/test_ficonabses.rb
33
+ - test/test_helper.rb
34
+ - History.txt
35
+ - Manifest.txt
36
+ - PostInstall.txt
37
+ - Rakefile
38
+ - README.rdoc
39
+ has_rdoc: true
40
+ homepage: http://github.com/semdinsp/ficonabses
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ segments:
60
+ - 1
61
+ - 3
62
+ - 4
63
+ version: 1.3.4
64
+ requirements: []
65
+
66
+ rubyforge_project: ficonabses
67
+ rubygems_version: 1.3.6
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Ficonab SES tools to send emails via estormtech.com service
71
+ test_files: []
72
+