Class: SmsNotify::MessageStatus
- Inherits:
-
Object
- Object
- SmsNotify::MessageStatus
- Defined in:
- lib/sms_notify/message_status.rb
Overview
Represents an SMS message status in the form of a Ruby-like object.
Constant Summary collapse
- FATAL_ERRORS =
['3', '7', '8', '9', '10', '11', '12', '13', '14']
Instance Attribute Summary collapse
-
#completed ⇒ Object
readonly
Returns the value of attribute completed.
-
#demo ⇒ Object
readonly
Returns the value of attribute demo.
-
#received_date ⇒ Object
readonly
Returns the value of attribute received_date.
-
#responded ⇒ Object
readonly
Returns the value of attribute responded.
-
#scheduled_time ⇒ Object
readonly
Returns the value of attribute scheduled_time.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#status_text ⇒ Object
readonly
Returns the value of attribute status_text.
-
#text_id ⇒ Object
readonly
Returns the value of attribute text_id.
Instance Method Summary collapse
- #fatal_error? ⇒ Boolean
-
#initialize(attrs) ⇒ MessageStatus
constructor
Create a new instance of a #MessageStatus.
Constructor Details
#initialize(attrs) ⇒ MessageStatus
Create a new instance of a #MessageStatus
Example
SmsNotify::MessageStatus.new(
"Completed" => '1',
"Demo" => '0',
"ScheduledTime" => '2010-04-03T14:29:14.7',
"StatusCode" => '6',
"StatusText" => 'Completed',
"ReceivedDate" => '2010-04-03T14:29:14.7',
"Responded" => '0')
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sms_notify/message_status.rb', line 19 def initialize(attrs) @completed = attrs[:completed] || attrs["Completed"] || nil @demo = attrs[:demo] || attrs["Demo"] || nil @scheduled_time = attrs[:scheduled_time] || attrs["ScheduledTime"] || nil @status_code = attrs[:status_code] || attrs["StatusCode"] || nil @status_text = attrs[:status_text] || attrs["StatusText"] || nil @text_id = attrs[:text_id] || attrs["TextID"] || nil @received_date = attrs[:received_date] || attrs["ReceivedDate"] || nil @responded = attrs[:responded] || attrs["Responded"] || nil end |
Instance Attribute Details
#completed ⇒ Object (readonly)
Returns the value of attribute completed.
6 7 8 |
# File 'lib/sms_notify/message_status.rb', line 6 def completed @completed end |
#demo ⇒ Object (readonly)
Returns the value of attribute demo.
6 7 8 |
# File 'lib/sms_notify/message_status.rb', line 6 def demo @demo end |
#received_date ⇒ Object (readonly)
Returns the value of attribute received_date.
6 7 8 |
# File 'lib/sms_notify/message_status.rb', line 6 def received_date @received_date end |
#responded ⇒ Object (readonly)
Returns the value of attribute responded.
6 7 8 |
# File 'lib/sms_notify/message_status.rb', line 6 def responded @responded end |
#scheduled_time ⇒ Object (readonly)
Returns the value of attribute scheduled_time.
6 7 8 |
# File 'lib/sms_notify/message_status.rb', line 6 def scheduled_time @scheduled_time end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
6 7 8 |
# File 'lib/sms_notify/message_status.rb', line 6 def status_code @status_code end |
#status_text ⇒ Object (readonly)
Returns the value of attribute status_text.
6 7 8 |
# File 'lib/sms_notify/message_status.rb', line 6 def status_text @status_text end |
#text_id ⇒ Object (readonly)
Returns the value of attribute text_id.
6 7 8 |
# File 'lib/sms_notify/message_status.rb', line 6 def text_id @text_id end |
Instance Method Details
#fatal_error? ⇒ Boolean
30 31 32 |
# File 'lib/sms_notify/message_status.rb', line 30 def fatal_error? FATAL_ERRORS.include?(self.status_code) end |