Commit graph

1638 commits

Author SHA1 Message Date
Alessandro Serpi
4848716948 Improve Telegram Agent description 2018-01-14 15:33:40 +01:00
Alessandro Serpi
00e3119994 Split long Telegram messages 2018-01-14 15:32:51 +01:00
Stefan Siegl
4aaeb16d24
Rescue ZeroDivisionError on validation, closes #2188 2018-01-05 12:38:46 +01:00
Dominik Sander
7c1ec33d64 Fix Liquid interpolation in TwilioAgent helper methods
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
2018-01-04 10:45:03 +01:00
Dominik Sander
1e286bce0f
Merge pull request #2170 from dsander/add-websiteagent-array-extract-option
Add `array` extraction option to WebsiteAgent in HTML/XML mode
2017-12-01 10:49:19 +01:00
Alessandro Serpi
d45edcde7b
Refactor Telegram Agent 2017-12-01 10:44:18 +01:00
Dominik Sander
a04faa8245 Add array extraction option to WebsiteAgent in HTML/XML mode
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.
2017-11-29 14:56:59 +01:00
aserpi
1c8ef93873 Add options to Telegram Agent 2017-11-23 23:03:40 +01:00
Dominik Sander
ecf5a97da9
Merge pull request #2146 from dsander/dropbox-agents
Upgrade Dropbox Agents to new v2 API
2017-11-11 10:05:18 +01:00
Akinori MUSHA
23299f5fb2
Merge pull request #2157 from douniwan5788/web_request_proxy
add proxy support for WebRequestConcern
2017-11-11 15:01:02 +09:00
Dominik Sander
0ef06a389c Allow usage of custom Liquid tags in LiquidOutputAgent
By using the `interpolated` helper method  our custom tags like
`credential` can be used in the LiquidOutputAgent.

Fixes #2042
2017-11-10 22:06:17 +01:00
douniwan5788
9afb62a605
add proxy support for WebRequestConcern 2017-11-06 21:39:08 +08:00
Akinori MUSHA
d937934daf Add a workaround for broken AlreadyRetweeted error detection
https://github.com/sferik/twitter/pull/875
2017-10-29 23:09:00 +09:00
Dominik Sander
eb79f8da1f Upgrade Dropbox Agents to new v2 API 2017-10-16 21:12:47 +02:00
Akinori MUSHA
7023058f20 Do not treat already retweeted/favorited error as failure
There's no use to retry when those errors occur, so just log an error
message and let it go.
2017-10-10 20:52:04 +09:00
Dominik Sander
1448f155d8 Merge pull request #2138 from dsander/improve-telegram-agent
Make TelegramAgent FormConfigurable, DryRunable and add logging
2017-10-03 11:26:37 +02:00
Dominik Sander
da72ecd3af Make TelegramAgent FormConfigurable, DryRunable and add logging
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
2017-10-03 10:54:45 +02:00
Andrew Cantino
ec16163ecd Fix Run Event Propagation search action (#2124) 2017-09-21 02:07:11 -07:00
Dominik Sander
dc9d16812b Fix dry-run modal when clicking on icon in 'Dry Run' button
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.
2017-09-16 13:01:35 +02:00
Andrew Cantino
8925ddb8d5 Handle lazy loading of Agents in gems during Agent.receive! (#2125) 2017-09-16 00:47:57 -07:00
Akinori MUSHA
e99b82b1eb Prevent tweet expansion from firing more than once 2017-09-15 23:38:54 +09:00
Akinori MUSHA
5519e6a1a7 Encode screen_name and id_str in URLs 2017-09-15 23:38:54 +09:00
Akinori MUSHA
0b88ce0edc Enhance the tweets view of TwitterStreamAgent
- 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
2017-09-15 23:38:49 +09:00
Akinori MUSHA
0541b3a31f Merge pull request #2119 from huginn/liquid_lazy_agent_assocs
Do not instantiate all records when liquidizing a record collection
2017-09-11 11:15:02 +09:00
Akinori MUSHA
b4817c74b5 Do not instantiate all records when liquidizing a record collection
Saved memory will be small for the average agent, but this will allow
handling a large amount of agents going forward.
2017-09-08 21:04:30 +09:00
Akinori MUSHA
ed9da9f35e Add working and url to AgentDrop for diagnostic purposes 2017-09-08 18:39:37 +09:00
Shaya G
5e1e5a1907 only add itunes icon if ns_itunes 2017-09-06 23:43:34 -04:00
HyShai
23f8efa109 add itunes podcast icon 2017-09-05 13:42:10 -04:00
Akinori MUSHA
ef03f9f8b6 Fix DataOutputAgent so that it can output items with multiple categories
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...
2017-09-04 20:01:22 +09:00
Akinori MUSHA
d76ea3dea5 Replace some other occurrences of the references to the old URL 2017-09-04 11:15:56 +09:00
Akinori MUSHA
30a4a67a0f Replace references to https://github.com/cantino/huginn with huginn/huginn 2017-09-01 18:56:10 +09:00
Dominik Sander
e9709aec0a Prevent PeakDetectorAgent from storing invalid data in it's memory
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
2017-08-31 21:17:42 +02:00
Moritz Stückler
673db8d0b3 add all parameters except token to the log output 2017-08-07 10:40:30 +02:00
Moritz Stückler
309ae9cc1c add logging output for pushover agent
for debugging purposes there should be a logging output. however the pushover does not have a log output. i added a simple logging output.
2017-08-07 00:57:37 +02:00
Akinori MUSHA
db5c7ab056 Merge pull request #2076 from huginn/enrich_imap_agent_payload
Enrich ImapFolderAgent payload
2017-08-07 01:32:03 +09:00
Akinori MUSHA
4665c305c7 Add a new option include_raw_mail to ImapFolderAgent 2017-08-06 10:01:42 +09:00
Brandon Murphy
94605f5772 address issue #2059 2017-08-04 07:02:22 -07:00
Akinori MUSHA
734b84d185 Add message_id to the payload format of ImapFolderAgent 2017-08-03 20:38:40 +09:00
Dominik Sander
af5da3a165 Merge pull request #2074 from dsander/add-callback-to-growlagent
Add more options to the GrowlAgent
2017-08-01 19:35:16 +02:00
Akinori MUSHA
cec6ce1a56 Merge pull request #2047 from albertsun/update-google-api-client
Update google-api-client and Google agents
2017-08-01 22:46:43 +09:00
Albert Sun
9a17bc68b9 use of_type 2017-08-01 08:37:59 -04:00
Dominik Sander
5f92b38f6e Add more options to the GrowlAgent
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
2017-07-31 22:19:52 +02:00
Dominik Sander
613bb423dc Merge pull request #2069 from chrishein/issue_1723
Add `output_mode` to PostAgent
2017-07-31 10:35:36 +02:00
Christian Hein
463aba9584 Add output_mode to PostAgent
This allows to merge the contents of the the emitted event into
the received event by setting this option to `merge`.
2017-07-30 16:58:42 -03:00
nogre
79fc461bd9 Keep X events to make Digest from (#2041)
* 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
2017-07-28 14:29:25 +02:00
Dominik Sander
4cf58ebbd3 Merge pull request #2070 from chrishein/event_formatting_agent_fix
Add validations for `mode` values in EventFormattingAgent
2017-07-27 11:05:11 +02:00
Christian Hein
4565c73a33 Add validations for mode values
Fix conditional event_description. Should check for `merge` instead of
`merged`.
2017-07-26 10:38:03 -03:00
Géza Búza
6a71295205 Improve documentation of Website Agent (#2066)
Add sample JSON input and output events to clarify how JSONPath works.
2017-07-25 10:10:37 -07:00
Albert Sun
34b56885c8 Use a wrapper class method to invoke GoogleCalendar, per knu's PR feedback 2017-07-22 16:13:07 -04:00
Akinori MUSHA
2fcee4ec28 Remove an obsolete style 2017-07-19 17:49:53 +09:00