Class: Action
- Inherits:
-
MLS::Model
- Object
- ActiveRecord::Base
- MLS::Model
- Action
- Defined in:
- lib/mls/models/action.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
Class Method Summary collapse
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
3 4 5 |
# File 'lib/mls/models/action.rb', line 3 def account_id @account_id end |
Class Method Details
.by_performer(filter) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/mls/models/action.rb', line 11 def self.by_performer(filter) req = Net::HTTP::Get.new("/actions/by_performer") req.body = { where: filter }.to_json JSON.parse(connection.instance_variable_get(:@connection).send_request(req).body) end |
.squash(attributes) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mls/models/action.rb', line 19 def self.squash(attributes) squashed_actions = [] where(nil).each do |action| action.account_id = action..where(key: 'performed_by_id').first&.value action.diff = action.diff.slice(*attributes) if attributes if squashed_actions.last && action.account_id == squashed_actions.last.account_id && action. + 15.minutes > squashed_actions.last. action.diff.each do |key, value| next if value[0] == value[1] # filter sometimes logs even if the same if squashed_actions.last.diff[key] squashed_actions.last.diff[key][0] = value[0] else squashed_actions.last.diff[key] = value end end else squashed_actions << action end end squashed_actions end |