telegram_workflow 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/telegram_workflow.rb +1 -0
- data/lib/telegram_workflow/client.rb +3 -1
- data/lib/telegram_workflow/params.rb +4 -0
- data/lib/telegram_workflow/version.rb +1 -1
- data/lib/telegram_workflow/workflow.rb +10 -2
- data/telegram_workflow.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c96cb2e0a64ca84710249746fba7e205101fa03d3708f154e7b9532133c550f6
|
4
|
+
data.tar.gz: edf5c725fb5100eea709c375657026cc80d3e16075de537422f55604dea150b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb13268c4f33b5add25b82ccc628199aaec2571e57e8731f88b417c5727bb9c9d7639d860a7f6ef9af09110ba12a39db5c4d2ebbd777ea40e2f54c39d0d893ae
|
7
|
+
data.tar.gz: 5cdeb13d1098f17784dfdca787e2f73a0c8d8ee6cd704d42c5894b3de4b714b2cf1118ffbcd2f3391aa0e977b8a1c7806b3b3f606cf51e85e3df6074b6a61204
|
data/lib/telegram_workflow.rb
CHANGED
@@ -129,7 +129,9 @@ class TelegramWorkflow::Client
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def make_request(action, params)
|
132
|
-
response = ::
|
132
|
+
response = ::Retryable.retryable(tries: 3, on: HTTP::ConnectionError) do
|
133
|
+
::HTTP.post("#{@api_url}/#{action}", json: { chat_id: @chat_id, **params })
|
134
|
+
end
|
133
135
|
|
134
136
|
if response.code != 200
|
135
137
|
raise TelegramWorkflow::Errors::ApiError, response.parse["description"]
|
@@ -7,7 +7,7 @@ class TelegramWorkflow::Workflow
|
|
7
7
|
@logger = TelegramWorkflow.config.logger
|
8
8
|
|
9
9
|
if @params.start?
|
10
|
-
|
10
|
+
set_current_action(TelegramWorkflow.config.start_action)
|
11
11
|
end
|
12
12
|
|
13
13
|
chat_id = @session.read(:chat_id) || @session.write(:chat_id, @params.chat_id)
|
@@ -19,7 +19,7 @@ class TelegramWorkflow::Workflow
|
|
19
19
|
shared_step_result = current_action.shared
|
20
20
|
|
21
21
|
if shared_step_result == :__continue
|
22
|
-
|
22
|
+
log_request
|
23
23
|
current_action.public_send(current_step) # setup callbacks
|
24
24
|
current_action.__run_on_message # run a callback
|
25
25
|
else
|
@@ -43,6 +43,14 @@ class TelegramWorkflow::Workflow
|
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
+
def log_request
|
47
|
+
@logger.info "[TelegramWorkflow] Processing by #{current_action.class.name}##{current_step}"
|
48
|
+
|
49
|
+
if TelegramWorkflow.config.webhook_url.nil?
|
50
|
+
@logger.info "[TelegramWorkflow] Parameters: #{@params.to_h}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
46
54
|
def current_action
|
47
55
|
@current_action ||= begin
|
48
56
|
action_class = if action = @session.read(:current_action)
|
data/telegram_workflow.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.metadata["source_code_uri"] = spec.homepage
|
15
15
|
|
16
16
|
spec.add_dependency "http"
|
17
|
+
spec.add_dependency "retryable"
|
17
18
|
spec.add_development_dependency "rspec", "~> 3.9"
|
18
19
|
spec.add_development_dependency "activesupport", "~> 5.2.0"
|
19
20
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telegram_workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Samoilov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: retryable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|