huginn_sinch_status_agent 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e2aae8cc56c4c7fa9351c28a7267eea415d794b63fa19c2657c373f0efd96bf
4
- data.tar.gz: c31bd3a5b324599aea77abad643972644c72496f7cd793d0071c381f7d9a8982
3
+ metadata.gz: 5c93e25d4186379ed5e9037228ffcc375b0014f37b580fc2a9f1ee637516b09a
4
+ data.tar.gz: 31fe2f6f7046140d55390f5a51cf7f593eb5d2f76c62d6b2e3806d475f703203
5
5
  SHA512:
6
- metadata.gz: 9689bb0b5346c05d6c88c4fed6427abd1271405031670b7be215df1b6bdbf1e272cdfc533b35a2d09cf6a7690d9b0801e07409ad82b65a30cbf027c241d04c34
7
- data.tar.gz: 7c0108ec48b45a2ef15d7978307f4f2eb9a5e1c2344c9c68d1547bfe83820fdf1bfc2216f7cfd7b4d1cde4f2998b4d6af017a0f7479021f7c99073c5ac5482d8
6
+ metadata.gz: 53f428de6b6f9ff8683110be87ccab6039a7711da27503fcafb0c7f3e5ebf3a881589a49918905442f699003119e5fb6816dc81a5ce2bda90429df43d3fb78d6
7
+ data.tar.gz: c8d7fcf3929d9f0ca11a6335e3a3be5ae97260956e340f0887b1bf204f84a66dce9a4295c9f30f74dfb15c7172002f7d534fb735077669bc72112d4bf82745ef
@@ -10,6 +10,10 @@ module Agents
10
10
  The Sinch agent fetches Sinch status.
11
11
  I added this agent because with website agent, when indicator is empty for "all ok status", no event was created.
12
12
 
13
+ The `debug` can add verbosity.
14
+
15
+ `changes_only` is only used to emit event about a currency's change.
16
+
13
17
  `expected_receive_period_in_days` is used to determine if the Agent is working. Set it to the maximum number of days
14
18
  that you anticipate passing without this Agent receiving an incoming Event.
15
19
  MD
@@ -28,11 +32,13 @@ module Agents
28
32
 
29
33
  def default_options
30
34
  {
35
+ 'debug' => 'false',
31
36
  'expected_receive_period_in_days' => '2',
32
37
  'changes_only' => 'true'
33
38
  }
34
39
  end
35
40
 
41
+ form_configurable :debug, type: :boolean
36
42
  form_configurable :expected_receive_period_in_days, type: :string
37
43
  form_configurable :changes_only, type: :boolean
38
44
 
@@ -42,6 +48,10 @@ module Agents
42
48
  errors.add(:base, "if provided, changes_only must be true or false")
43
49
  end
44
50
 
51
+ if options.has_key?('debug') && boolify(options['debug']).nil?
52
+ errors.add(:base, "if provided, debug must be true or false")
53
+ end
54
+
45
55
  unless options['expected_receive_period_in_days'].present? && options['expected_receive_period_in_days'].to_i > 0
46
56
  errors.add(:base, "Please provide 'expected_receive_period_in_days' to indicate how many days can pass before this Agent is considered to be not working")
47
57
  end
@@ -62,7 +72,6 @@ module Agents
62
72
  log "request status : #{code}"
63
73
 
64
74
  if interpolated['debug'] == 'true'
65
- log "request status : #{code}"
66
75
  log "body"
67
76
  log body
68
77
  end
@@ -82,8 +91,12 @@ module Agents
82
91
 
83
92
  if interpolated['changes_only'] == 'true'
84
93
  if payload != memory['last_status']
94
+ if memory['last_status'].nil?
95
+ create_event payload: event
96
+ elsif !memory['last_status']['status'].nil? and memory['last_status']['status'].present? and payload['status'] != memory['last_status']['status']
97
+ create_event payload: event
98
+ end
85
99
  memory['last_status'] = payload
86
- create_event payload: event
87
100
  end
88
101
  else
89
102
  create_event payload: event
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huginn_sinch_status_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Germain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-19 00:00:00.000000000 Z
11
+ date: 2024-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler