Class: Bulksms::Message
- Inherits:
-
Object
- Object
- Bulksms::Message
- Defined in:
- lib/bulksms/message.rb
Overview
Encapsulates a message to be sent by the gateway
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(opts = {}) ⇒ Message
constructor
A new instance of Message.
-
#to_params ⇒ Object
Returns a message as a http query string for use by other gateway services.
Constructor Details
#initialize(opts = {}) ⇒ Message
Returns a new instance of Message.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bulksms/message.rb', line 15 def initialize(opts = {}) @message = opts[:message] @recipient = opts[:recipient] @msg_class = opts[:message_class] || Bulksms.config. @want_report = 0 @routing_group = opts[:routing_group] || Bulksms.config.routing_group @source_id = '' @test_always_succeed = opts[:test_always_succeed] || 0 @test_always_fail = opts[: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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 def @message 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 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/
10 11 12 |
# File 'lib/bulksms/message.rb', line 10 def want_report @want_report end |
Instance Method Details
#to_params ⇒ Object
Returns a message as a http query string for use by other gateway services
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bulksms/message.rb', line 30 def to_params raise "Missing message!" if @message.to_s.empty? raise "Missing recipient!" if @recipient.to_s.empty? { 'message' => @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 } end |