Commit graph

963 commits

Author SHA1 Message Date
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
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
Christian Hein
52dbaaa586 Add spec for mode value validation 2017-07-26 10:50:29 -03: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
Akinori MUSHA
3ffe667f9e Allow controllers to be selected 2017-07-19 11:24:22 +09:00
Akinori MUSHA
0abc42fb40 Add specs for creating agents with a source/receiver/control target 2017-07-19 11:23:19 +09:00
Akinori MUSHA
e7ab172b30 Introduce capybara-screenshot to make debugging easier 2017-07-19 10:30:52 +09:00
Akinori MUSHA
8645323dfe Expose target to CommanderAgent in templating
This allows a CommanderAgent to control only some of the targets
depending on the agent attributes.  For example, you can update the
threshold value of a target agent only if the current value is
lower (or higher) than the suggested new value.
2017-07-09 03:34:05 +09:00
Albert Sun
511bf14bac fix specs. the google calendar ones aren't actually using vcr so removing that 2017-07-07 17:10:07 -04:00
Albert Sun
596c6b5ae6 fix calendar spec mock 2017-07-05 15:02:33 -04:00
Albert Sun
78b68ae4c3 Update Google Agents
Updates google-api-client to 0.13 along with GoogleCalendarPublishAgent
and GoogleTranslationAgent to newer API signatures. In preparation for
including a google-cloud-bigquery gem and Agent which would otherwise
have dependency version mismatches.

May break backwards compatibility for the GoogleCalendarPublishAgent due to Google's new preferred
  authentication method. PKCS12 keys are no longer support by the gem,
  in favor of RSA private keys / JSON key files.

The new API no longer uses a discovery method and implements methods in
Ruby, adopting snake case names for object keys. So `dateTime` becomes
`date_time`. `time_zone` also appears to now be required.
2017-06-30 18:04:28 -04:00
Dominik Sander
154c058729 Merge pull request #2017 from Skarlso/eliminated_eval_from_jsonpath
Update JsonPath to latest version.
2017-06-06 19:21:07 +02:00
Akinori MUSHA
fe36ce1166 Merge pull request #2014 from huginn/fix_1940
Protect the latest event from automatic deletion when using MySQL
2017-06-06 11:01:28 +09:00
Gergely Brautigam
073ae10332
Removing obsolete test and environment property. 2017-05-29 20:48:50 +02:00
Akinori MUSHA
5fadd12be6 Protect the latest event from automatic deletion when using MySQL
Detecting the database type by the name this time, because
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter is defined only
if the mysql2 gem is loaded.

This works around #1940 for the most typical cases.
2017-05-28 01:41:59 +09:00
Akinori MUSHA
6839bb6d85 Update the basic auth mocking for webmock 2 2017-05-28 01:08:28 +09:00
Akinori MUSHA
98e80c57b0 Fix a test for escaped double-quotes for ruby >=2.4 2017-05-28 01:07:54 +09:00
Akinori MUSHA
0f5edc9051 2.class is Integer (instead of Fixnum) in ruby >=2.4 2017-05-28 01:07:54 +09:00
Akinori MUSHA
7ea7cca804 Webmock 2 does not support userinfo in URL 2017-05-28 01:07:53 +09:00
Akinori MUSHA
c1b786018f The twitter gem now requires a proper Content-Type 2017-05-28 01:07:53 +09:00
Akinori MUSHA
7663698673 Webmock 2 does not support matching body for multipart/form-data
https://github.com/bblimke/webmock/issues/623
2017-05-28 01:07:53 +09:00
Akinori MUSHA
53a046e843 Merge branch 'configurable_search_url' 2017-05-25 07:05:13 +09:00
Akinori MUSHA
6a7221a9da Use URI Template (RFC 6570) for interpolating search_url 2017-05-25 06:40:54 +09:00
Michael Andrews
63389f41b7 Fix spec expectation when USE_GRAPHVIZ_DOT is defined 2017-05-23 14:53:15 -07:00
Aleksey Ivanov
0e9c24ab54 Falling back to default 'search_url' and docs 2017-05-23 12:21:31 +03:00
Aleksey Ivanov
eccb449dfd Add configurable search_url #1552 2017-05-22 22:34:20 +03:00
Dominik Sander
df6fa9f9d4 Remove database_cleaner gem
In Rails 5.1 transactional tests share the same connection id between
the webserver and test runner. This removes the need for special cleanup
strategies.

This speeds up the tests significantly, before:
```
Finished in 3 minutes 30.3 seconds (files took 5.46 seconds to load)
```

After:
```
Finished in 1 minute 41.61 seconds (files took 5.45 seconds to load)
```

https://github.com/rails/rails/pull/28083
2017-05-19 09:24:48 +02:00
Akinori MUSHA
1b84518b7f Merge pull request #1990 from huginn/shell_out_unbundled
Add a new option `unbundle` to ShellCommandAgent
2017-05-18 21:47:29 +09:00
Andrew Cantino
9ad4741212 Revert "Protect the latest event from automatic deletion when using MySQL" (#1993) 2017-05-01 14:17:42 +12:00
Akinori MUSHA
807c493efe Add a tweak for Travis where BUNDLE_GEMFILE is preset 2017-04-28 20:41:54 +09:00
Akinori MUSHA
eb48fd3f6d Merge pull request #1974 from cantino/fix_1940
Protect the latest event from automatic deletion when using MySQL
2017-04-28 19:29:25 +09:00
Akinori MUSHA
10e0398444 Add a new option unbundle to ShellCommandAgent
This addresses #1989.
2017-04-28 19:23:03 +09:00
Albert Sun
2ac6927a6a Option for custom response headers for receive_web_request (#1977)
* Option for custom response headers for receive_web_request

In DataOutputAgent, WebhookAgent, LiquidOutputAgent, this enables
setting options['response_headers'] as a JSON object with custom
response headers to set on the HTTP response through the
WebRequestsController.

* code copy edits from @cantino
2017-04-27 12:19:59 +12:00
Jon Neverland
2b41b6cc54 Google translate (#1978)
* Added GoogleTranslationAgent

* Well, I forgot to add it..

* Wrong ruby version

* Removed duplicate GoogleTranslationAgent

* Fixed Gemfile upgrades by adding required version of jwt

* Added spec for GoogleTranslationAgent and fixed description

* PR fixes:
No more hash rockets
Added info to description
Indentation

* Deleted TranslationAgent because service is deprecated

* Reverted google-api-client version

* Downgraded rest of gems and fixed hash rockets

* More PR fixes
2017-04-26 17:49:05 +12:00
Warloxx
e3f79bf84b Rss agent dynamic cleanup (#1733)
* Remove fixed limit of 500 IDs used to figure out which entries are new.
Instead each ID that is checked against the seen_ids gets moved to the top of the list.
IDs that are no longer used in the RSS Feed will end up at the bottom of the seen_ids list end will be removed.

* remove uncommented code line

* fix undefined method `count' for nil:NilClass, in case the first fetch of an rss feed failed or fetched empty rss feed.

changed spec to verify the deletion of old ids by keeping all current ones, not by fixed limit

* revert changes for dynamic cleanup.
Instead made the limit of stored ids configurable. (key: max_ids)
Default limit will remain 500.

* fixed error message.
replaced repeated function call with single call specifying amount.
using options['max_ids'] instead of interpolated['max_ids'] to retrieve setting.

* Rename to remembered_id_count and fix spec

* Update rss_agent.rb

fixed indentation
2017-04-24 10:44:03 +12:00
Akinori MUSHA
be16c50bbd Add a spec for the change 2017-04-19 20:04:44 +09:00
Akinori MUSHA
722349c5cd Make DataOutputAgent serve RSS output as application/rss+xml
For backward compatibility, a new option `rss_content_type` is added
and existing agents will have its value set to `text/xml`, which was
the Content-Type value before this change.

This fixes #1968.
2017-04-19 17:35:46 +09:00
Dominik Sander
3726709efd Fix dry runs controller spec 2017-04-12 13:32:58 +02:00
Dominik Sander
fbc892d9da Merge pull request #1965 from dsander/dry-run-event-created_at
Set created_at of dry-runned event to the current time
2017-04-12 13:15:48 +02:00
Akinori MUSHA
652eb4418f DataOutputAgent should not override events in each event
This fixes #1963.
2017-04-12 19:24:13 +09:00
Dominik Sander
d277afbe12 Set created_at of dry-runned event to the current time
Allows the usage of `{{created_at}}` when dry-running Agents.

 #1964
2017-04-11 22:30:50 +02:00
Zack Fernandes
f21d6abaee Create Tumblr Likes Agent (#1923)
* Create Tumblr Likes Agent

* Don't interpolate options

* Clear ID memory after 50 entries

In order to prevent the ID array from getting to large, keep only the
last 50 entries. 50 is currently the maximum the API will return at a
time, so we should never exceed that limit.

* Request likes after the last recorded like

Instead of just returning blog likes, request only likes after the
timestamp of the last liked item we’ve processed.
2017-04-07 19:27:24 -04:00
Akinori MUSHA
5f881ee786 Give ChangeDetectorAgent access to last_property
This allows user to detect a new lowest value or a new high by
comparing a new value with the existing value.
2017-03-30 21:21:26 +09:00
aeter
d75e4c7cef Close #801 - peak detector min datapoints (#1924)
Closes -- https://github.com/cantino/huginn/issues/801
Testing -- ran rspec
About --
  Adds an option `min_events` to the peak detector agent. The
  agent will start looking for peaks only after min number of
  events are accumulated.
2017-03-10 19:05:10 -05:00
Akinori MUSHA
98b11ddb80 Enable include_sort_info in RssAgent
Spotted in #1916.
2017-03-07 18:14:50 +09:00
Andrew Cantino
e5776f206e Make feature specs more robust (#1917) 2017-02-27 11:25:24 -08:00