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

DNSimple zone.get(...) now returns fully-populated Record object

This commit is contained in:
Ijonas Kisselbach 2011-03-10 07:26:21 +08:00 committed by Wesley Beary
parent 0f0058ed52
commit df8ecccf84
4 changed files with 40 additions and 7 deletions

View file

@ -21,7 +21,7 @@ GEM
formatador (0.0.16)
json (1.5.1)
mime-types (1.16)
net-ssh (2.1.0)
net-ssh (2.1.3)
nokogiri (1.4.4)
rake (0.8.7)
rspec (1.3.1)

View file

@ -21,6 +21,7 @@ module Fog
request :list_records
request :update_record
request :delete_record
request :get_record
class Mock

View file

@ -17,12 +17,10 @@ module Fog
end
def get(record_id)
all.each do |record|
if record["record"]["id"] == record_id
return new(record)
end
end
requires :zone
data = connection.get_record(zone.id, record_id).body["record"]
new(data)
rescue Excon::Errors::NotFound
nil
end

View file

@ -0,0 +1,34 @@
module Fog
module DNSimple
class DNS
class Real
# Gets record from given domain.
#
# ==== Parameters
# * domain<~String>
# * record_id<~String>
# ==== Returns
# * response<~Excon::Response>:
# * record<~Hash>
# * name<~String>
# * ttl<~Integer>
# * created_at<~String>
# * special_type<~String>
# * updated_at<~String>
# * domain_id<~Integer>
# * id<~Integer>
# * content<~String>
# * record_type<~String>
# * prio<~Integer>
def get_record(domain, record_id)
request( :expects => 200,
:method => "GET",
:path => "/domains/#{domain}/records/#{record_id}" )
end
end
end
end
end