lib/conjur/base.rb in conjur-api-4.11.0 vs lib/conjur/base.rb in conjur-api-4.11.1
- old
+ new
@@ -19,12 +19,13 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
require 'rest-client'
require 'json'
require 'base64'
-require 'wrong'
+require 'conjur/patches/rest-client'
+
require 'conjur/exists'
require 'conjur/has_attributes'
require 'conjur/has_owner'
require 'conjur/path_based'
require 'conjur/escape'
@@ -37,11 +38,10 @@
class API
include Escape
include LogSource
include StandardMethods
include Cast
- include Wrong
class << self
# Parse a role id into [ account, 'roles', kind, id ]
def parse_role_id(id)
id = id.role if id.respond_to?(:role)
@@ -113,10 +113,11 @@
def token
@token = nil unless token_valid?
@token ||= Conjur::API.authenticate(@username, @api_key)
- assert { token_valid? }
+ fail "obtained token is invalid" unless token_valid? # sanity check
+
return @token
end
# Authenticate the username and api_key to obtain a request token.
# Tokens are cached by username for a short period of time.