watson-conversation 0.2.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b32148889b97b4b4910e48704c5af12773b331a2
4
- data.tar.gz: c031094e19babf52293de256037eca761311bc8e
3
+ metadata.gz: fe11b6d8c1895ef615fa872d31279618f8d074aa
4
+ data.tar.gz: 4d7f482d0fc4c55dc13a5af8daad1c52ba7517e0
5
5
  SHA512:
6
- metadata.gz: 25c7564468726b1557671791add8baaedd7d6540eb9e03ac4c8077bcb7c66b09a38b1e6c3cfd67d561d8ff8a4e1ed5d7936267832f0e07108067aacfb65a076a
7
- data.tar.gz: c5605ff5c7b22156bc9488bdff0fd2b1fadb01e4cefe7cd1421feb26ff84d89d6fe839b8a630efea3a476f4867336940e107a7762582d71b9502afdf04170ae9
6
+ metadata.gz: 99725531c94eb90205983012687a09fa11274214f02a0a55101ca6608122d5e9ed7cdfbaeaeb2bd33c138949e89c0b8752170171464bcdab13a3ff3b9fa7ffd3
7
+ data.tar.gz: 224bf2efa4b37288498b5a84a9bb3b97a0e933e1473ec90d5dcbfad823d5b6741cf4b9faba61519a62eeb96fd258364f52e96b78de94a2d839290ae0e536f40a
data/README.md CHANGED
@@ -28,7 +28,7 @@ manage = Watson::Conversation::ManageDialog.new(
28
28
  password: [password],
29
29
  workspace_id: [workspace_id],
30
30
  # Where to link the freely-selected user name with the conversation_id
31
- storage: "hash" or "uri for redis like 'redis://127.0.0.1:6379'"
31
+ storage: "hash" or "uri for redis like 'redis://127.0.0.1:6379'"
32
32
  )
33
33
 
34
34
  # Get a greet message from a conversation service.
@@ -131,6 +131,7 @@ module Watson
131
131
  @mutex = Mutex.new
132
132
  end
133
133
 
134
+
134
135
  def users
135
136
  @users
136
137
  end
@@ -139,10 +140,12 @@ module Watson
139
140
  def talk(user, question)
140
141
  future_data = nil
141
142
 
142
- if @users.has_key?(user) == false
143
- future_data = @cnv.talk("", "")
144
- else
145
- future_data = @cnv.talk(question, context = @users.fetch(user))
143
+ @mutex.synchronize do
144
+ if @users.has_key?(user) == false
145
+ future_data = @cnv.talk("", "")
146
+ else
147
+ future_data = @cnv.talk(question, context = @users.fetch(user))
148
+ end
146
149
  end
147
150
 
148
151
  code, response = future_data.get_data()
@@ -155,15 +158,16 @@ module Watson
155
158
  end
156
159
  end
157
160
 
158
- if code == 200
159
- @users.store(user, context)
160
- else
161
- @users.delete(user)
161
+ @mutex.synchronize do
162
+ if code == 200
163
+ @users.store(user, context)
164
+ else
165
+ @users.delete(user)
166
+ end
162
167
  end
163
168
 
164
169
  return {user: user, status_code: code, output: output_texts}.to_json
165
170
  end
166
171
  end
167
-
168
172
  end
169
173
  end
@@ -1,5 +1,5 @@
1
1
  module Watson
2
2
  module Conversation
3
- VERSION = "0.2.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watson-conversation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alpha.netzilla