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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0daec1c9c0c31e56047fb9c3c5919f2f1cd03b58
4
- data.tar.gz: 9163895c9a02b6b3c1f09c51f3ba3a7320226be8
3
+ metadata.gz: a22c57a538c81cb9e7236c70393a4d65c15eda0b
4
+ data.tar.gz: fef067989c2dbad59f9d3dac6fe561fd61d69853
5
5
  SHA512:
6
- metadata.gz: c56075e9e7f9d17caf464a6049f1f054649f8b0735d8343575ed6518b242994e21e265bed2f1c581de3895828a955efe341aeee33d294e11c277b4ffe302e564
7
- data.tar.gz: 2624707fab0704153f6940c0d568d47f5a2aa8ff8c92ee504f052bd3ad0b144f0f8aec1ac538c526e773a71e2b0acf8ad0174ba734655ee71963bcde8a726110
6
+ metadata.gz: 482aad19fdbaabc80e8b96cfbe42209a09efa73ee4492d4e34dfd07a3d4019ced41c0ba0df324279d028d794e7a2b612048e582a2fad263a08135a1f0c92c3df
7
+ data.tar.gz: 9c47108fd1ce173dd8778a6b5c163577cc4b05c77c4d0ffe85a1e597620a9d51f3cc170e860db656f3dcc9cf8d6f09712bc4cdd8e83e1b72a81635b79fb709be
data/Gemfile CHANGED
@@ -12,4 +12,5 @@ group :test, :development do
12
12
  gem 'rspec'
13
13
  gem 'rspec-middlewares'
14
14
  gem 'vcr'
15
+ gem 'webmock'
15
16
  end
@@ -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
- raise IBMWatson::Errors::WatsonRequestError, "Server returned #{result.status} : #{result.reason}"
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 = {
@@ -1,3 +1,3 @@
1
1
  module IBMWatson
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end