Class: Net::SMS::BulkSMS::Message
- Inherits:
-
Object
- Object
- Net::SMS::BulkSMS::Message
- Defined in:
- lib/net/sms/bulksms/message.rb
Overview
Encapsulates a message to be sent by the gateway
Constant Summary collapse
- FLASH_SMS =
0- NORMAL_SMS =
2
Instance Attribute Summary collapse
-
#concat_max_parts ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#concat_text_sms ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#message ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#msg_class ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#recipient ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#routing_group ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#source_id ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#test_always_fail ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#test_always_succeed ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
-
#want_report ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API.
Instance Method Summary collapse
-
#initialize(message, recipient) ⇒ Message
constructor
A new instance of Message.
-
#to_http_query ⇒ Object
Returns a message as a http query string for use by other gateway services.
Constructor Details
#initialize(message, recipient) ⇒ Message
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/net/sms/bulksms/message.rb', line 19 def initialize(, recipient) = @recipient = recipient @msg_class = NORMAL_SMS @want_report = 0 @routing_group = 2 @source_id = '' @test_always_succeed = 0 @test_always_fail = 0 @concat_text_sms = 0 @concat_max_parts = 2 end |
Instance Attribute Details
#concat_max_parts ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def concat_max_parts @concat_max_parts end |
#concat_text_sms ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def concat_text_sms @concat_text_sms end |
#message ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def end |
#msg_class ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def msg_class @msg_class end |
#recipient ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def recipient @recipient end |
#routing_group ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def routing_group @routing_group end |
#source_id ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def source_id @source_id end |
#test_always_fail ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def test_always_fail @test_always_fail end |
#test_always_succeed ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def test_always_succeed @test_always_succeed end |
#want_report ⇒ Object
The various attributes for a message as defined by the BulkSMS HTTP API. For full details on the different attributes see:
http://www.bulksms.co.uk/docs/eapi/submission/send_sms/
14 15 16 |
# File 'lib/net/sms/bulksms/message.rb', line 14 def want_report @want_report end |
Instance Method Details
#to_http_query ⇒ Object
Returns a message as a http query string for use by other gateway services
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/net/sms/bulksms/message.rb', line 34 def to_http_query params = { 'message' => , 'msisdn' => @recipient, 'msg_class' => @msg_class, 'want_report' => @want_report, 'routing_group' => @routing_group, 'source_id' => @source_id, 'test_always_succeed' => @test_always_succeed, 'test_always_fail' => @test_always_fail, 'allow_concat_text_sms' => @concat_text_sms, 'concat_text_sms_max_parts' => @concat_max_parts } query_string = params.collect { |x, y| "#{x}=#{y}" }.join('&') URI.encode(query_string) end |