diff --git a/lib/fog/zerigo/requests/dns/list_hosts.rb b/lib/fog/zerigo/requests/dns/list_hosts.rb index 2b5bd86bb..36e39c523 100644 --- a/lib/fog/zerigo/requests/dns/list_hosts.rb +++ b/lib/fog/zerigo/requests/dns/list_hosts.rb @@ -2,7 +2,7 @@ module Fog module DNS class Zerigo class Real - require 'fog/zerigo/parsers/dns/list_hosts' + require "fog/zerigo/parsers/dns/list_hosts" # Get list of all DNS zones hosted on Slicehost (for this account) # @@ -30,9 +30,9 @@ module Fog # * 'status'<~Integer> - 200 indicates success def list_hosts(zone_id, options={}) request( - :query => options, + :query => options, :expects => 200, - :method => 'GET', + :method => "GET", :parser => Fog::Parsers::DNS::Zerigo::ListHosts.new, :path => "/api/1.1/zones/#{zone_id}/hosts.xml" ) @@ -49,16 +49,16 @@ module Fog if options.empty? response.status = 200 response.body = { - 'hosts' => zone['hosts'] + "hosts" => zone["hosts"] } else - hosts = zone['hosts'] - hosts.select! {|h| h['fqdn'] == options['fqdn']} if options['fqdn'] - hosts = options['per_page'] ? hosts.each_slice(options['per_page'] - 1).to_a : hosts.each_slice(100).to_a - hosts = options['page'] ? hosts[options['page']] : hosts[0] + hosts = zone["hosts"] + hosts = hosts.select {|h| h["fqdn"] == options["fqdn"]} if options["fqdn"] + hosts = options["per_page"] ? hosts.each_slice(options["per_page"] - 1).to_a : hosts.each_slice(100).to_a + hosts = options["page"] ? hosts[options["page"]] : hosts[0] response.status = 200 response.body = { - 'hosts' => hosts + "hosts" => hosts } end else diff --git a/tests/zerigo/requests/dns/dns_tests.rb b/tests/zerigo/requests/dns/dns_tests.rb index 8a9b88ab7..f5eb8a456 100644 --- a/tests/zerigo/requests/dns/dns_tests.rb +++ b/tests/zerigo/requests/dns/dns_tests.rb @@ -327,18 +327,18 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do host_count == 4 end - test('list host records') do + test("list host records") do pending if Fog.mocking? result = false response = Fog::DNS[:zerigo].list_hosts( @zone_id) if response.status == 200 - hosts = response.body['hosts'] + hosts = response.body["hosts"] if (hosts.count == 4) hosts.each { |host| - if (host['id'] > 0) and (host['fqdn'].length > 0) and (host['host-type'].length > 0) and - (host['created-at'].length > 0) and (host['updated-at'].length > 0) + if (host["id"] > 0) and (host["fqdn"].length > 0) and (host["host-type"].length > 0) and + (host["created-at"].length > 0) and (host["updated-at"].length > 0) result = true end } @@ -348,18 +348,18 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do result end - test('list host records with options') do + test("list host records with options") do pending if Fog.mocking? result = false response = Fog::DNS[:zerigo].list_hosts(@zone_id, {:per_page=>2, :page=>1}) if response.status == 200 - hosts = response.body['hosts'] + hosts = response.body["hosts"] if (hosts.count == 2) hosts.each { |host| - if (host['id'] > 0) and (host['fqdn'].length > 0) and (host['host-type'].length > 0) and - (host['created-at'].length > 0) and (host['updated-at'].length > 0) + if (host["id"] > 0) and (host["fqdn"].length > 0) and (host["host-type"].length > 0) and + (host["created-at"].length > 0) and (host["updated-at"].length > 0) result = true end }