lib/stripe/util.rb in stripe-4.24.0 vs lib/stripe/util.rb in stripe-5.0.0

- old
+ new

@@ -196,15 +196,17 @@ end end def self.check_string_argument!(key) raise TypeError, "argument must be a string" unless key.is_a?(String) + key end def self.check_api_key!(key) raise TypeError, "api_key must be a string" unless key.is_a?(String) + key end # Normalizes header keys so that they're all lower case and each # hyphen-delimited section starts with a single capitalized letter. For @@ -243,18 +245,18 @@ # # private # COLOR_CODES = { - black: 0, light_black: 60, - red: 1, light_red: 61, - green: 2, light_green: 62, - yellow: 3, light_yellow: 63, - blue: 4, light_blue: 64, + black: 0, light_black: 60, + red: 1, light_red: 61, + green: 2, light_green: 62, + yellow: 3, light_yellow: 63, + blue: 4, light_blue: 64, magenta: 5, light_magenta: 65, - cyan: 6, light_cyan: 66, - white: 7, light_white: 67, + cyan: 6, light_cyan: 66, + white: 7, light_white: 67, default: 9, }.freeze private_constant :COLOR_CODES # Uses an ANSI escape code to colorize text if it's going to be sent to a @@ -279,13 +281,10 @@ else level end end private_class_method :level_name - # TODO: Make these named required arguments when we drop support for Ruby - # 2.0. - def self.log_internal(message, data = {}, color: nil, level: nil, - logger: nil, out: nil) + def self.log_internal(message, data = {}, color:, level:, logger:, out:) data_str = data.reject { |_k, v| v.nil? } .map do |(k, v)| format("%<key>s=%<value>s", key: colorize(k, color, logger.nil? && !out.nil? && out.isatty), value: wrap_logfmt_value(v))