Sha256: 4ac222e04c432c2ba2013d1f41e2e444b6822c32d79fc252408af326aadda5b5
Contents?: true
Size: 914 Bytes
Versions: 3
Compression:
Stored size: 914 Bytes
Contents
module Notifications class Client class Notification FIELDS = %i( id reference email_address phone_number line_1 line_2 line_3 line_4 line_5 line_6 postcode type status template body subject sent_at created_at completed_at ).freeze attr_reader(*FIELDS) def initialize(notification) FIELDS.each do |field| instance_variable_set(:"@#{field}", notification.fetch(field.to_s, nil)) end end %i( sent_at created_at completed_at ).each do |field| define_method field do begin value = instance_variable_get(:"@#{field}") Time.parse value rescue value end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems