Class: CommandTower::Messaging::Accept::RequestNormalizer

Inherits:
Object
  • Object
show all
Defined in:
app/services/command_tower/messaging/accept/request_normalizer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, body:, metadata:, preference_state:, platform_enabled_channels:, message_overrides:) ⇒ RequestNormalizer

Returns a new instance of RequestNormalizer.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/services/command_tower/messaging/accept/request_normalizer.rb', line 18

def initialize(
  title:,
  body:,
  metadata:,
  preference_state:,
  platform_enabled_channels:,
  message_overrides:
)
  @title = title
  @body = body
  @metadata = 
  @preference_state = preference_state
  @platform_enabled_channels = platform_enabled_channels
  @message_overrides = message_overrides
end

Class Method Details

.digest_host_event_identity(host_event_identity) ⇒ Object



14
15
16
# File 'app/services/command_tower/messaging/accept/request_normalizer.rb', line 14

def self.digest_host_event_identity(host_event_identity)
  Digest::SHA256.hexdigest(host_event_identity.to_s)
end

.fingerprint(**kwargs) ⇒ Object



10
11
12
# File 'app/services/command_tower/messaging/accept/request_normalizer.rb', line 10

def self.fingerprint(**kwargs)
  new(**kwargs).fingerprint
end

Instance Method Details

#canonical_jsonObject



38
39
40
# File 'app/services/command_tower/messaging/accept/request_normalizer.rb', line 38

def canonical_json
  JSON.generate(canonical_payload)
end

#fingerprintObject



34
35
36
# File 'app/services/command_tower/messaging/accept/request_normalizer.rb', line 34

def fingerprint
  Digest::SHA256.hexdigest(canonical_json)
end