Sha256: 45082e200c0da22a8ea858387e58ba2ee8a1deba5eb14632a7252cbec555ebd8

Contents?: true

Size: 510 Bytes

Versions: 25

Compression:

Stored size: 510 Bytes

Contents

require 'socket'

module Killbill::PaypalExpress
  class Utils
    def self.ip
      first_public_ipv4 ? first_public_ipv4.ip_address : first_private_ipv4.ip_address
    end

    def self.first_private_ipv4
      @@first_private_ipv4 ||= Socket.ip_address_list.detect{ |intf| intf.ipv4_private? }
    end

    def self.first_public_ipv4
      @@first_public_ipv4 ||= Socket.ip_address_list.detect{ |intf| intf.ipv4? and !intf.ipv4_loopback? and !intf.ipv4_multicast? and !intf.ipv4_private? }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
killbill-paypal-express-1.5.4 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.5.3 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.5.2 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.5.1 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.5.0 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.4.1 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.4.0 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.3.0 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.2.0 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.1.0 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.17 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.16 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.15 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.14 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.12 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.11 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.10 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.9 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.8 lib/paypal_express/paypal_express_utils.rb
killbill-paypal-express-1.0.6 lib/paypal_express/paypal_express_utils.rb