Class: EventMachine::Smsified::IncomingMessage
- Inherits:
-
Object
- Object
- EventMachine::Smsified::IncomingMessage
- Defined in:
- lib/em-smsified/incoming_message.rb
Instance Attribute Summary collapse
-
#date_time ⇒ Object
readonly
Returns the value of attribute date_time.
-
#destination_address ⇒ Object
readonly
Returns the value of attribute destination_address.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#sender_address ⇒ Object
readonly
Returns the value of attribute sender_address.
Instance Method Summary collapse
-
#initialize(json) ⇒ Object
constructor
Intantiate a new object to provide convenience methods on an Incoming Message www.smsified.com/sms-api-documentation/receiving.
Constructor Details
#initialize(json) ⇒ Object
Intantiate a new object to provide convenience methods on an Incoming Message www.smsified.com/sms-api-documentation/receiving
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/em-smsified/incoming_message.rb', line 53 def initialize(json) begin @json = JSON.parse json contents = @json['inboundSMSMessageNotification']['inboundSMSMessage'] @date_time = Time.parse contents['dateTime'] @destination_address = contents['destinationAddress'] = contents['message'] = contents['messageId'] @sender_address = contents['senderAddress'] rescue => error raise EventMachine::Smsified::MessageError, "Not valid JSON or IncomingMessage" end end |
Instance Attribute Details
#date_time ⇒ Object (readonly)
Returns the value of attribute date_time.
41 42 43 |
# File 'lib/em-smsified/incoming_message.rb', line 41 def date_time @date_time end |
#destination_address ⇒ Object (readonly)
Returns the value of attribute destination_address.
41 42 43 |
# File 'lib/em-smsified/incoming_message.rb', line 41 def destination_address @destination_address end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
41 42 43 |
# File 'lib/em-smsified/incoming_message.rb', line 41 def json @json end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
41 42 43 |
# File 'lib/em-smsified/incoming_message.rb', line 41 def end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
41 42 43 |
# File 'lib/em-smsified/incoming_message.rb', line 41 def end |
#sender_address ⇒ Object (readonly)
Returns the value of attribute sender_address.
41 42 43 |
# File 'lib/em-smsified/incoming_message.rb', line 41 def sender_address @sender_address end |