Class: ProactiveSupport::Mgmt::Flags
- Inherits:
-
Object
- Object
- ProactiveSupport::Mgmt::Flags
- Defined in:
- lib/proactive_support/mgmt/flags.rb
Class Method Summary collapse
- .clear(customer_id, source, identifier, filter) ⇒ Object
- .clear_identifier(customer_id, source, identifier) ⇒ Object
- .clear_source(customer_id, source) ⇒ Object
- .set(customer_id, source, identifier, filter, message, options = {}) ⇒ Object
Class Method Details
.clear(customer_id, source, identifier, filter) ⇒ Object
23 24 25 |
# File 'lib/proactive_support/mgmt/flags.rb', line 23 def clear(customer_id, source, identifier, filter) clear_matching customer_id, {digest: to_digest(source, identifier, filter)} end |
.clear_identifier(customer_id, source, identifier) ⇒ Object
27 28 29 |
# File 'lib/proactive_support/mgmt/flags.rb', line 27 def clear_identifier(customer_id, source, identifier) clear_matching customer_id, {source: source, identifier: identifier} end |
.clear_source(customer_id, source) ⇒ Object
31 32 33 |
# File 'lib/proactive_support/mgmt/flags.rb', line 31 def clear_source(customer_id, source) clear_matching customer_id, {source: source} end |
.set(customer_id, source, identifier, filter, message, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/proactive_support/mgmt/flags.rb', line 5 def set(customer_id, source, identifier, filter, , = {}) digest = to_digest source, identifier, filter ::ProactiveSupport::Flag.where(customer_id: customer_id, digest: digest).first_or_initialize.tap do |f| f.source = source f.identifier = identifier f.filter = clean_object filter f. = .to_str[0,255] # truncate to size of db column f.level = [:level] || ::ProactiveSupport::INFO f.debug_params = clean_object [:debug_params] f. = [:tags] f.is_transient = .fetch(:transient, true) ? true : false f.last_triggered_at = ::Time.now f.is_active = true f.save! end end |