checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
2
SHA256:
3
- metadata.gz: 6c6d79aace47898352195c90bf0370d3aa0701d119ad3ee36ee824942923cea5
4
- data.tar.gz: b1f487702b107da90008af40bc2340907e605896dbc5e4e685c2d9dba57be5d5
3
+ metadata.gz: 108f15377b95818aea27fab08b01f262b75612b8d3c5f88a0550599b03d339ee
4
+ data.tar.gz: 4a41816b4102adb84696cd640c137f9b5b793c646255f5b47c35ee9737bf6df6
5
5
SHA512:
6
- metadata.gz: 436285acaf7458850cd949be3d72bce3ba3665909ce2149a4de7b2ac96aac93ee867f56620256fe39db56d81e83eba8bb76f7c0411d8378e7a83c960b70335b0
7
- data.tar.gz: 109f48faa8e6e3f47a0450dc171d3f766a0477d25a92863fe4dffa4daed807ed2da643732b446ea874369a13932b46e7c40e6ead718858c25d8ab346838b43c3
6
+ metadata.gz: 2fe5a66306d17e5dccf8696a785c34a2372bae8bc10d9e55999497226a8a1b898c68aa2fae910f7a88a6e55f4e3dcdbbc944b9a9ae6ed23d1f85b72fc0bb55b9
7
+ data.tar.gz: df65ed052783a7024274de70fd2a939a3e03b0346283eab6dd96a500a9f1d793cce54a19d780813771bd715037e2c8328e386f3f40c414b6d6b35d59ddf72368
data/lib/ibm_cloud_sdk_core/base_service.rb CHANGED
@@ -68,7 +68,7 @@ module IBMCloudSdkCore
68
68
end
69
69
70
70
if @display_name && !@username && !@iam_apikey
71
- service_name = @display_name.sub(" ", "_").downcase
71
+ service_name = @display_name.tr(" ", "_").downcase
72
72
load_from_credential_file(service_name)
73
73
@icp_prefix = @password&.start_with?("icp-") || @iam_apikey&.start_with?("icp-") ? true : false
74
74
end
@@ -256,7 +256,7 @@ module IBMCloudSdkCore
256
256
def set_credential_based_on_type(service_name, key, value)
257
257
return unless key.include?(service_name)
258
258
259
- @iam_apikey = value if key.include?("iam_apikey")
259
+ @iam_apikey = value if key.include?("iam_apikey") || key.include?("apikey")
260
260
@iam_url = value if key.include?("iam_url")
261
261
@url = value if key.include?("url")
262
262
@username = value if key.include?("username")
data/lib/ibm_cloud_sdk_core/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
# frozen_string_literal: true
2
2
3
3
module IBMCloudSdkCore
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
end
data/test/unit/test_base_service.rb CHANGED
@@ -68,6 +68,16 @@ class BaseServiceTest < Minitest::Test
68
68
ENV.delete("IBM_CREDENTIALS_FILE")
69
69
end
70
70
71
+ def test_set_credentials_from_path_in_env_nlu
72
+ file_path = File.join(File.dirname(__FILE__), "../../resources/ibm-credentials.env")
73
+ ENV["IBM_CREDENTIALS_FILE"] = file_path
74
+ service = IBMCloudSdkCore::BaseService.new(display_name: "Natural Language Understanding")
75
+ assert_equal(service.url, "https://gateway.messi.com")
76
+ assert_equal(service.token_manager.instance_variable_get(:@iam_apikey), "salah")
77
+ refute_nil(service)
78
+ ENV.delete("IBM_CREDENTIALS_FILE")
79
+ end
80
+
71
81
def test_vcap_services
72
82
ENV["VCAP_SERVICES"] = JSON.parse(File.read(Dir.getwd + "/resources/vcap-testing.json")).to_json
73
83
service = IBMCloudSdkCore::BaseService.new(vcap_services_name: "salah", use_vcap_services: true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
--- !ruby/object:Gem::Specification
2
2
name: ibm_cloud_sdk_core
3
3
version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
platform: ruby
6
6
authors:
7
7
- Mamoon Raja
8
8
autorequire:
9
9
bindir: exe
10
10
cert_chain: []
11
- date: 2019-08-08 00:00:00.000000000 Z
11
+ date: 2019-08-13 00:00:00.000000000 Z
12
12
dependencies:
13
13
- !ruby/object:Gem::Dependency
14
14
name: concurrent-ruby
@@ -265,7 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
265
- !ruby/object:Gem::Version
266
266
version: '0'
267
267
requirements: []
268
- rubygems_version: 3.0.4
268
+ rubyforge_project:
269
+ rubygems_version: 2.7.7
269
270
signing_key:
270
271
specification_version: 4
271
272
summary: Official IBM Cloud SDK core library