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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7836c1857159d3d0a056c2a9afd46009534c5a8e84b6b716fbfef53c139bffb
4
- data.tar.gz: 83142f7639dafcf4450cba44766cae7a635e7c341bf31b222fb4698ffea46815
3
+ metadata.gz: 2f3ea96d0530c44debcae0d8eb39eaf614c94643e767d226f474377da33d3f09
4
+ data.tar.gz: f133f5b9a4536331c9a84abcf56c85d7837602af161a2c3816fa79c987728ba4
5
5
  SHA512:
6
- metadata.gz: f396810bad65041babcf1e5e2aee11b250973649b5412ecbffdd2c4386ddc94182c5d1d45dc9d8b99e1c44b9c5955777802bb17bb2dbf2a7ba428eeef5d3bde3
7
- data.tar.gz: 791fa8d8c263c62c60e95fc3cf589d02a4093e12ee42da841061dffdc25b3212dcb9fec8cddc0bc4afe717fc0b2fdeeb3d25f2439f4a0699868604f2d0731d79
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?branch=master)](https://travis-ci.org/watson-developer-cloud/ruby-sdk)
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?branch=master)](https://codecov.io/github/watson-developer-cloud/ruby-sdk?branch=master)
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
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "ibm_watson"
@@ -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".freeze
9
- CONTENT_TYPE = "application/x-www-form-urlencoded".freeze
10
- ACCEPT = "application/json".freeze
11
- DEFAULT_AUTHORIZATION = "Basic Yng6Yng=".freeze
12
- REQUEST_TOKEN_GRANT_TYPE = "urn:ibm:params:oauth:grant-type:apikey".freeze
13
- REQUEST_TOKEN_RESPONSE_TYPE = "cloud_iam".freeze
14
- REFRESH_TOKEN_GRANT_TYPE = "refresh_token".freeze
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module IBMWatson
2
- VERSION = "0.1.0".freeze
4
+ VERSION = "0.1.1"
3
5
  end
@@ -104,13 +104,13 @@ class WatsonService
104
104
  end
105
105
 
106
106
  def _iam_access_token(iam_access_token:)
107
- @token_manager._access_token(iam_access_token: iam_access_token) unless @token_manager.nil?
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._iam_api_key(iam_api_key: iam_api_key) unless @token_manager.nil?
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".freeze
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.reactor_thread.join unless EM.reactor_thread.nil?
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.nil?
144
+ unless alternatives&.nil?.nil?
145
145
  alternatives.each do |alternative|
146
146
  transcript = {}
147
147
  transcript["confidence"] = alternative["confidence"] if alternative.key?("confidence")
data/rakefile CHANGED
@@ -37,7 +37,7 @@ end
37
37
 
38
38
  desc "Run tests and generate a code coverage report"
39
39
  task :coverage do
40
- ENV["COVERAGE"] = "true"
40
+ ENV["COVERAGE"] = "true" if ENV["TRAVIS_RUBY_VERSION"] == "2.5.1"
41
41
  Rake::Task["test"].execute
42
42
  end
43
43