mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
![Sergio Rubio](/assets/img/avatar_default.png)
- The request does not map to a Dreamhost API request, remove it. - Updated the Records collection to use list_records instead of get_record in Records#get - Added Records collection model test
33 lines
720 B
Ruby
33 lines
720 B
Ruby
require 'fog/core/collection'
|
|
require 'fog/dreamhost/models/dns/record'
|
|
|
|
module Fog
|
|
module DNS
|
|
class Dreamhost
|
|
|
|
class Records < Fog::Collection
|
|
|
|
model Fog::DNS::Dreamhost::Record
|
|
|
|
def all(filter = {})
|
|
clear
|
|
if filter[:zone]
|
|
data = service.list_records.body['data'].find_all { |r| r['zone'] == filter[:zone] }
|
|
else
|
|
data = service.list_records.body['data']
|
|
end
|
|
load(data)
|
|
end
|
|
|
|
def get(record_name)
|
|
data = service.list_records.body['data'].find { |r| r['record'] == record_name }
|
|
new(data)
|
|
rescue Excon::Errors::NotFound
|
|
nil
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|