EventFormattingAgent: Provide access to upstream agent #410

Merged
merged 11 commits into from Jul 29, 2014

Projects

None yet

4 participants

@knu
Collaborator

Excerpt from the commit log of e55bb4a:

With this enhancement you can, for example, embed the site URL in an
event created by WebsiteAgent by interpolating like
"{{agent.options.url}}", or add a message prefix depending on the type
of upstream agent using the "case" construct of Liquid.

I believe user cannot do harm via AgentDrop, but let me know if I'm missing something.

knu added some commits Jul 22, 2014
@knu knu Add Agent#short_type. 4be27d5
@knu knu Fix a leftover of JsonPath to Liquid conversion. a25e4f6
@knu knu EventFormattingAgent: Enable access to upstream agent info via "agent".
With this enhancement you can, for example, embed the site URL in an
event created by WebsiteAgent by interpolating like
"{{agent.options.url}}", or add a message prefix depending on the type
of upstream agent using the "case" construct of Liquid.
e55bb4a
@knu knu Remove the "skip_agent" option from EventFormattingAgent.
It is now possible to include an agent name without the special flag
just by putting `"agent" => "{{agent.type}}"` in "instructions".

This commit includes automatic migration.
f79e26d
@coveralls

Coverage Status

Coverage decreased (-0.1%) when pulling f79e26d on knu:provide_access_to_agent into 67fcfef on cantino:master.

@coveralls

Coverage Status

Coverage decreased (-44.77%) when pulling 9823ac7 on knu:provide_access_to_agent into 67fcfef on cantino:master.

@coveralls

Coverage Status

Coverage decreased (-0.0%) when pulling 9ab66aa on knu:provide_access_to_agent into 67fcfef on cantino:master.

@cantino
Owner

Very interesting @knu! Do you think we should have specs on AgentDrop itself?

@alias1 alias1 added the enhancement label Jul 23, 2014
@knu
Collaborator

Sure, added!

@coveralls

Coverage Status

Coverage increased (+0.03%) when pulling a799408 on knu:provide_access_to_agent into 67fcfef on cantino:master.

@coveralls

Coverage Status

Coverage increased (+0.03%) when pulling 6c30b16 on knu:provide_access_to_agent into 67fcfef on cantino:master.

@cantino
Owner

Awesome, thanks. Do you think we should expose this anywhere we use interpolated in any Agent?

@knu
Collaborator

Probably having an EventDrop that returns the payload + .agent for interpolation is the way to go. Let me try.

@knu knu Make {{agent}} universally accessible from any agent.
To implement this, EventDrop is introduced to represent an Event object
in interpolation.
c1f114d
@coveralls

Coverage Status

Coverage increased (+0.11%) when pulling c1f114d on knu:provide_access_to_agent into 67fcfef on cantino:master.

@knu
Collaborator

@cantino It's done! I'll be working on a hover-help for Options to explain Liquid interpolation.

@coveralls

Coverage Status

Coverage increased (+0.11%) when pulling 00514d2 on knu:provide_access_to_agent into 67fcfef on cantino:master.

@coveralls

Coverage Status

Coverage increased (+0.09%) when pulling 307ef15 on knu:provide_access_to_agent into 67fcfef on cantino:master.

@knu
Collaborator

@cantino I think this is now in a good shape for merge, thanks for looking!

@coveralls

Coverage Status

Coverage increased (+0.03%) when pulling 8596bd0 on knu:provide_access_to_agent into 67fcfef on cantino:master.

@cantino
Owner

Thanks @knu, this looks great. I'll review closely this weekend, deploy to my setup, and merge.

@cantino cantino merged commit e746bee into cantino:master Jul 29, 2014

1 check passed

Details continuous-integration/travis-ci The Travis CI build passed
@cantino
Owner

Merged @knu, thanks! Can you update the wiki in the Liquid article about this?

@cantino
Owner

(Also, did you get the email I sent you to knu@idaemons.org?)

@knu
Collaborator

@cantino Thanks for merging it! I guess skip_created_at also can be deprecated after adding created_at to EventDrop, so I'll try that later.

@knu
Collaborator

@cantino I'm yet to locate your mail. Could you give me any of Message-Id/Date/From?

@cantino
Owner

Odd. I'm happy to send it again. It's from andrew at andrewcantino.

Message-ID: <CALXA01RwqU5hz9Nni-BJqK7FqXAobCh4L-0WCu7Dtff4bzyB+w@mail.gmail.com>
@knu
Collaborator

I successfully received the mail, for the record.

@knu
Collaborator

@cantino I updated the wiki page, review appreciated!

@cantino
Owner

Looks good! Would you mind adding an example configuration that shows accessing a property from the event and agent? Something like "{{ event.agent.title }}" right? (Or is it just {{ agent.title }}?)

@knu knu deleted the knu:provide_access_to_agent branch Aug 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment