Class: Pushover::MessageValidator
- Inherits:
-
Object
- Object
- Pushover::MessageValidator
- Defined in:
- lib/pushover/message_validator.rb
Overview
MessageValidator enforces deterministic Message API request rules.
Constant Summary collapse
- ATTACHMENT_LIMIT =
5_242_880- CHARACTER_LIMITS =
{ message: 1024, title: 250, url: 512, url_title: 100 }.freeze
- EMERGENCY_FIELDS =
%i[retry expire callback tags].freeze
- FLAGS =
%i[html monospace].freeze
- PRIORITIES =
[-2, -1, 0, 1, 2].freeze
- STRING_FIELDS =
%i[ user message attachment_base64 attachment_type device sound title url url_title callback tags ].freeze
- SUPPORTED_FIELDS =
(STRING_FIELDS + FLAGS + %i[priority timestamp ttl retry expire encryption_key]).freeze
Instance Method Summary collapse
-
#initialize(**params) ⇒ MessageValidator
constructor
A new instance of MessageValidator.
- #validate ⇒ Object
Constructor Details
#initialize(**params) ⇒ MessageValidator
Returns a new instance of MessageValidator.
17 18 19 |
# File 'lib/pushover/message_validator.rb', line 17 def initialize(**params) @params = params.compact end |
Instance Method Details
#validate ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pushover/message_validator.rb', line 21 def validate validate_supported_fields validate_required_fields validate_string_fields validate_character_limits validate_users validate_devices validate_flags validate_numbers validate_emergency_fields validate_callback validate_encryption_key @params end |