diff --git a/lib/stripe.rb b/lib/stripe.rb index 4e5df9d0..4e15f774 100644 --- a/lib/stripe.rb +++ b/lib/stripe.rb @@ -140,7 +140,7 @@ module Stripe end def self.user_agent - @uname ||= `uname -a 2>/dev/null`.strip if RUBY_PLATFORM =~ /linux|darwin/i + @uname ||= get_uname lang_version = "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})" { @@ -154,6 +154,12 @@ module Stripe end + def self.get_uname + `uname -a 2>/dev/null`.strip if RUBY_PLATFORM =~ /linux|darwin/i + rescue Errno::ENOMEM => ex # couldn't create subprocess + "uname lookup failed" + end + def self.uri_encode(params) Util.flatten_params(params). map { |k,v| "#{k}=#{Util.url_encode(v)}" }.join('&')