action_sms_gateways 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/MIT-LICENSE +21 -0
- data/README.markdown +25 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/action_sms_gateways.gemspec +45 -0
- data/lib/action_sms_gateways.rb +2 -0
- data/lib/action_sms_gateways/connection_adapters.rb +5 -0
- data/lib/action_sms_gateways/connection_adapters/sms_global.rb +41 -0
- data/todo +2 -0
- metadata +73 -0
data/.gitignore
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2010 David Wilkie
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.markdown
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# action_sms_gateways
|
2
|
+
A collection of SMS Gateway Adapters for [action_sms](http://github.com/dwilkie/action_sms)
|
3
|
+
|
4
|
+
## Current SMS Adapters
|
5
|
+
* [SMSGlobal](http://www.smsglobal.com)
|
6
|
+
|
7
|
+
## Creating your own SMS Gateway Adapter
|
8
|
+
Take a look at the source under `lib/action_sms_gateways/connection_adapters/sms_global.rb` and use it as a template for your own adapter. Then why not share it for all to use...
|
9
|
+
|
10
|
+
## Contributing
|
11
|
+
* Fork the project.
|
12
|
+
* Make your SMS Gateway Adapter.
|
13
|
+
* Add tests for it. This is important so I don’t break it in a future version unintentionally.
|
14
|
+
* Commit, do not mess with rakefile, version, or history.
|
15
|
+
* Send me a pull request.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
gem install action_sms_gateways
|
19
|
+
### Rails
|
20
|
+
Place the following in your Gemfile:
|
21
|
+
|
22
|
+
gem action_sms_gateways
|
23
|
+
|
24
|
+
Copyright (c) 2010 David Wilkie, released under the MIT license
|
25
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the action_sms_gateways plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.libs << 'spec'
|
12
|
+
t.libs << 'features'
|
13
|
+
t.pattern = 'spec/**/*_spec.rb'
|
14
|
+
t.verbose = true
|
15
|
+
end
|
16
|
+
|
17
|
+
begin
|
18
|
+
require 'jeweler'
|
19
|
+
Jeweler::Tasks.new do |gemspec|
|
20
|
+
gemspec.name = "action_sms_gateways"
|
21
|
+
gemspec.summary = "SMS Gateway Adapters to use with action_sms"
|
22
|
+
gemspec.email = "dwilkie@gmail.com"
|
23
|
+
gemspec.homepage = "http://github.com/dwilkie/action_sms_gateways"
|
24
|
+
gemspec.authors = ["David Wilkie"]
|
25
|
+
end
|
26
|
+
rescue LoadError
|
27
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Generate documentation for the ActionSMS plugin.'
|
31
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
32
|
+
rdoc.rdoc_dir = 'rdoc'
|
33
|
+
rdoc.title = 'ActionSMSGateways'
|
34
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
35
|
+
rdoc.rdoc_files.include('README')
|
36
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
+
end
|
38
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{action_sms_gateways}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["David Wilkie"]
|
12
|
+
s.date = %q{2010-07-07}
|
13
|
+
s.email = %q{dwilkie@gmail.com}
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"README.markdown"
|
16
|
+
]
|
17
|
+
s.files = [
|
18
|
+
".gitignore",
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README.markdown",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"action_sms_gateways.gemspec",
|
24
|
+
"lib/action_sms_gateways.rb",
|
25
|
+
"lib/action_sms_gateways/connection_adapters.rb",
|
26
|
+
"lib/action_sms_gateways/connection_adapters/sms_global.rb",
|
27
|
+
"todo"
|
28
|
+
]
|
29
|
+
s.homepage = %q{http://github.com/dwilkie/action_sms_gateways}
|
30
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
31
|
+
s.require_paths = ["lib"]
|
32
|
+
s.rubygems_version = %q{1.3.7}
|
33
|
+
s.summary = %q{SMS Gateway Adapters to use with action_sms}
|
34
|
+
|
35
|
+
if s.respond_to? :specification_version then
|
36
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
37
|
+
s.specification_version = 3
|
38
|
+
|
39
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
40
|
+
else
|
41
|
+
end
|
42
|
+
else
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'action_sms/connection_adapters/abstract_adapter'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
module ActionSms
|
5
|
+
class Base
|
6
|
+
def self.sms_global_connection(config) #:nodoc:
|
7
|
+
return ConnectionAdapters::SMSGlobalAdapter.new(logger, config)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module ConnectionAdapters
|
12
|
+
# All the concrete gateway adapters follow the interface laid down in this
|
13
|
+
# class. You can use this interface directly by borrowing the gateway
|
14
|
+
# connection from the Base with Base.connection.
|
15
|
+
class SMSGlobalAdapter < AbstractAdapter
|
16
|
+
SERVICE_HOST = "http://smsglobal.com.au"
|
17
|
+
SERVICE_PATH = "http-api.php"
|
18
|
+
|
19
|
+
def initialize(logger = nil, config = {}) #:nodoc:
|
20
|
+
super(logger)
|
21
|
+
@config = config.dup
|
22
|
+
@service_url = URI.join(SERVICE_HOST, SERVICE_PATH)
|
23
|
+
@service_url.scheme = config[:use_ssl] ? "https" : "http"
|
24
|
+
end
|
25
|
+
|
26
|
+
def deliver(sms)
|
27
|
+
params = {
|
28
|
+
:action => 'sendsms',
|
29
|
+
:user => @config[:user],
|
30
|
+
:password => @config[:password],
|
31
|
+
:maxsplit => 3,
|
32
|
+
:from => (sms.from || "reply2email"),
|
33
|
+
:to => sms.recipients,
|
34
|
+
:text => sms.body
|
35
|
+
}
|
36
|
+
send_http_request(@service_url.to_s, params)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: action_sms_gateways
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- David Wilkie
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-07-07 00:00:00 +07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email: dwilkie@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.markdown
|
29
|
+
files:
|
30
|
+
- .gitignore
|
31
|
+
- MIT-LICENSE
|
32
|
+
- README.markdown
|
33
|
+
- Rakefile
|
34
|
+
- VERSION
|
35
|
+
- action_sms_gateways.gemspec
|
36
|
+
- lib/action_sms_gateways.rb
|
37
|
+
- lib/action_sms_gateways/connection_adapters.rb
|
38
|
+
- lib/action_sms_gateways/connection_adapters/sms_global.rb
|
39
|
+
- todo
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: http://github.com/dwilkie/action_sms_gateways
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options:
|
46
|
+
- --charset=UTF-8
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.3.7
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: SMS Gateway Adapters to use with action_sms
|
72
|
+
test_files: []
|
73
|
+
|