Class: Coarnotify::Patterns::AnnounceServiceResultObject

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

Overview

Custom object class for Announce Service Result to apply the custom validation

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

Extend the base validation to include the following constraints:

  • The object type is required and must validate

Returns:

  • (Boolean)

    true if validation passes, else raise a ValidationError



129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/coarnotify/patterns/announce_service_result.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