Module: SlackNotifiee

Defined in:
lib/slack_notifiee.rb,
lib/slack_notifiee/version.rb,
lib/slack_notifiee/http_client.rb,
lib/slack_notifiee/notification.rb,
lib/slack_notifiee/slack_notifier_extension.rb

Defined Under Namespace

Modules: HttpClient, SlackNotifierExtension Classes: Notification

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.enableObject



12
13
14
15
# File 'lib/slack_notifiee.rb', line 12

def enable
  _reset_storage
  _override_http_client
end

.notificationsObject



22
23
24
25
26
# File 'lib/slack_notifiee.rb', line 22

def notifications
  _storage_path.children.sort.map(&:read).map do |notification_content|
    ::SlackNotifiee::Notification.build_from_json(notification_content)
  end
end

.store_notification(notification) ⇒ Object



17
18
19
20
# File 'lib/slack_notifiee.rb', line 17

def store_notification(notification)
  filepath = _storage_path + "#{ULID.generate}.json"
  File.open(filepath, 'w') { |file| JSON.dump(notification, file) }
end