Sha256: 0b9cdbf7d06ce20a95cff159b973b3c3dfdc3cdc71e97a378b11f667b121fc22

Contents?: true

Size: 731 Bytes

Versions: 4

Compression:

Stored size: 731 Bytes

Contents

module Fog
  module Compute
    class Ecloud
      class Real
        basic_request :get_ip_address
      end

      class Mock
        def get_ip_address(uri)
          network_id, ip_address_id = uri.match(/\/networks\/(\d+)\/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/).captures
          ip_address = data[:networks][network_id.to_i][:IpAddresses][:IpAddress].detect { |ip| ip[:name] == ip_address_id }.dup
          if ip_address
            response(:body => ip_address)
          else
            body = "<Error message=\"Resource Not Found\" majorErrorCode=\"404\" minorErrorCode=\"ResourceNotFound\" />"
            response(:body => body, :expects => 200, :status => 404)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 2 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/requests/get_ip_address.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/requests/get_ip_address.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/requests/get_ip_address.rb
fog-ecloud-0.3.0 lib/fog/compute/ecloud/requests/get_ip_address.rb