Sha256: 8ca9a04009f99c2a0f502a42fd576e492af1ed2161d95a52b35eac2decc396c0
Contents?: true
Size: 878 Bytes
Versions: 1
Compression:
Stored size: 878 Bytes
Contents
module Notifications class Client class Template FIELDS = [ :id, :type, :created_at, :updated_at, :created_by, :version, :body, :subject ].freeze attr_reader(*FIELDS) def initialize(notification) FIELDS.each do |field| instance_variable_set(:"@#{field}", notification.fetch(field.to_s, nil) ) end end [ :created_at, :updated_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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notifications-ruby-client-2.1.0 | lib/notifications/client/response_template.rb |