class Printos::NotificationService

Constants

API_BASE

Public Class Methods

send_notification(event_name, link_label, entity_id, sub_value, sub_value_params, org_id) click to toggle source
# File lib/printos/notification_service.rb, line 7
def self.send_notification(event_name, link_label, entity_id, sub_value, sub_value_params, org_id)

  Printos.config.logger.debug { "Sending notification: #{{
    event_name: event_name,
    link_label: link_label,
    entity_id: entity_id,
    sub_value: sub_value,
    sub_value_params: sub_value_params,
    org_id: org_id}}" }

  body = {
    'eventName': event_name,
    'linkLabel': link_label,
    'entityId': entity_id,
    'subValue': sub_value,
    'subValueParams': sub_value_params,
    'orgId': org_id,
    'timestamp': Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S.%LZ'),
  }

  post_resource("#{API_BASE}/event/notify", body, true)
end