Class: Coarnotify::Core::Notify::NotifyActor

Inherits:
NotifyPatternPart show all
Defined in:
lib/coarnotify/core/notify.rb

Overview

Default class to represents an actor in the COAR Notify pattern. Actors are used to represent the actor property in the notification patterns

Specific patterns may need to extend this class to provide their specific behaviours and validation

Instance Attribute Summary

Attributes inherited from NotifyBase

#properties_by_reference, #validate_properties, #validate_stream_on_construct, #validators

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NotifyPatternPart

#allowed_types, #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, #validate_property

Constructor Details

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

Class Method Details

.allowed_typesObject

The allowed types for an actor: Service, Application, Group, Organisation, Person



707
708
709
710
711
712
713
714
715
# File 'lib/coarnotify/core/notify.rb', line 707

def self.allowed_types
  [
    ActivityStreams2::ActivityStreamsTypes::SERVICE,
    ActivityStreams2::ActivityStreamsTypes::APPLICATION,
    ActivityStreams2::ActivityStreamsTypes::GROUP,
    ActivityStreams2::ActivityStreamsTypes::ORGANIZATION,
    ActivityStreams2::ActivityStreamsTypes::PERSON
  ]
end

.default_typeObject

Default type is Service, but can also be set as any one of the other allowed types



702
703
704
# File 'lib/coarnotify/core/notify.rb', line 702

def self.default_type
  ActivityStreams2::ActivityStreamsTypes::SERVICE
end

Instance Method Details

#nameString

Get the name property of the actor

Returns:

  • (String)

    the name



720
721
722
# File 'lib/coarnotify/core/notify.rb', line 720

def name
  get_property(NotifyProperties::NAME)
end

#name=(value) ⇒ Object

Set the name property of the actor

Parameters:

  • value (String)

    the name to set



727
728
729
# File 'lib/coarnotify/core/notify.rb', line 727

def name=(value)
  set_property(NotifyProperties::NAME, value)
end