The Agent did not use `interpolate_with` in it's `receive` method,
which lead to `interpolated[...]` calls in `send_message` and
`make_call` always returning empty strings.
The new `interpolate_with_each` helper iterates over an array of
objects and yields each object in a `interpolated_with(object)`
context.
Fixes#2186
Setting `array` to `true` for an extractor allows the extraction of list
elements into an array or when working with websites that have varying
amount of elements matching a specific selector:
Response A:
```html
<h1>header</h1>
<div id="content">
<div></div>
<div></div>
<div class="bogus"></div>
<div>
```
Response B:
```html
<h1>header</h1>
<div id="content">
<div></div>
<div></div>
<div class="bogus"></div>
<div></div>
<div>
```
The goal is to extract the header and all `div`s inside `#content` that
are not `.bogus` into one Event. Having the `array` option makes this
possible with `css: '#content div:not(.bogus) ', array: true` which
would otherwise fail with an uneven amount of matches exception.
Currently the work around would be the extract the header and `#content`
in one WebsiteAgent and extract the `div`s in a second Agent. This does
not work in my use case because the HTML inside `#content` is
malformatted and leads to Nokogiri paring errors.
Makes the Agent easier to use and to debug. It now verifies the API
token and auto completes the `chat_id`.
Log entries are only created on failure to avoid cluttering the Agent
log.
#2135
tl;dr: By using `e.currentTarget` instead of `e.target` we ensure to always
pass the `button` element to `Utils.handleDryRunButton`.
`target` refers to the actual element the user clicked on, we then
passed the glyphicon span to `Utils.handleDryRunButton` which requested
`window.location` via ajax because `$(button).data('action-url')` returned
`undefined`.
Evaluating the whole page then triggered
`Error: rails-ujs has already been loaded!`, as a result the user can not
interact with anything that requires `rails-ujs`, `jquery` or bootstrap
javascript.
- Use the `extended_tweet.full_text` property instead of `text`
- Show the time and links to the tweet and event for each tweet
- Clicking on the tweet text replaces it with the embedded tweet widget
The to_xml method encodes `{ "category": ["a", "b"] }` as follows:
```xml
<item>
<category>
<category>a</category>
<category>b</category>
</category>
</item>
```
Instead of this:
```xml
<item>
<category>a</category>
<category>b</category>
</item>
```
Even if `category` is a singular noun. This feature prevents
DataOutputAgent from emitting multiple `<category>` elements (or
`<enclosure>`, etc.) properly, so I've added a tweak to fix the
resulted XML document.
I know the code in the current form is far from optimal, so I think
we'll have to revisit here soon or later...
The Agent expects the data in its memory groups to be castable to a
float. By attempting the type cast when receiving events we prevent the
memory from being corrupted with invalid data which lead exceptions
while trying to access it.
#2101
It now additionally allows to use `sticky`, `priority` and
`callback_url`. The Agent is now `FormConfigurable` and supports Liquid
in all options.
`register_growl` had to be moved inside of the `events` loop to allow
Liquid interpolation for the previously static `growl_*` options.
#2018
* Keep X events to make Digest from
Added a configuration option to save a fixed number of events for the Digest. Currently all received events are purged when an event is emitted by this agent. This option allows received events to be remembered and reused for future Digests.
* added validate_options for new config
Added a check to prevent negative numbers, which would cause breakage. Also gave an upper limit at 999, just to set a sane maximum.
* removed unnecessary while loop
As suggested by @dsander here: https://github.com/huginn/huginn/pull/2041#discussion_r123965060
* Updated name of feature and description
* ensure retained_events is an Integer
* typo in check if retained events is int
* specs for digest_agent
* removed validate as integer
* removed check for integer status
* Rspec mostly working
Got rspec mostly working. The #'working?' check for events received in last few days is failing for me, but it was failing for other agents too on my setup. Likely a local problem, so lets see if this passes the automated builds.
* removed comments
ack. forgot about those