Class: Coarnotify::Core::Notify::NotifyItem
- Inherits:
-
NotifyPatternPart
- Object
- NotifyBase
- NotifyPatternPart
- Coarnotify::Core::Notify::NotifyItem
- Defined in:
- lib/coarnotify/core/notify.rb
Overview
Default class to represent an item in the COAR Notify pattern. Items are used to represent the ietf:item property in the notification patterns
Specific patterns may need to extend this class to provide their specific behaviours and validation
Direct Known Subclasses
Patterns::AnnounceEndorsementItem, Patterns::AnnounceReviewItem, Patterns::AnnounceServiceResultItem, Patterns::RequestEndorsementItem, Patterns::RequestReviewItem
Instance Attribute Summary
Attributes inherited from NotifyBase
#properties_by_reference, #validate_properties, #validate_stream_on_construct, #validators
Instance Method Summary collapse
-
#media_type ⇒ String
Get the mediaType property of the item.
-
#media_type=(value) ⇒ Object
Set the mediaType property of the item.
-
#validate ⇒ Boolean
Validate the item.
Methods inherited from NotifyPatternPart
#allowed_types, allowed_types, default_type, #initialize, #type=
Methods inherited from 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
#media_type ⇒ String
Get the mediaType property of the item
740 741 742 |
# File 'lib/coarnotify/core/notify.rb', line 740 def media_type get_property(NotifyProperties::MEDIA_TYPE) end |
#media_type=(value) ⇒ Object
Set the mediaType property of the item
747 748 749 |
# File 'lib/coarnotify/core/notify.rb', line 747 def media_type=(value) set_property(NotifyProperties::MEDIA_TYPE, value) end |
#validate ⇒ Boolean
Validate the item. This overrides the base validation, as objects only absolutely require an id property, so the base requirement for a type is relaxed.
755 756 757 758 759 760 761 762 |
# File 'lib/coarnotify/core/notify.rb', line 755 def validate ve = ValidationError.new required_and_validate(ve, ActivityStreams2::Properties::ID, id) raise ve if ve.has_errors? true end |