lib/chook/event.rb in chook-1.1.2 vs lib/chook/event.rb in chook-1.1.5b1

- old
+ new

@@ -63,12 +63,13 @@ # EVENTS = { 'ComputerAdded' => Chook::Subject::COMPUTER, 'ComputerCheckIn' => Chook::Subject::COMPUTER, 'ComputerInventoryCompleted' => Chook::Subject::COMPUTER, - 'ComputerPolicyFinished' => Chook::Subject::COMPUTER, + 'ComputerPolicyFinished' => Chook::Subject::POLICY_FINISHED, 'ComputerPushCapabilityChanged' => Chook::Subject::COMPUTER, + 'DeviceAddedToDEP' => Chook::Subject::DEP_DEVICE, 'JSSShutdown' => Chook::Subject::JAMF_SOFTWARE_SERVER, 'JSSStartup' => Chook::Subject::JAMF_SOFTWARE_SERVER, 'MobileDeviceCheckIn' => Chook::Subject::MOBILE_DEVICE, 'MobileDeviceCommandCompleted' => Chook::Subject::MOBILE_DEVICE, 'MobileDeviceEnrolled' => Chook::Subject::MOBILE_DEVICE, @@ -92,10 +93,13 @@ # values from the Event::EVENTS Hash. SUBJECT_CLASS_CONST = 'SUBJECT_CLASS'.freeze #### Attrbutes common to all events + # @return [String] A unique identifier for this chook event + attr_reader :id + # @return [Integer] The webhook id in the JSS that caused this event attr_reader :webhook_id # @return [String] The webhook name in the JSS that caused this event attr_reader :webhook_name @@ -126,9 +130,10 @@ # webhook_name: [String] The name of the webhook defined in the JSS # The remaning keys are the attributes of the Subject subclass for this # event. Any not provided will be nil. # def initialize(**args) + @id = "#{Time.now.to_i}-#{SecureRandom.urlsafe_base64 8}" if args[:raw_json] @raw_json = args[:raw_json] @parsed_json = JSON.parse @raw_json, symbolize_names: true elsif args[:parsed_json] @parsed_json = args[:parsed_json]