Class: Notifications::Client::TemplatePreview

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

Constant Summary collapse

FIELDS =
%i(
  id
  version
  body
  subject
  type
  html
).freeze

Instance Method Summary collapse

Constructor Details

#initialize(notification) ⇒ TemplatePreview

Returns a new instance of TemplatePreview.



15
16
17
18
19
# File 'lib/notifications/client/template_preview.rb', line 15

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