Class: Coarnotify::Patterns::UnprocessableNotification

Inherits:
Core::Notify::NotifyPattern show all
Includes:
Core::Notify::SummaryMixin
Defined in:
lib/coarnotify/patterns/unprocessable_notification.rb

Overview

Pattern to represent the Unprocessable Notification notification coar-notify.net/specification/1.0.0/unprocessable/

Instance Attribute Summary

Attributes inherited from Core::Notify::NotifyBase

#properties_by_reference, #validate_properties, #validate_stream_on_construct, #validators

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Core::Notify::SummaryMixin

#summary, #summary=

Methods inherited from Core::Notify::NotifyPattern

#actor, #actor=, #context, #context=, #ensure_type_contains, #in_reply_to, #in_reply_to=, #initialize, #object, #object=, #origin, #origin=, #target, #target=

Methods inherited from Core::Notify::NotifyBase

#doc, #get_property, #id, #id=, #initialize, #optional_and_validate, #register_property_validation_error, #required, #required_and_validate, #set_property, #to_jsonld, #type, #type=, #validate_property

Constructor Details

This class inherits a constructor from Coarnotify::Core::Notify::NotifyPattern

Class Method Details

.type_constantObject



14
15
16
# File 'lib/coarnotify/patterns/unprocessable_notification.rb', line 14

def self.type_constant
  Core::Notify::NotifyTypes::UNPROCESSABLE_NOTIFICATION
end

Instance Method Details

#validateBoolean

In addition to the base validation apply the following constraints:

  • The inReplyTo property is required

  • The summary property is required

Returns:

  • (Boolean)

    true if validation passes, otherwise raise a ValidationError



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/coarnotify/patterns/unprocessable_notification.rb', line 24

def validate
  ve = ValidationError.new
  begin
    super
  rescue ValidationError => superve
    ve = superve
  end

  # Technically, no need to validate the value, as this is handled by the superclass,
  # but leaving it in for completeness
  required_and_validate(ve, Core::ActivityStreams2::Properties::IN_REPLY_TO, in_reply_to)
  required(ve, Core::ActivityStreams2::Properties::SUMMARY, summary)

  raise ve if ve.has_errors?
  true
end