agilisto-smartcall 0.0.1

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.
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2009-07-01
2
+
3
+ * 1 major enhancement:
4
+ * Initial implementation
@@ -0,0 +1,88 @@
1
+ .git/COMMIT_EDITMSG
2
+ .git/HEAD
3
+ .git/config
4
+ .git/description
5
+ .git/hooks/applypatch-msg.sample
6
+ .git/hooks/commit-msg.sample
7
+ .git/hooks/post-commit.sample
8
+ .git/hooks/post-receive.sample
9
+ .git/hooks/post-update.sample
10
+ .git/hooks/pre-applypatch.sample
11
+ .git/hooks/pre-commit.sample
12
+ .git/hooks/pre-rebase.sample
13
+ .git/hooks/prepare-commit-msg.sample
14
+ .git/hooks/update.sample
15
+ .git/index
16
+ .git/info/exclude
17
+ .git/logs/HEAD
18
+ .git/logs/refs/heads/master
19
+ .git/logs/refs/remotes/origin/master
20
+ .git/objects/00/f1013a65955cd471412182a97d5f1fffd3704c
21
+ .git/objects/02/71eea5123474aedbde8015255a504d94f685bd
22
+ .git/objects/06/aee68532f3f27a0069ba2d3b83882e9de694c2
23
+ .git/objects/0e/645be9c8c9577a7c510f18f02a911625b84f33
24
+ .git/objects/1b/6da8fb93b154f0e61fd79bd8937054239efb6a
25
+ .git/objects/2c/19b6786301350db21213800d5947f3c1c3e970
26
+ .git/objects/3b/d7d5c3db3c5505818578db99b2ddf1f08c2cf6
27
+ .git/objects/44/b350588a68aefd6f341ada560d97dd02c4cfa6
28
+ .git/objects/47/ce4582a7061057570755212b88e3bea4361772
29
+ .git/objects/59/e5c948076ec6694f10b5d462a3ceb97f8ab8eb
30
+ .git/objects/5c/c37cedc951acf642517aa2816227278cd01151
31
+ .git/objects/69/362213610bb67096bfc2a42e30412ef27c2f77
32
+ .git/objects/69/40d60f0a57a0348157f98262f36c824317eed6
33
+ .git/objects/6d/3ef15461c2da28aa4885e6451fbbb17b2d6b94
34
+ .git/objects/6f/71532e99159d5eba176702d74769330fc81eb6
35
+ .git/objects/72/141584a5836168fe912ebce5b4537bd0eafc09
36
+ .git/objects/77/b144ee27d70aae0d0c41943d81c0db04895164
37
+ .git/objects/7c/ec2abaf23f2e5bc8666f30624f0e86f528736b
38
+ .git/objects/7e/87ba0640047dbe24aea1df4a246a62b7fc1def
39
+ .git/objects/88/b52085d0de43bb32ecbe1ed8aaad31d2c90d42
40
+ .git/objects/92/da48d3bc17b4a555c3a36bf460587f9a8e6a1d
41
+ .git/objects/97/9064357d9ab94a16a799667044e4b4d2ddca51
42
+ .git/objects/99/d4bec753e7a5893098c9c27c7ddb189e32fb21
43
+ .git/objects/9c/2d3352332af363407ac78c2e2c4ab6a9d52728
44
+ .git/objects/9f/f1cdcf1dc45d82a72b69276ab2cc490fe0da08
45
+ .git/objects/a4/038466c09a502e2236584dd120b296c6e6e7ff
46
+ .git/objects/a8/56644c6c2e01d84f39f7fcb51ba636db60b4ff
47
+ .git/objects/af/c3ea327fa220ee42a5ebecfcc7d218be4ea1d9
48
+ .git/objects/b7/4a78a94dd22b27a7fb74e43105fa6f5e064c26
49
+ .git/objects/c2/7f6559350f7adb19d43742b55b2f91d07b6550
50
+ .git/objects/c5/993b40f4cfd00704d4ca626faee36a30aed8d9
51
+ .git/objects/d4/c63cfc1f685add1e56823c11a0314486b7d4b0
52
+ .git/objects/d6/1464e3acc27506d452770bf403c7c1421d10de
53
+ .git/objects/d9/649874f15b9532896e4b95ffdb75dc030e9f77
54
+ .git/objects/de/55b52626e60d61116d4e15234bb7a12e4321d3
55
+ .git/objects/e2/5ee33ae1b32b3476efbdefccb5674a4b76cee0
56
+ .git/objects/e3/d3891ead56297ae33071a8b97f1ef48c716f5b
57
+ .git/objects/e4/8464df56bf487e96e21ea99487330266dae3c9
58
+ .git/objects/e6/5f20ff918715435fa0aa9685e18cc7d8b5eb86
59
+ .git/objects/e9/560b6d4b2a5a11fe232679960f82f4d3791448
60
+ .git/objects/f8/b030b7589aa1a720de29026879002a1f8d595b
61
+ .git/objects/fd/7ab688bb41aab7531c5e3dc1330c55ba1297fa
62
+ .git/refs/heads/master
63
+ .git/refs/remotes/origin/master
64
+ History.txt
65
+ Manifest.txt
66
+ PostInstall.txt
67
+ README.rdoc
68
+ Rakefile
69
+ bin/smartcall
70
+ config/website.yml.sample
71
+ lib/smartcall.rb
72
+ lib/smartcall/soap/default.rb
73
+ lib/smartcall/soap/default_driver.rb
74
+ lib/smartcall/soap/smartcall_error.rb
75
+ lib/smartcall/soap/sms_ws_client.rb
76
+ lib/smartcall/utility.rb
77
+ lib/smartcall/utility/options.rb
78
+ script/console
79
+ script/destroy
80
+ script/generate
81
+ script/txt2html
82
+ test/test_helper.rb
83
+ test/test_smartcall.rb
84
+ website/index.html
85
+ website/index.txt
86
+ website/javascripts/rounded_corners_lite.inc.js
87
+ website/stylesheets/screen.css
88
+ website/template.html.erb
@@ -0,0 +1,6 @@
1
+
2
+ For more information on the smartcall gem , see http://smartcall.rubyforge.org
3
+ For more information on Smartcall Technology Solutions, see http://www.smartcalltech.co.za
4
+
5
+
6
+
@@ -0,0 +1,50 @@
1
+ = smartcall sms gem
2
+
3
+ * http://github.com/agilisto/smartcall
4
+
5
+ == DESCRIPTION:
6
+
7
+ Gem to provide sms functionality through the Smartcall Technology Solutions web services.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * MSISDN in international format not accepted.
12
+ * Only South African delivery
13
+
14
+ == SYNOPSIS:
15
+ require 'smartcall'
16
+
17
+ api = Smartcall::API.new(<USERNAME>, <PASSWORD>, <CAMPAIGN_ID>, <REFERENCE>)
18
+ api.send_message("0825559629", "Hello World")
19
+
20
+ == REQUIREMENTS:
21
+
22
+
23
+ == INSTALL:
24
+
25
+ sudo gem install smartcall
26
+
27
+ == LICENSE:
28
+
29
+ (The MIT License)
30
+
31
+ Copyright (c) 2009 Armand du Plessis
32
+
33
+ Permission is hereby granted, free of charge, to any person obtaining
34
+ a copy of this software and associated documentation files (the
35
+ 'Software'), to deal in the Software without restriction, including
36
+ without limitation the rights to use, copy, modify, merge, publish,
37
+ distribute, sublicense, and/or sell copies of the Software, and to
38
+ permit persons to whom the Software is furnished to do so, subject to
39
+ the following conditions:
40
+
41
+ The above copyright notice and this permission notice shall be
42
+ included in all copies or substantial portions of the Software.
43
+
44
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
45
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
46
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
47
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
48
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
49
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
50
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/smartcall'
6
+
7
+ Hoe.plugin :newgem
8
+ Hoe.plugin :website
9
+ # Hoe.plugin :cucumber_features
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 'smartcall' do
14
+ self.developer 'FIXME full name', 'FIXME email'
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]
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ local_libs = [
4
+ File.join(File.dirname(__FILE__), *%w[../lib/smartcall]),
5
+ File.join(File.dirname(__FILE__), *%w[../lib/smartcall/utility])
6
+ ]
7
+
8
+ if File.exist?(local_libs.first)
9
+ local_libs.each { |lib| require lib }
10
+ else
11
+ require 'rubygems'
12
+ require 'smartcall'
13
+ require 'smartcall/utility'
14
+ end
15
+
16
+ # parse command line options
17
+ options = Smartcall::Utility::Options.parse(ARGV)
18
+
19
+ # authenticate and load the API
20
+ api = Smartcall::API.new(options.username, options.password, options.campaign_id, options.reference)
21
+
22
+ begin
23
+ puts "Sending '#{options.message}' to #{options.recipient}..."
24
+ additional_opts = {}
25
+ additional_opts[:from] = options.from if options.from
26
+ msg_id = api.send_message(options.recipient, options.message, additional_opts)
27
+ puts "Message sent successfully (Result: #{msg_id})." unless msg_id == false
28
+ puts "Message sending failed. Switch to debug for more info" if msg_id == false
29
+ exit 0
30
+ rescue Smartcall::Soap::SmartcallError => e
31
+ puts "Unexpected error occurred. #{e.message}"
32
+ exit 1
33
+
34
+ rescue Timeout::Error
35
+ puts "The connection the the Smartcall service timed out"
36
+ puts "Please check your network settings and try again."
37
+ exit 1
38
+ end
@@ -0,0 +1,2 @@
1
+ host: unknown@rubyforge.org
2
+ remote_dir: /var/www/gforge-projects/smartcall
@@ -0,0 +1,30 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ require 'smartcall/soap/default'
5
+ require 'smartcall/soap/default_driver'
6
+ require 'smartcall/soap/smartcall_error'
7
+ require 'smartcall/soap/sms_ws_client'
8
+
9
+ module Smartcall
10
+ VERSION = '0.0.1'
11
+
12
+ class API
13
+
14
+ def initialize(username, password, campaign_id, reference)
15
+ @client = Smartcall::Soap::SmsWSClient.new(username, password, campaign_id, reference)
16
+ end
17
+
18
+ def send_message(msisdn, message_body, options = {})
19
+ @client.send_sms(msisdn, message_body)
20
+ end
21
+
22
+ def send_binary_message(msisdn, header, part, options = {})
23
+ raise NotImplementedError.new
24
+ end
25
+
26
+ def send_wap_link(msisdn, href, message, options = {})
27
+ raise NotImplementedError.new
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,147 @@
1
+ require 'xsd/qname'
2
+
3
+ module Smartcall
4
+ module Soap
5
+ # {http://tempuri.org/}login
6
+ class Login
7
+ @@schema_type = "login"
8
+ @@schema_ns = "http://tempuri.org/"
9
+ @@schema_qualified = "true"
10
+ @@schema_element = [["username", "SOAP::SOAPString"], ["password", "SOAP::SOAPString"]]
11
+
12
+ attr_accessor :username
13
+ attr_accessor :password
14
+
15
+ def initialize(username = nil, password = nil)
16
+ @username = username
17
+ @password = password
18
+ end
19
+ end
20
+
21
+ # {http://tempuri.org/}loginResponse
22
+ class LoginResponse
23
+ @@schema_type = "loginResponse"
24
+ @@schema_ns = "http://tempuri.org/"
25
+ @@schema_qualified = "true"
26
+ @@schema_element = [["loginResult", "SOAP::SOAPBoolean"], ["token", "SOAP::SOAPString"]]
27
+
28
+ attr_accessor :loginResult
29
+ attr_accessor :token
30
+
31
+ def initialize(loginResult = nil, token = nil)
32
+ @loginResult = loginResult
33
+ @token = token
34
+ end
35
+ end
36
+
37
+ # {http://tempuri.org/}sendSMS
38
+ class SendSMS
39
+ @@schema_type = "sendSMS"
40
+ @@schema_ns = "http://tempuri.org/"
41
+ @@schema_qualified = "true"
42
+ @@schema_element = [["token", "SOAP::SOAPString"], ["recipient", "SOAP::SOAPString"], ["message", "SOAP::SOAPString"], ["reference", "SOAP::SOAPString"], ["campaignid", "SOAP::SOAPInt"]]
43
+
44
+ attr_accessor :token
45
+ attr_accessor :recipient
46
+ attr_accessor :message
47
+ attr_accessor :reference
48
+ attr_accessor :campaignid
49
+
50
+ def initialize(token = nil, recipient = nil, message = nil, reference = nil, campaignid = nil)
51
+ @token = token
52
+ @recipient = recipient
53
+ @message = message
54
+ @reference = reference
55
+ @campaignid = campaignid
56
+ end
57
+ end
58
+
59
+ # {http://tempuri.org/}sendSMSResponse
60
+ class SendSMSResponse
61
+ @@schema_type = "sendSMSResponse"
62
+ @@schema_ns = "http://tempuri.org/"
63
+ @@schema_qualified = "true"
64
+ @@schema_element = [["sendSMSResult", "SOAP::SOAPString"]]
65
+
66
+ attr_accessor :sendSMSResult
67
+
68
+ def initialize(sendSMSResult = nil)
69
+ @sendSMSResult = sendSMSResult
70
+ end
71
+ end
72
+
73
+ # {http://tempuri.org/}sendWAPLink
74
+ class SendWAPLink
75
+ @@schema_type = "sendWAPLink"
76
+ @@schema_ns = "http://tempuri.org/"
77
+ @@schema_qualified = "true"
78
+ @@schema_element = [["token", "SOAP::SOAPString"], ["recipient", "SOAP::SOAPString"], ["href", "SOAP::SOAPString"], ["text", "SOAP::SOAPString"], ["reference", "SOAP::SOAPString"], ["campaignid", "SOAP::SOAPInt"]]
79
+
80
+ attr_accessor :token
81
+ attr_accessor :recipient
82
+ attr_accessor :href
83
+ attr_accessor :text
84
+ attr_accessor :reference
85
+ attr_accessor :campaignid
86
+
87
+ def initialize(token = nil, recipient = nil, href = nil, text = nil, reference = nil, campaignid = nil)
88
+ @token = token
89
+ @recipient = recipient
90
+ @href = href
91
+ @text = text
92
+ @reference = reference
93
+ @campaignid = campaignid
94
+ end
95
+ end
96
+
97
+ # {http://tempuri.org/}sendWAPLinkResponse
98
+ class SendWAPLinkResponse
99
+ @@schema_type = "sendWAPLinkResponse"
100
+ @@schema_ns = "http://tempuri.org/"
101
+ @@schema_qualified = "true"
102
+ @@schema_element = [["sendWAPLinkResult", "SOAP::SOAPString"]]
103
+
104
+ attr_accessor :sendWAPLinkResult
105
+
106
+ def initialize(sendWAPLinkResult = nil)
107
+ @sendWAPLinkResult = sendWAPLinkResult
108
+ end
109
+ end
110
+
111
+ # {http://tempuri.org/}sendBinaryString
112
+ class SendBinaryString
113
+ @@schema_type = "sendSMS"
114
+ @@schema_ns = "http://tempuri.org/"
115
+ @@schema_qualified = "true"
116
+ @@schema_element = [["token", "SOAP::SOAPString"], ["recipient", "SOAP::SOAPString"], ["binary", "SOAP::SOAPString"], ["reference", "SOAP::SOAPString"], ["campaignid", "SOAP::SOAPInt"]]
117
+
118
+ attr_accessor :token
119
+ attr_accessor :recipient
120
+ attr_accessor :binary
121
+ attr_accessor :reference
122
+ attr_accessor :campaignid
123
+
124
+ def initialize(token = nil, recipient = nil, binary = nil, reference = nil, campaignid = nil)
125
+ @token = token
126
+ @recipient = recipient
127
+ @binary = binary
128
+ @reference = reference
129
+ @campaignid = campaignid
130
+ end
131
+ end
132
+
133
+ # {http://tempuri.org/}sendBinaryStringResponse
134
+ class SendBinaryStringResponse
135
+ @@schema_type = "sendSMSResponse"
136
+ @@schema_ns = "http://tempuri.org/"
137
+ @@schema_qualified = "true"
138
+ @@schema_element = [["sendBinaryStringResult", "SOAP::SOAPString"]]
139
+
140
+ attr_accessor :sendBinaryStringResult
141
+
142
+ def initialize(sendBinaryStringResult = nil)
143
+ @sendBinaryStringResult = sendBinaryStringResult
144
+ end
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,70 @@
1
+ require 'soap/rpc/driver'
2
+
3
+ module Smartcall
4
+ module Soap
5
+
6
+ class SmsWSSoap < ::SOAP::RPC::Driver
7
+ DefaultEndpointUrl = "http://www.smartcalltech.co.za/SmsWS/Service.asmx"
8
+ MappingRegistry = ::SOAP::Mapping::Registry.new
9
+
10
+ Methods = [
11
+ [ "http://tempuri.org/login",
12
+ "login",
13
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "login"], true],
14
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "loginResponse"], true] ],
15
+ { :request_style => :document, :request_use => :literal,
16
+ :response_style => :document, :response_use => :literal }
17
+ ],
18
+ [ "http://tempuri.org/sendSMS",
19
+ "sendSMS",
20
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "sendSMS"], true],
21
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "sendSMSResponse"], true] ],
22
+ { :request_style => :document, :request_use => :literal,
23
+ :response_style => :document, :response_use => :literal }
24
+ ],
25
+ [ "http://tempuri.org/sendWAPLink",
26
+ "sendWAPLink",
27
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "sendWAPLink"], true],
28
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "sendWAPLinkResponse"], true] ],
29
+ { :request_style => :document, :request_use => :literal,
30
+ :response_style => :document, :response_use => :literal }
31
+ ],
32
+ [ "http://tempuri.org/sendBinaryString",
33
+ "sendBinaryString",
34
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "sendBinaryString"]],
35
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://tempuri.org/", "sendBinaryStringResponse"]] ],
36
+ { :request_style => :document, :request_use => :literal,
37
+ :response_style => :document, :response_use => :literal,
38
+ :faults => {} }
39
+ ],
40
+ ]
41
+
42
+ def initialize(endpoint_url = nil)
43
+ endpoint_url ||= DefaultEndpointUrl
44
+ super(endpoint_url, nil)
45
+ self.mapping_registry = MappingRegistry
46
+ init_methods
47
+ end
48
+
49
+ private
50
+
51
+ def init_methods
52
+ Methods.each do |definitions|
53
+ opt = definitions.last
54
+ if opt[:request_style] == :document
55
+ add_document_operation(*definitions)
56
+ else
57
+ add_rpc_operation(*definitions)
58
+ qname = definitions[0]
59
+ name = definitions[2]
60
+ if qname.name != name and qname.name.capitalize == name.capitalize
61
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
62
+ __send__(name, *arg)
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end