Class: EventMachine::Smsified::DeliveryInfoNotification
- Inherits:
-
Object
- Object
- EventMachine::Smsified::DeliveryInfoNotification
- Defined in:
- lib/em-smsified/incoming_message.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#created_date_time ⇒ Object
readonly
Returns the value of attribute created_date_time.
-
#delivery_status ⇒ Object
readonly
Returns the value of attribute delivery_status.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
-
#sender_address ⇒ Object
readonly
Returns the value of attribute sender_address.
-
#sent_date_time ⇒ Object
readonly
Returns the value of attribute sent_date_time.
Instance Method Summary collapse
-
#initialize(json) ⇒ Object
constructor
Intantiate a new object to provide convenience methods on a Delivery Info Notification.
Constructor Details
#initialize(json) ⇒ Object
Intantiate a new object to provide convenience methods on a Delivery Info Notification. Note: This class only pulls the first delivery info object from the notification. There can be more as per the spec. smsified.com/sms-api-documentation/sending#checking_status
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/em-smsified/incoming_message.rb', line 20 def initialize(json) begin @json = JSON.parse json contents = @json['deliveryInfoNotification']['deliveryInfo'] @delivery_status = contents['deliveryStatus'] @code = contents['code'] = contents['messageId'] @sender_address = contents['senderAddress'] @address = contents['address'] @created_date_time = Time.parse contents['createdDateTime'] @sent_date_time = Time.parse contents['sentDateTime'] @parts = contents['parts'] @direction = contents['direction'] = contents['message'] rescue => error raise EventMachine::Smsified::MessageError, "Not valid JSON or DeliveryInfoNotification" end end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def address @address end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def code @code end |
#created_date_time ⇒ Object (readonly)
Returns the value of attribute created_date_time.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def created_date_time @created_date_time end |
#delivery_status ⇒ Object (readonly)
Returns the value of attribute delivery_status.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def delivery_status @delivery_status end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def direction @direction end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def end |
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def parts @parts end |
#sender_address ⇒ Object (readonly)
Returns the value of attribute sender_address.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def sender_address @sender_address end |
#sent_date_time ⇒ Object (readonly)
Returns the value of attribute sent_date_time.
7 8 9 |
# File 'lib/em-smsified/incoming_message.rb', line 7 def sent_date_time @sent_date_time end |