Class: Coarnotify::Patterns::AnnounceRelationshipObject
- Inherits:
-
Core::Notify::NotifyObject
- Object
- Core::Notify::NotifyBase
- Core::Notify::NotifyPatternPart
- Core::Notify::NotifyObject
- Coarnotify::Patterns::AnnounceRelationshipObject
- Defined in:
- lib/coarnotify/patterns/announce_relationship.rb
Overview
Custom object class for Announce Relationship 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
-
#validate ⇒ Boolean
Extend the base validation to include the following constraints:.
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
#validate ⇒ Boolean
Extend the base validation to include the following constraints:
-
The object type is required and must validate
-
The as:subject property is required
-
The as:object property is required
-
The as:relationship property is required
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/coarnotify/patterns/announce_relationship.rb', line 63 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) required_and_validate(ve, Core::ActivityStreams2::Properties::SUBJECT_TRIPLE, subject) required_and_validate(ve, Core::ActivityStreams2::Properties::OBJECT_TRIPLE, object_triple) required_and_validate(ve, Core::ActivityStreams2::Properties::RELATIONSHIP_TRIPLE, relationship) raise ve if ve.has_errors? true end |