Module: ADAL::Util
- Included in:
- AuthenticationContext, AuthenticationParameters, ClientAssertion, ClientCredential, MexRequest, OAuthRequest, WSTrustRequest, WSTrustResponse
- Defined in:
- lib/adal/util.rb
Overview
Various helper methods that are useful across several classes and do not fit into the class hierarchy.
Instance Method Summary collapse
- #fail_if_arguments_nil(*args) ⇒ Object
-
#http(uri) ⇒ Object
Net::HTTP.
-
#string_hash(hash) ⇒ Object
Converts every key and value of a hash to string.
Instance Method Details
#fail_if_arguments_nil(*args) ⇒ Object
27 28 29 |
# File 'lib/adal/util.rb', line 27 def fail_if_arguments_nil(*args) fail ArgumentError, 'Arguments cannot be nil.' if args.any?(&:nil?) end |
#http(uri) ⇒ Object
Returns Net::HTTP.
33 34 35 36 37 38 |
# File 'lib/adal/util.rb', line 33 def http(uri) uri = URI.parse(uri.to_s) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' http end |
#string_hash(hash) ⇒ Object
Converts every key and value of a hash to string.
45 46 47 |
# File 'lib/adal/util.rb', line 45 def string_hash(hash) hash.map { |k, v| [k.to_s, v.to_s] }.to_h end |