Class: Notifications::Client::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/notifications/client/notification.rb

Constant Summary collapse

FIELDS =
%i(
  id
  reference
  email_address
  phone_number
  line_1
  line_2
  line_3
  line_4
  line_5
  line_6
  postcode
  postage
  type
  status
  template
  body
  subject
  sent_at
  created_at
  completed_at
  created_by_name
).freeze

Instance Method Summary collapse

Constructor Details

#initialize(notification) ⇒ Notification

Returns a new instance of Notification.



32
33
34
35
36
# File 'lib/notifications/client/notification.rb', line 32

def initialize(notification)
  FIELDS.each do |field|
    instance_variable_set(:"@#{field}", notification.fetch(field.to_s, nil))
  end
end