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
  one_click_unsubscribe_url
  cost_in_pounds
  is_cost_data_ready
  cost_details
).freeze

Instance Method Summary collapse

Constructor Details

#initialize(notification) ⇒ Notification

Returns a new instance of Notification.



36
37
38
39
40
# File 'lib/notifications/client/notification.rb', line 36

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