ibm_cloud_sdk_core 1.0.0.rc4 → 1.0.0.rc5

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: 2199b7e854aa1782e0a5f75e89ed01033c93eba058a7143213668625ebf6a9ce
4
- data.tar.gz: 0175abf279e3d455ccc8b9fd226024d4a9ab0052720e3644661f0cdb40bcf96d
3
+ metadata.gz: b9c7da492c8982e07c8966dcc43b5e8ed71d1b411d4b103d6da08eec6e305308
4
+ data.tar.gz: 121ff83d131e1a37a6eba6798cf73683b70dc8766ca380b3e03b9b7accaced75
5
5
  SHA512:
6
- metadata.gz: c003a64cb4671105912a4d7428098b25230ad04d63a04b6a0304e7117f3f5b22c01f4bd9348e8fa9e423f75a2bc8b4fd47d3dc5cafa2a81cc22e17d660593bb4
7
- data.tar.gz: 93670092b8bd6d66fd4c607e01590cb9f1bfbb6f4b7e245dc8fb702cbb8c1083cd5ba323bd7b65ce790112f787d5af94ab22303c1c38685229f359a2d9f01455
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 `icp4d`.
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
- ### basic
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
- ### iam
31
- This indicates that IAM token authentication is to be used. Users can pass in an `iam_apikey` or an `iam_access_token`. If an API key is used, the SDK will manage the token for the user. In either case, the SDK will generate a Bearer Auth header to send with requests to the service.
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
- ### icp4d
34
- 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`, or an `icp4d_access_token`. If a username and password is given, the SDK will manage the token for the user.
35
- A `icp4d_url` is **required** for this type. In order to use an SDK-managed token with ICP4D authentication, this option **must** be passed in.
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, :disable_ssl_verification
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IBMCloudSdkCore
4
- VERSION = "1.0.0.rc4"
4
+ VERSION = "1.0.0.rc5"
5
5
  end
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.rc4
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-16 00:00:00.000000000 Z
11
+ date: 2019-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby