Sha256: ca64bf303dd5f952c1acf80b325dcc4d4f52fe6953fe1cbd0523f9db3e10b083

Contents?: true

Size: 884 Bytes

Versions: 29

Compression:

Stored size: 884 Bytes

Contents

#
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
# © Copyright IBM Corporation 2014.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

module Fog
  module Network
    class Softlayer

      class Mock

        def get_portable_subnet_price_code(address_count, public=true)
          42
        end

      end

      class Real
        def get_portable_subnet_price_code(address_count, public=true)
          portable_subnet_package_id = get_portable_subnet_package_id(public ? 'PUBLIC' : 'PRIVATE')
          request(:product_package, '0/get_item_prices', :query => 'objectMask=mask[id,categories.id,item.description]').body.map do |item|
            catg = item['categories'][0]
            item['id'] if catg['id'] == portable_subnet_package_id && item['item']['description'] =~ /^#{address_count}/
          end.compact.first
        end
      end
    end
  end
end

Version data entries

29 entries across 27 versions & 3 rubygems

Version Path
fog-softlayer-0.4.1 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb
fog-softlayer-0.4.0 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb
fog-softlayer-0.3.30 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb
fog-softlayer-0.3.29 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb
fog-softlayer-0.3.28 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb
fog-softlayer-0.3.27 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb
fog-softlayer-0.3.26 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb
fog-softlayer-0.3.25 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb
fog-softlayer-0.3.24 lib/fog/softlayer/requests/network/get_portable_subnet_price_code.rb