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

Merge pull request #3823 from rroa/bugfix/do_regions_filters

[DigitalOcean]  Added filtering capabilities to regions request.
This commit is contained in:
Wesley Beary 2016-01-25 13:45:00 -06:00
commit 740245d6cc
3 changed files with 6 additions and 5 deletions

View file

@ -893,4 +893,5 @@
* wenlock <edward.raigosa@gmail.com> * wenlock <edward.raigosa@gmail.com>
* Ørjan Blom <blom@blom.tv> * Ørjan Blom <blom@blom.tv>
* Обоев Рулон ибн Хаттаб <me@nomadrain.com> * Обоев Рулон ибн Хаттаб <me@nomadrain.com>
* 应俊 <yj2317916@gmail.com> * 应俊 <yj2317916@gmail.com>
* Raul Roa <raulroa@playfulcorp.com>

View file

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

View file

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