fog/fog-digitalocean

View on GitHub
lib/fog/compute/digitalocean/requests/list_servers.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Fog
  module Compute
    class DigitalOcean
      class Real
        def list_servers(filters = {})
          request(
            :expects => [200],
            :method  => 'GET',
            :path    => "/v2/droplets",
            :query   => filters
          )
        end
      end

      # noinspection RubyStringKeysInHashInspection
      class Mock
        def list_servers(filters = {})
          response = Excon::Response.new
          response.status = 200
          response.body = {
              "status" => "OK",
              "droplets"  => self.data[:servers],
              "links" => {},
              "meta" => {
                "total" => data[:servers].count
              }
          }
          response
        end
      end
    end
  end
end