stealth 0.9.1 → 0.9.2
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 +4 -4
- data/VERSION +1 -1
- data/lib/stealth/base.rb +1 -0
- data/lib/stealth/controller.rb +10 -0
- data/lib/stealth/scheduled_reply.rb +18 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7afe514bbdd62d9e4da0b6c5307986c04d885cc6
|
4
|
+
data.tar.gz: f3f79181dfa0dfd103466f02b39f220e0eeab107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4635e842cafd7f888e1f3c90588231ac9ec938a6a7d58bc88a61aa10a55396103175715c302d32ee160d1eabb7deb31b6bdcaec63eee03d452f1542e623be126
|
7
|
+
data.tar.gz: 78455052bce5e7cd23a19058f4c56eef60e7349653170e25342dd3dca512a83f8bc686b31e6743472a3c3d30b2698ba6a6ea1301f9c72f6017130abe4cc2f9b4
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.2
|
data/lib/stealth/base.rb
CHANGED
data/lib/stealth/controller.rb
CHANGED
@@ -80,6 +80,16 @@ module Stealth
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
def step_to_in(delay, session: nil, flow: nil, state: nil)
|
84
|
+
flow, state = get_flow_and_state(session: session, flow: flow, state: state)
|
85
|
+
|
86
|
+
unless delay.is_a?(ActiveSupport::Duration)
|
87
|
+
raise ArgumentError, "Please specify your schedule_step_to `in` parameter using ActiveSupport::Duration, e.g. `1.day` or `5.hours`"
|
88
|
+
end
|
89
|
+
|
90
|
+
Stealth::ScheduledReplyJob.perform_in(delay, current_service, current_user_id, flow, state)
|
91
|
+
end
|
92
|
+
|
83
93
|
def step_to(session: nil, flow: nil, state: nil)
|
84
94
|
flow, state = get_flow_and_state(session: session, flow: flow, state: state)
|
85
95
|
step(flow: flow, state: state)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stealth
|
5
|
+
|
6
|
+
class ScheduledReplyJob < Stealth::Jobs
|
7
|
+
sidekiq_options queue: :webhooks, retry: false
|
8
|
+
|
9
|
+
def perform(service, user_id, flow, state)
|
10
|
+
service_message = ServiceMessage.new(service: service)
|
11
|
+
service_message.sender_id = user_id
|
12
|
+
controller = BotController.new(service_message: service_message)
|
13
|
+
controller.update_session_to(flow: flow, state: state)
|
14
|
+
controller.route
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stealth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mauricio Gomes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/stealth/jobs.rb
|
186
186
|
- lib/stealth/logger.rb
|
187
187
|
- lib/stealth/reply.rb
|
188
|
+
- lib/stealth/scheduled_reply.rb
|
188
189
|
- lib/stealth/server.rb
|
189
190
|
- lib/stealth/service_message.rb
|
190
191
|
- lib/stealth/service_reply.rb
|