ibm_cloud_sdk_core 1.0.0.rc4 → 1.0.0.rc5
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/README.md +10 -7
- data/lib/ibm_cloud_sdk_core/base_service.rb +9 -2
- data/lib/ibm_cloud_sdk_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9c7da492c8982e07c8966dcc43b5e8ed71d1b411d4b103d6da08eec6e305308
|
4
|
+
data.tar.gz: 121ff83d131e1a37a6eba6798cf73683b70dc8766ca380b3e03b9b7accaced75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a33cc16c974cd32dca5b7455e9fa4d49dca879f65af178702464e97cb751453ae47c4161b0d427cf2c760263216cc0fe7423ed0f15d8e51ca29f387df42fa261
|
7
|
+
data.tar.gz: e37b37f437899f71ef9df009cf0210a5a7d14d273a111f40801efacf5065d6549b7226ae3ddf52c55942408221336b24f00ab428945ffe3d0f21cfd3d2ca4ab4
|
data/README.md
CHANGED
@@ -22,17 +22,20 @@ require "ibm_cloud_sdk_core"
|
|
22
22
|
```
|
23
23
|
|
24
24
|
## Authentication Types
|
25
|
-
There are several flavors of authentication supported in this package. To specify the intended authentication pattern to use, the user can pass in the parameter `authentication_type`. This parameter is optional, but it may become required in a future major release. The options for this parameter are `basic`, `iam`, and `
|
25
|
+
There are several flavors of authentication supported in this package. To specify the intended authentication pattern to use, the user can pass in the parameter `authentication_type`. This parameter is optional, but it may become required in a future major release. The options for this parameter are `basic`, `iam`, `bearer_token` and `cp4d`.
|
26
26
|
|
27
|
-
|
27
|
+
### basic
|
28
28
|
This indicates Basic Auth is to be used. Users will pass in a `username` and `password` and the SDK will generate a Basic Auth header to send with requests to the service.
|
29
29
|
|
30
|
-
|
31
|
-
This indicates that
|
30
|
+
## bearer token
|
31
|
+
This indicates that bearer token authentication is to be used. Users can pass in an `bearer_token`, and SDK will generate a Bearer Auth header to send with requests to the service.
|
32
32
|
|
33
|
-
|
34
|
-
This indicates that
|
35
|
-
|
33
|
+
### iam
|
34
|
+
This indicates that IAM token authentication is to be used. Users can pass in an `iam_apikey`. The SDK will manage the token for the user and it will generate a Bearer Auth header to send with requests to the service.
|
35
|
+
|
36
|
+
### cp4d
|
37
|
+
This indicates that the service is an instance of ICP4D, which has its own version of token authentication. Users can pass in a `username` and `password`. If a username and password is given, the SDK will manage the token for the user.
|
38
|
+
A `cp4d_url` is **required** for this type. In order to use an SDK-managed token with ICP4D authentication, this option **must** be passed in.
|
36
39
|
|
37
40
|
## Issues
|
38
41
|
|
@@ -23,8 +23,8 @@ end
|
|
23
23
|
module IBMCloudSdkCore
|
24
24
|
# Class for interacting with the API
|
25
25
|
class BaseService
|
26
|
-
attr_accessor :service_name, :service_url
|
27
|
-
attr_reader :conn, :authenticator
|
26
|
+
attr_accessor :service_name, :service_url
|
27
|
+
attr_reader :conn, :authenticator, :disable_ssl_verification
|
28
28
|
def initialize(vars)
|
29
29
|
defaults = {
|
30
30
|
authenticator: nil,
|
@@ -44,12 +44,17 @@ module IBMCloudSdkCore
|
|
44
44
|
@service_url = config[:url] unless config.nil?
|
45
45
|
end
|
46
46
|
|
47
|
+
configure_http_client(disable_ssl_verification: @disable_ssl_verification)
|
47
48
|
@temp_headers = {}
|
48
49
|
@conn = HTTP::Client.new(
|
49
50
|
headers: {}
|
50
51
|
).use normalize_uri: { normalizer: NORMALIZER }
|
51
52
|
end
|
52
53
|
|
54
|
+
def disable_ssl_verification=(disable_ssl_verification)
|
55
|
+
configure_http_client(disable_ssl_verification: disable_ssl_verification)
|
56
|
+
end
|
57
|
+
|
53
58
|
def add_default_headers(headers: {})
|
54
59
|
raise TypeError unless headers.instance_of?(Hash)
|
55
60
|
|
@@ -102,6 +107,8 @@ module IBMCloudSdkCore
|
|
102
107
|
return DetailedResponse.new(response: response) if (200..299).cover?(response.code)
|
103
108
|
|
104
109
|
raise ApiException.new(response: response)
|
110
|
+
rescue OpenSSL::SSL::SSLError
|
111
|
+
raise StandardError.new("If you're trying to call a service on ICP or Cloud Pak for Data, you may not have a valid SSL certificate. If you need to access the service without setting that up, try using the disable_ssl_verification option in your authentication configuration and/or setting disable_ssl_verification; on your service.")
|
105
112
|
end
|
106
113
|
|
107
114
|
# @note Chainable
|
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: 1.0.0.
|
4
|
+
version: 1.0.0.rc5
|
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-09-
|
11
|
+
date: 2019-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|