Class: CommandTower::Messaging::Rendering::RenderedPushoverPayload

Inherits:
Data
  • Object
show all
Defined in:
app/services/command_tower/messaging/rendering/rendered_pushover_payload.rb

Overview

Provider-neutral Pushover rendered payload. recipient_address is the opaque endpoint id resolved by RecipientReadiness — never credentials.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



8
9
10
# File 'app/services/command_tower/messaging/rendering/rendered_pushover_payload.rb', line 8

def message
  @message
end

#recipient_addressObject (readonly)

Returns the value of attribute recipient_address

Returns:

  • (Object)

    the current value of recipient_address



8
9
10
# File 'app/services/command_tower/messaging/rendering/rendered_pushover_payload.rb', line 8

def recipient_address
  @recipient_address
end

#titleObject (readonly)

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



8
9
10
# File 'app/services/command_tower/messaging/rendering/rendered_pushover_payload.rb', line 8

def title
  @title
end

Class Method Details

.build(recipient_address:, title:, message:) ⇒ Object

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/services/command_tower/messaging/rendering/rendered_pushover_payload.rb', line 13

def self.build(recipient_address:, title:, message:)
  values = [recipient_address, title, message]
  raise ArgumentError, "arbitrary hashes are not accepted" if values.any? { |v| v.is_a?(Hash) }
  raise ArgumentError, "ActiveRecord objects are not accepted" if values.any? { |v| active_record_like?(v) }
  raise ArgumentError, "raw exception objects are not accepted" if values.any? { |v| v.is_a?(Exception) }

  validate_required_string!(recipient_address, "recipient_address")
  validate_required_string!(title, "title")
  validate_required_string!(message, "message")

  new(
    recipient_address:,
    title:,
    message:,
  ).freeze
end