Permalink
Browse files

More aggregators

  • Loading branch information...
1 parent 5fe5487 commit 73f9f55f3624adcb172c45b6d447cff9a25746e7 Brad Gessler committed Mar 10, 2010
@@ -40,7 +40,7 @@ def init
# Generally you'll want to return a blank response, but this may need to be
# changed depending on the aggregator.
def response
- [204, {}, nil]
+ [204, {}, []]
end
# Parse out the incoming message in the middleware and drop it on this queue
@@ -1,13 +0,0 @@
-require File.join(File.dirname(__FILE__), '../aggregator.rb')
-require File.join(File.dirname(__FILE__), '/clickatell/middleware.rb')
-require File.join(File.dirname(__FILE__), '/clickatell/gateway.rb')
-require File.join(File.dirname(__FILE__), '/clickatell/serialization.rb')
-
-module Alloy
- module SMS
- module Aggregator
- module Clickatell
- end
- end
- end
-end
@@ -0,0 +1,29 @@
+require 'nokogiri'
+
+class Messed
+ class Interface
+ class Adapter
+ class SMS
+ class Celltrust < SMSHTTPReceiver
+
+ def receive(request, message)
+ message = self.class.deserialize_xml(params['xml'])
+ end
+
+ # Parse the Celltrust XML into a message
+ def self.deserialize_xml(xml)
+ doc = Nokogiri(xml)
+ attributes = (doc/'/RecipientResponse')
+
+ SMS::Message.new do |m|
+ m.from = attributes.at('originatoraddress').inner_text
+ m.to = attributes.at('serveraddress').inner_text
+ m.body = attributes.at('data').inner_text
+ end
+ end
+
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,28 @@
+require 'nokogiri'
+
+class Messed
+ class Interface
+ class Adapter
+ class SMS
+ class Clickatell < SMSHTTPReceiver
+
+ def receive(request, message)
+ message = self.class.deserialize_xml(params['data'])
+ end
+
+ def self.deserialize_xml(xml, &block)
+ doc = Nokogiri(xml)
+ attributes = (doc/'/clickmo')
+
+ SMS::Message.new do |m|
+ m.from = attributes.at('from').inner_text
+ m.to = attributes.at('to').inner_text
+ m.body = attributes.at('text').inner_text
+ end
+ end
+
+ end
+ end
+ end
+ end
+end

0 comments on commit 73f9f55

Please sign in to comment.