Sha256: 558f8864a5a4d42ba89aebfd5143126cdbd1afa47fcf05102e39543945e51588

Contents?: true

Size: 707 Bytes

Versions: 1

Compression:

Stored size: 707 Bytes

Contents

require File.expand_path('../ip_block', __FILE__)
require File.expand_path('../../helpers/compute/data_helper', __dir__)

module Fog
  module Compute
    class ProfitBricks
      class IpBlocks < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
        model Fog::Compute::ProfitBricks::IpBlock

        def all
          result = service.get_all_ip_blocks

          load(result.body['items'].each {|ip_block| flatten(ip_block)})
        end

        def get(ip_block_id)
          ip_block = service.get_ip_block(ip_block_id).body

          Excon::Errors

          new(flatten(ip_block))
        rescue Excon::Errors::NotFound
          nil
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-profitbricks-2.0.1 lib/fog/profitbricks/models/compute/ip_blocks.rb