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:
parent
0f0058ed52
commit
df8ecccf84
4 changed files with 40 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -21,6 +21,7 @@ module Fog
|
|||
request :list_records
|
||||
request :update_record
|
||||
request :delete_record
|
||||
request :get_record
|
||||
|
||||
class Mock
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
34
lib/fog/dns/requests/dnsimple/get_record.rb
Normal file
34
lib/fog/dns/requests/dnsimple/get_record.rb
Normal 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
|
Loading…
Reference in a new issue