stealth-smooch 0.9.1 → 1.0.0
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/Gemfile.lock +17 -60
- data/VERSION +1 -1
- data/lib/stealth-smooch.rb +1 -0
- data/lib/stealth/services/smooch/client.rb +2 -2
- data/lib/stealth/services/smooch/message_handler.rb +8 -8
- data/lib/stealth/services/smooch/reply_handler.rb +5 -5
- data/stealth-smooch.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfd16ef8aa0444746d2b4e52e2211e839f76bf15e1a963b3c0099226eb4c9622
|
|
4
|
+
data.tar.gz: 773e786a3c0dcfddf7b450f20202c9d7dafae8947896ac0b6bb4c8a63fc9b91a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f863b5964a68861faca37abb857b0fd35f062017eee812b72813de66c09c35db1e6d5bad43f4e3c7702a4b49af23e2a4d4cdfb36403da03e4ca9740e87bb80a8
|
|
7
|
+
data.tar.gz: c53ea4f8ea0926d41c89c3d32ed0ece592526bd6ed71bf097fba488451ba06c82b12aea2455ed851a7b31c6240f3f9a51aadeb3d0f4902b228a91863af538871
|
data/Gemfile.lock
CHANGED
|
@@ -1,81 +1,39 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
stealth-smooch (0.9.
|
|
4
|
+
stealth-smooch (0.9.1)
|
|
5
5
|
jwt (~> 2.1)
|
|
6
|
-
smooch-api (~>
|
|
6
|
+
smooch-api (~> 5.3)
|
|
7
7
|
stealth (< 2.0)
|
|
8
8
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
|
|
13
|
-
actionview (= 5.2.1)
|
|
14
|
-
activesupport (= 5.2.1)
|
|
15
|
-
rack (~> 2.0)
|
|
16
|
-
rack-test (>= 0.6.3)
|
|
17
|
-
rails-dom-testing (~> 2.0)
|
|
18
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
19
|
-
actionview (5.2.1)
|
|
20
|
-
activesupport (= 5.2.1)
|
|
21
|
-
builder (~> 3.1)
|
|
22
|
-
erubi (~> 1.4)
|
|
23
|
-
rails-dom-testing (~> 2.0)
|
|
24
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
25
|
-
activemodel (5.2.1)
|
|
26
|
-
activesupport (= 5.2.1)
|
|
27
|
-
activerecord (5.2.1)
|
|
28
|
-
activemodel (= 5.2.1)
|
|
29
|
-
activesupport (= 5.2.1)
|
|
30
|
-
arel (>= 9.0)
|
|
31
|
-
activesupport (5.2.1)
|
|
12
|
+
activesupport (5.2.2)
|
|
32
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
33
14
|
i18n (>= 0.7, < 2)
|
|
34
15
|
minitest (~> 5.1)
|
|
35
16
|
tzinfo (~> 1.1)
|
|
36
|
-
|
|
37
|
-
builder (3.2.3)
|
|
38
|
-
concurrent-ruby (1.1.3)
|
|
17
|
+
concurrent-ruby (1.1.4)
|
|
39
18
|
connection_pool (2.2.2)
|
|
40
|
-
crass (1.0.4)
|
|
41
19
|
diff-lcs (1.3)
|
|
42
|
-
|
|
43
|
-
ethon (0.11.0)
|
|
20
|
+
ethon (0.12.0)
|
|
44
21
|
ffi (>= 1.3.0)
|
|
45
|
-
ffi (1.
|
|
46
|
-
i18n (1.
|
|
22
|
+
ffi (1.10.0)
|
|
23
|
+
i18n (1.5.3)
|
|
47
24
|
concurrent-ruby (~> 1.0)
|
|
48
25
|
json (1.8.6)
|
|
49
26
|
jwt (2.1.0)
|
|
50
|
-
loofah (2.2.3)
|
|
51
|
-
crass (~> 1.0.2)
|
|
52
|
-
nokogiri (>= 1.5.9)
|
|
53
|
-
method_source (0.9.2)
|
|
54
|
-
mini_portile2 (2.3.0)
|
|
55
27
|
minitest (5.11.3)
|
|
56
28
|
multi_json (1.13.1)
|
|
57
29
|
mustermann (1.0.3)
|
|
58
|
-
nokogiri (1.8.5)
|
|
59
|
-
mini_portile2 (~> 2.3.0)
|
|
60
30
|
puma (3.12.0)
|
|
61
31
|
rack (2.0.6)
|
|
62
|
-
rack-protection (2.0.
|
|
32
|
+
rack-protection (2.0.5)
|
|
63
33
|
rack
|
|
64
34
|
rack-test (1.1.0)
|
|
65
35
|
rack (>= 1.0, < 3)
|
|
66
|
-
|
|
67
|
-
activesupport (>= 4.2.0)
|
|
68
|
-
nokogiri (>= 1.6)
|
|
69
|
-
rails-html-sanitizer (1.0.4)
|
|
70
|
-
loofah (~> 2.2, >= 2.2.2)
|
|
71
|
-
railties (5.2.1)
|
|
72
|
-
actionpack (= 5.2.1)
|
|
73
|
-
activesupport (= 5.2.1)
|
|
74
|
-
method_source
|
|
75
|
-
rake (>= 0.8.7)
|
|
76
|
-
thor (>= 0.19.0, < 2.0)
|
|
77
|
-
rake (12.3.1)
|
|
78
|
-
redis (4.0.3)
|
|
36
|
+
redis (4.1.0)
|
|
79
37
|
rspec (3.8.0)
|
|
80
38
|
rspec-core (~> 3.8.0)
|
|
81
39
|
rspec-expectations (~> 3.8.0)
|
|
@@ -91,30 +49,29 @@ GEM
|
|
|
91
49
|
rspec-support (3.8.0)
|
|
92
50
|
rspec_junit_formatter (0.4.1)
|
|
93
51
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
94
|
-
sidekiq (5.2.
|
|
52
|
+
sidekiq (5.2.5)
|
|
95
53
|
connection_pool (~> 2.2, >= 2.2.2)
|
|
54
|
+
rack (>= 1.5.0)
|
|
96
55
|
rack-protection (>= 1.5.0)
|
|
97
56
|
redis (>= 3.3.5, < 5)
|
|
98
|
-
sinatra (2.0.
|
|
57
|
+
sinatra (2.0.5)
|
|
99
58
|
mustermann (~> 1.0)
|
|
100
59
|
rack (~> 2.0)
|
|
101
|
-
rack-protection (= 2.0.
|
|
60
|
+
rack-protection (= 2.0.5)
|
|
102
61
|
tilt (~> 2.0)
|
|
103
|
-
smooch-api (
|
|
62
|
+
smooch-api (5.3.0)
|
|
104
63
|
json (~> 1.8, >= 1.8.3)
|
|
105
64
|
typhoeus (~> 1.0, >= 1.0.1)
|
|
106
|
-
stealth (1.
|
|
107
|
-
activerecord (~> 5.2)
|
|
65
|
+
stealth (1.1.3)
|
|
108
66
|
activesupport (~> 5.2)
|
|
109
67
|
multi_json (~> 1.12)
|
|
110
68
|
puma (~> 3.10)
|
|
111
|
-
railties (~> 5.2)
|
|
112
69
|
sidekiq (~> 5.0)
|
|
113
70
|
sinatra (~> 2.0)
|
|
114
71
|
thor (~> 0.20)
|
|
115
72
|
thor (0.20.3)
|
|
116
73
|
thread_safe (0.3.6)
|
|
117
|
-
tilt (2.0.
|
|
74
|
+
tilt (2.0.9)
|
|
118
75
|
typhoeus (1.3.1)
|
|
119
76
|
ethon (>= 0.9.0)
|
|
120
77
|
tzinfo (1.2.5)
|
|
@@ -130,4 +87,4 @@ DEPENDENCIES
|
|
|
130
87
|
stealth-smooch!
|
|
131
88
|
|
|
132
89
|
BUNDLED WITH
|
|
133
|
-
1.
|
|
90
|
+
1.17.2
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
1.0.0
|
data/lib/stealth-smooch.rb
CHANGED
|
@@ -33,7 +33,7 @@ module Stealth
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
if response.present?
|
|
36
|
-
Stealth::Logger.l(topic: "smooch", message: "Message #{response.message.
|
|
36
|
+
Stealth::Logger.l(topic: "smooch", message: "Message #{response.message.id} successfully sent.")
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -66,7 +66,7 @@ module Stealth
|
|
|
66
66
|
response = smooch_api.list_integrations(Stealth.config.smooch.app_id)
|
|
67
67
|
response.integrations.each do |integration|
|
|
68
68
|
begin
|
|
69
|
-
smooch_api.update_integration_menu(Stealth.config.smooch.app_id, integration.
|
|
69
|
+
smooch_api.update_integration_menu(Stealth.config.smooch.app_id, integration.id, menu)
|
|
70
70
|
puts "#{Stealth::Logger.colorize('[Persistent Menu]', color: :green)} set for #{integration.type} integration."
|
|
71
71
|
rescue SmoochApi::ApiError
|
|
72
72
|
# Not all integrations support the persistent menu
|
|
@@ -11,7 +11,7 @@ module Stealth
|
|
|
11
11
|
class MessageHandler < Stealth::Services::BaseMessageHandler
|
|
12
12
|
|
|
13
13
|
attr_reader :service_message, :params, :headers,
|
|
14
|
-
:smooch_response
|
|
14
|
+
:smooch_response
|
|
15
15
|
|
|
16
16
|
def initialize(params:, headers:)
|
|
17
17
|
@params = params
|
|
@@ -34,9 +34,7 @@ module Stealth
|
|
|
34
34
|
def process
|
|
35
35
|
@service_message = ServiceMessage.new(service: 'smooch')
|
|
36
36
|
@smooch_response = params
|
|
37
|
-
@smooch_message = @smooch_response['messages'].first
|
|
38
37
|
service_message.sender_id = get_sender_id
|
|
39
|
-
service_message.timestamp = get_timestamp
|
|
40
38
|
|
|
41
39
|
process_smooch_event
|
|
42
40
|
|
|
@@ -49,20 +47,22 @@ module Stealth
|
|
|
49
47
|
smooch_response['appUser']['_id']
|
|
50
48
|
end
|
|
51
49
|
|
|
52
|
-
def get_timestamp
|
|
53
|
-
Time.at(smooch_message['received']).to_datetime
|
|
54
|
-
end
|
|
55
|
-
|
|
56
50
|
def process_smooch_event
|
|
57
51
|
if smooch_response['trigger'] == 'message:appUser'
|
|
52
|
+
smooch_message = smooch_response['messages'].first
|
|
53
|
+
service_message.timestamp = Time.at(smooch_message['received']).to_datetime
|
|
54
|
+
|
|
58
55
|
message_event = Stealth::Services::Smooch::MessageEvent.new(
|
|
59
56
|
service_message: service_message,
|
|
60
57
|
params: smooch_message
|
|
61
58
|
)
|
|
62
59
|
elsif smooch_response['trigger'] == 'postback'
|
|
60
|
+
smooch_postback = smooch_response['postbacks'].first
|
|
61
|
+
service_message.timestamp = Time.at(smooch_postback.dig('message', 'received')).to_datetime
|
|
62
|
+
|
|
63
63
|
message_event = Stealth::Services::Smooch::PostbackEvent.new(
|
|
64
64
|
service_message: service_message,
|
|
65
|
-
params:
|
|
65
|
+
params: smooch_postback
|
|
66
66
|
)
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -151,21 +151,21 @@ module Stealth
|
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
def enable_typing_indicator
|
|
154
|
-
message = SmoochApi::
|
|
154
|
+
message = SmoochApi::ConversationActivity.new(
|
|
155
155
|
role: 'appMaker',
|
|
156
156
|
type: 'typing:start'
|
|
157
157
|
)
|
|
158
158
|
|
|
159
|
-
message_template(action: '
|
|
159
|
+
message_template(action: 'conversation_activity', message: message)
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
def disable_typing_indicator
|
|
163
|
-
message = SmoochApi::
|
|
163
|
+
message = SmoochApi::ConversationActivity.new(
|
|
164
164
|
role: 'appMaker',
|
|
165
165
|
type: 'typing:stop'
|
|
166
166
|
)
|
|
167
167
|
|
|
168
|
-
message_template(action: '
|
|
168
|
+
message_template(action: 'conversation_activity', message: message)
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
def delay
|
|
@@ -229,7 +229,7 @@ module Stealth
|
|
|
229
229
|
end
|
|
230
230
|
|
|
231
231
|
if element["image_url"].present?
|
|
232
|
-
smooch_item.
|
|
232
|
+
smooch_item.mediaUrl = element["image_url"]
|
|
233
233
|
end
|
|
234
234
|
|
|
235
235
|
if element["buttons"].present?
|
data/stealth-smooch.gemspec
CHANGED
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
|
14
14
|
|
|
15
15
|
s.add_dependency 'stealth', '< 2.0'
|
|
16
16
|
s.add_dependency 'jwt', '~> 2.1'
|
|
17
|
-
s.add_dependency 'smooch-api', '~>
|
|
17
|
+
s.add_dependency 'smooch-api', '~> 5.3'
|
|
18
18
|
|
|
19
19
|
s.add_development_dependency 'rspec', '~> 3.6'
|
|
20
20
|
s.add_development_dependency 'rspec_junit_formatter', '~> 0.3'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stealth-smooch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mauricio Gomes
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: stealth
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '5.3'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '5.3'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -137,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
139
|
requirements: []
|
|
140
|
-
|
|
141
|
-
rubygems_version: 2.7.7
|
|
140
|
+
rubygems_version: 3.0.1
|
|
142
141
|
signing_key:
|
|
143
142
|
specification_version: 4
|
|
144
143
|
summary: Stealth Smooch driver
|