Class: SlackIntegration
Constant Summary
collapse
- ALL_FEATURES =
%i[commands notifications].freeze
- SCOPE_COMMANDS =
'commands'
- SCOPE_CHAT_WRITE =
'chat:write'
- SCOPE_CHAT_WRITE_PUBLIC =
'chat:write.public'
- SCOPES =
[SCOPE_COMMANDS, SCOPE_CHAT_WRITE, SCOPE_CHAT_WRITE_PUBLIC].freeze
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Instance Method Summary
collapse
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Instance Method Details
#all_features_supported? ⇒ Boolean
67
68
69
|
# File 'app/models/slack_integration.rb', line 67
def all_features_supported?
ALL_FEATURES.all? { |feature| feature_available?(feature) } end
|
#authorized_scope_names ⇒ Object
78
79
80
|
# File 'app/models/slack_integration.rb', line 78
def authorized_scope_names
slack_api_scopes.pluck(:name)
end
|
#authorized_scope_names=(names) ⇒ Object
#feature_available?(feature_name) ⇒ Boolean
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'app/models/slack_integration.rb', line 50
def feature_available?(feature_name)
case feature_name
when :commands
true
when :notifications
scoped_to?(SCOPE_CHAT_WRITE, SCOPE_CHAT_WRITE_PUBLIC)
else
false
end
end
|
#update_active_status_of_integration ⇒ Object
46
47
48
|
# File 'app/models/slack_integration.rb', line 46
def update_active_status_of_integration
integration.update_active_status
end
|
#upgrade_needed? ⇒ Boolean
63
64
65
|
# File 'app/models/slack_integration.rb', line 63
def upgrade_needed?
!all_features_supported?
end
|