ibm-watson-ruby 0.0.3 → 0.1.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 +1 -0
- data/lib/ibm_watson/base_service.rb +6 -1
- data/lib/ibm_watson/conversation/service.rb +9 -0
- data/lib/ibm_watson/version.rb +1 -1
- data/spec/assets/poc_workspace.json +2435 -0
- data/spec/ibm_watson/conversation/service_spec.rb +18 -1
- data/spec/vcr_cassettes/ibm_watson/conversation/service/ibm_watson_conversation_service_message_.yml +379 -7
- data/spec/vcr_cassettes/ibm_watson/conversation/service/ibm_watson_conversation_service_update_workspace_.yml +739 -0
- data/spec/vcr_cassettes/ibm_watson/conversation/service/ibm_watson_conversation_service_workspace_.yml +250 -248
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a22c57a538c81cb9e7236c70393a4d65c15eda0b
|
4
|
+
data.tar.gz: fef067989c2dbad59f9d3dac6fe561fd61d69853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 482aad19fdbaabc80e8b96cfbe42209a09efa73ee4492d4e34dfd07a3d4019ced41c0ba0df324279d028d794e7a2b612048e582a2fad263a08135a1f0c92c3df
|
7
|
+
data.tar.gz: 9c47108fd1ce173dd8778a6b5c163577cc4b05c77c4d0ffe85a1e597620a9d51f3cc170e860db656f3dcc9cf8d6f09712bc4cdd8e83e1b72a81635b79fb709be
|
data/Gemfile
CHANGED
@@ -52,7 +52,12 @@ module IBMWatson
|
|
52
52
|
verify_no_json_failure(result)
|
53
53
|
end
|
54
54
|
elsif result.status.between?(400, 499)
|
55
|
-
|
55
|
+
if result.content_type.mime_type == 'application/json'
|
56
|
+
json_data = JSON.parse(result.body)
|
57
|
+
raise IBMWatson::Errors::WatsonRequestError, "Server returned #{result.status} : #{json_data['error']}"
|
58
|
+
else
|
59
|
+
raise IBMWatson::Errors::WatsonRequestError, "Server returned #{result.status} : #{result.reason}"
|
60
|
+
end
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
@@ -14,6 +14,15 @@ module IBMWatson
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
def update_workspace(workspace_id:, workspace_data:)
|
18
|
+
url = build_url('workspaces', workspace_id, query: { version: QUERY_VERSION })
|
19
|
+
result = accept_json(basic_auth).post(url, json: workspace_data)
|
20
|
+
verify_http_result(result)
|
21
|
+
IBMWatson::Conversation::Workspace.new.tap do |result_object|
|
22
|
+
result_object.from_json(result)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
17
26
|
def message(workspace_id:, input:, context:, alternate_intents: false)
|
18
27
|
url = build_url('workspaces',workspace_id, 'message', query: { version: QUERY_VERSION})
|
19
28
|
params = {
|
data/lib/ibm_watson/version.rb
CHANGED