Class: Coarnotify::Patterns::AnnounceReviewObject

Inherits:
Core::Notify::NotifyObject show all
Defined in:
lib/coarnotify/patterns/announce_review.rb

Overview

Custom Announce Review Object to apply custom validation for this pattern

Instance Attribute Summary

Attributes inherited from Core::Notify::NotifyBase

#properties_by_reference, #validate_properties, #validate_stream_on_construct, #validators

Instance Method Summary collapse

Methods inherited from Core::Notify::NotifyObject

#cite_as, #cite_as=, #item, #item=, #triple, #triple=

Methods inherited from Core::Notify::NotifyPatternPart

#allowed_types, allowed_types, default_type, #initialize, #type=

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::NotifyPatternPart

Instance Method Details

#validateBoolean

In addition to the base validator this:

  • Makes type required

Returns:

  • (Boolean)

    true if valid, else raises ValidationError



129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/coarnotify/patterns/announce_review.rb', line 129

def validate
  ve = Core::Notify::ValidationError.new

  begin
    super
  rescue Core::Notify::ValidationError => superve
    ve = superve
  end

  required_and_validate(ve, Core::ActivityStreams2::Properties::TYPE, type)

  raise ve if ve.has_errors?
  true
end