public
Created

Streama (Specification of Activities)

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
# Is it possible with the current streama DSL to explicitly say that the verb is not the identifier?
activity :created_event do
actor :user, :cache => [:username, :slug]
verb :post
object :event, :cache => [:name, :acronym, :slug]
end
 
# The combination of actor, verb, object (and target) has implicit and unique representation of the activity
# => maybe the identifier can be ommitted?
activity do
actor :user, :cache => [:username, :slug]
verb :post
object :event, :cache => [:name, :acronym, :slug]
end
 
# And when we are changing the DSL we could make the actor optional
# and give it globally a default
activity.defaults do
actor :user, :cache => [:username, :slug]
end
 
# Implicit identifier and default actor:
activity do
verb :post
object :event, :cache => [:name, :acronym, :slug]
end
# => :user, :post and :event is unique representation of the activity
# => :post_event could be the implicit identifier which is the same as :user_post_event (user is default).
 
# Giving explicit actors should still be possible:
activity do
actor :organizer, :cache [:forename, :surname]
verb :update
target :call_for_papers
end
# => :organizer_update_call_for_papers is implicit identifier
 
# Giving explicit identifiers should still be possible:
activity :custom_identifier do
verb :post
object :event
end
# => :custom_identifier is explicit identifier

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.