Class: Notifications::Client::ReceivedText
- Inherits:
-
Object
- Object
- Notifications::Client::ReceivedText
- Defined in:
- lib/notifications/client/received_text.rb
Constant Summary collapse
- FIELDS =
%i( id created_at content notify_number service_id user_number ).freeze
Instance Method Summary collapse
- #created_at ⇒ Object
-
#initialize(received_text) ⇒ ReceivedText
constructor
A new instance of ReceivedText.
Constructor Details
#initialize(received_text) ⇒ ReceivedText
Returns a new instance of ReceivedText.
17 18 19 20 21 |
# File 'lib/notifications/client/received_text.rb', line 17 def initialize(received_text) FIELDS.each do |field| instance_variable_set(:"@#{field}", received_text.fetch(field.to_s, nil)) end end |
Instance Method Details
#created_at ⇒ Object
23 24 25 26 27 28 |
# File 'lib/notifications/client/received_text.rb', line 23 def created_at value = instance_variable_get(:@created_at) Time.parse(value) rescue StandardError value end |