ibm_watson 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/bin/console +1 -0
- data/lib/ibm_watson/iam_token_manager.rb +7 -7
- data/lib/ibm_watson/version.rb +3 -1
- data/lib/ibm_watson/watson_service.rb +2 -2
- data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +3 -3
- data/rakefile +1 -1
- data/test/integration/test_assistant_v1.rb +640 -638
- data/test/integration/test_discovery_v1.rb +173 -170
- data/test/integration/test_iam_assistant_v1.rb +674 -672
- data/test/integration/test_language_translator_v3.rb +68 -66
- data/test/integration/test_natural_language_classifier_v1.rb +57 -55
- data/test/integration/test_natural_language_understanding_v1.rb +89 -87
- data/test/integration/test_personality_insights_v3.rb +87 -85
- data/test/integration/test_speech_to_text_v1.rb +143 -142
- data/test/integration/test_text_to_speech_v1.rb +71 -69
- data/test/integration/test_tone_analyzer_v3.rb +65 -63
- data/test/integration/test_visual_recognition_v3.rb +53 -51
- data/test/test_helper.rb +0 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f3ea96d0530c44debcae0d8eb39eaf614c94643e767d226f474377da33d3f09
|
4
|
+
data.tar.gz: f133f5b9a4536331c9a84abcf56c85d7837602af161a2c3816fa79c987728ba4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d561ca5bf849d5c9a626b5983d7ca79301e1d6b1db3118122ed847f7199ac7bed73f87f05bcb0fb07d7ddf6aa2f247056b00a7792996674188c369d9ce9f2d3f
|
7
|
+
data.tar.gz: 6d1b1025b78e068a4824bba18134422800879ba2a935900d140dcfcfbabb8524aeb0d1c1a69934f6c716c437f05541b5ab3fdedabf6ef55ff9075a2a7c37b505
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# IBM Watson Ruby SDK
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/watson-developer-cloud/ruby-sdk.svg
|
3
|
+
[![Build Status](https://travis-ci.org/watson-developer-cloud/ruby-sdk.svg)](https://travis-ci.org/watson-developer-cloud/ruby-sdk)
|
4
4
|
[![Slack](https://wdc-slack-inviter.mybluemix.net/badge.svg)](https://wdc-slack-inviter.mybluemix.net)
|
5
|
-
[![codecov.io](https://codecov.io/github/watson-developer-cloud/ruby-sdk/coverage.svg
|
5
|
+
[![codecov.io](https://codecov.io/github/watson-developer-cloud/ruby-sdk/coverage.svg)](https://codecov.io/github/watson-developer-cloud/ruby-sdk)
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/ibm_watson.svg)](https://badge.fury.io/rb/ibm_watson)
|
7
|
+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
|
7
8
|
|
8
9
|
Ruby gem to quickly get started with the various [IBM Watson][wdc] services.
|
9
10
|
|
data/bin/console
CHANGED
@@ -5,13 +5,13 @@ require("json")
|
|
5
5
|
require("rbconfig")
|
6
6
|
require_relative("./version.rb")
|
7
7
|
|
8
|
-
DEFAULT_IAM_URL = "https://iam.bluemix.net/identity/token"
|
9
|
-
CONTENT_TYPE = "application/x-www-form-urlencoded"
|
10
|
-
ACCEPT = "application/json"
|
11
|
-
DEFAULT_AUTHORIZATION = "Basic Yng6Yng="
|
12
|
-
REQUEST_TOKEN_GRANT_TYPE = "urn:ibm:params:oauth:grant-type:apikey"
|
13
|
-
REQUEST_TOKEN_RESPONSE_TYPE = "cloud_iam"
|
14
|
-
REFRESH_TOKEN_GRANT_TYPE = "refresh_token"
|
8
|
+
DEFAULT_IAM_URL = "https://iam.bluemix.net/identity/token"
|
9
|
+
CONTENT_TYPE = "application/x-www-form-urlencoded"
|
10
|
+
ACCEPT = "application/json"
|
11
|
+
DEFAULT_AUTHORIZATION = "Basic Yng6Yng="
|
12
|
+
REQUEST_TOKEN_GRANT_TYPE = "urn:ibm:params:oauth:grant-type:apikey"
|
13
|
+
REQUEST_TOKEN_RESPONSE_TYPE = "cloud_iam"
|
14
|
+
REFRESH_TOKEN_GRANT_TYPE = "refresh_token"
|
15
15
|
|
16
16
|
# Class to manage IAM Token Authentication
|
17
17
|
class IAMTokenManager
|
data/lib/ibm_watson/version.rb
CHANGED
@@ -104,13 +104,13 @@ class WatsonService
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def _iam_access_token(iam_access_token:)
|
107
|
-
@token_manager
|
107
|
+
@token_manager&._access_token(iam_access_token: iam_access_token)
|
108
108
|
@token_manager = IAMTokenManager.new(iam_access_token: iam_access_token) if @token_manager.nil?
|
109
109
|
@iam_access_token = iam_access_token
|
110
110
|
end
|
111
111
|
|
112
112
|
def _iam_api_key(iam_api_key:)
|
113
|
-
@token_manager
|
113
|
+
@token_manager&._iam_api_key(iam_api_key: iam_api_key)
|
114
114
|
@token_manager = IAMTokenManager.new(iam_api_key: iam_api_key) if @token_manager.nil?
|
115
115
|
@iam_api_key = iam_api_key
|
116
116
|
end
|
@@ -5,7 +5,7 @@ require("faye/websocket")
|
|
5
5
|
require("json")
|
6
6
|
|
7
7
|
ONE_KB = 1024
|
8
|
-
TIMEOUT_PREFIX = "No speech detected for"
|
8
|
+
TIMEOUT_PREFIX = "No speech detected for"
|
9
9
|
CLOSE_SIGNAL = 1000
|
10
10
|
TEN_MILLISECONDS = 0.01
|
11
11
|
|
@@ -75,7 +75,7 @@ class WebSocketClient
|
|
75
75
|
p event.message
|
76
76
|
end
|
77
77
|
|
78
|
-
EM
|
78
|
+
EM&.reactor_thread&.join
|
79
79
|
EM.run do
|
80
80
|
@client = Faye::WebSocket::Client.new(@url, nil, headers: @headers)
|
81
81
|
@client.onclose = on_close
|
@@ -141,7 +141,7 @@ class WebSocketClient
|
|
141
141
|
|
142
142
|
def extract_transcripts(alternatives:)
|
143
143
|
transcripts = []
|
144
|
-
unless alternatives
|
144
|
+
unless alternatives&.nil?.nil?
|
145
145
|
alternatives.each do |alternative|
|
146
146
|
transcript = {}
|
147
147
|
transcript["confidence"] = alternative["confidence"] if alternative.key?("confidence")
|