1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #3822 from rroa/bugfix/do_servers_filters

[DigitalOcean] Added filtering capabilities to servers request.
This commit is contained in:
Wesley Beary 2016-01-25 13:44:36 -06:00
commit b6f8420836
2 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ module Fog
# @raise [Fog::Compute::DigitalOceanV2::ServiceError]
# @see https://developers.digitalocean.com/documentation/v2/#droplets
def all(filters = {})
data = service.list_servers.body['droplets']
data = service.list_servers(filters).body['droplets']
load(data)
end

View file

@ -2,18 +2,18 @@ module Fog
module Compute
class DigitalOceanV2
class Real
def list_servers
def list_servers(filters = {})
request(
:expects => [200],
:method => 'GET',
:path => '/v2/droplets'
:path => "/v2/droplets?#{filters.to_a.map { |x| "#{x[0]}=#{x[1]}" }.join("&")}"
)
end
end
# noinspection RubyStringKeysInHashInspection
class Mock
def list_servers
def list_servers(filters = {})
response = Excon::Response.new
response.status = 200
response.body = {
@ -25,4 +25,4 @@ module Fog
end
end
end
end
end