Sha256: 20e17c556f1bee417ad27c1f3ae2cc003012f33533ed81253702a715fee670db

Contents?: true

Size: 780 Bytes

Versions: 13

Compression:

Stored size: 780 Bytes

Contents

module Auth::Concerns::Work::InformConcern

	extend ActiveSupport::Concern
	
	included do 	
		## what does this do really ?
		field :who_and_when_to_inform, type: Hash
		field :inform_on_actions, type: Array, default: []
			
		after_update do |document|
			document.inform if document.inform_on_actions.include? "after_update"
		end

		before_destroy do |document|
			document.inform if document.inform_on_actions.include? "before_destroy"
		end

		def inform
			self.who_and_when_to_inform.keys.each do |person_id|
				information = Auth::Work::Information.new
				information.resource_id = person_id
				information.send_at = self.who_and_when_to_inform[person_id]
				## other options can be added.
				## like payload and format.
				information.inform
			end
		end

	end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wordjelly-auth-1.2.3 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.2.2 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.2.1 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.2.0 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.9 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.8 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.7 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.6 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.5 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.4 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.3 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.2 app/models/auth/concerns/work/inform_concern.rb
wordjelly-auth-1.1.1 app/models/auth/concerns/work/inform_concern.rb