Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Commit

Permalink
add get_nameserver_config to Lumberg::Whm::Dns. (#113)
Browse files Browse the repository at this point in the history
add get_nameserver_config to Lumberg::Whm::Dns.

Bump version to 4.1.0
  • Loading branch information
Tei1988 authored and rubemz committed Jul 4, 2017
1 parent 4aea2a7 commit a0fe9ca
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/lumberg/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Lumberg
VERSION = '4.0.0'
VERSION = '4.1.0'
end
8 changes: 8 additions & 0 deletions lib/lumberg/whm/dns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ def get_zone_record(options = {})
server.perform_request('getzonerecord', options)
end

# Retrieves the default nameservers
#
# ==== Required
# * <tt>:"api.version".to_sym</tt> - PENDING
def get_nameserver_config(options = {})
server.perform_request('get_nameserver_config', options.merge(response_key: 'data'))
end

# Displays the DNS zone configuration for a specific domain
#
# ==== Required
Expand Down
29 changes: 29 additions & 0 deletions spec/vcr_cassettes/whm/dns/get_nameserver_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
http_interactions:
- request:
method: get
uri: https://myhost.com:2087/json-api/get_nameserver_config?api.version=1
body:
encoding: US-ASCII
string: ''
headers:
Authorization:
- WHM root:iscool
response:
status:
code: 200
message: OK
headers:
Server:
- cpsrvd/11.28.64
Transfer-Encoding:
- chunked
Content-Type:
- text/plain
body:
encoding: UTF-8
string: ! '{"data":{"nameservers": ["ns1.example.com", "ns2.example.com"]},"metadata":{"result":1,"reason":"OK","version":1,"command":"get_nameserver_config"}}'
http_version: '1.1'
recorded_at: Tue, 04 Jul 2017 11:32:20 GMT
recorded_with: VCR 2.9.3
...
13 changes: 13 additions & 0 deletions spec/whm/dns_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ module Lumberg
end
end


describe "#get_nameserver_config" do
use_vcr_cassette "whm/dns/get_nameserver_config"

it "returns the nameservers" do
result = @dns.get_nameserver_config("api.version".to_sym => 1)
nameservers = result[:params][:nameservers]
nameservers.size.should == 2
nameservers.should be_include('ns1.example.com')
nameservers.should be_include('ns2.example.com')
end
end

describe "#dumpzone" do
use_vcr_cassette "whm/dns/dumpzone"

Expand Down

0 comments on commit a0fe9ca

Please sign in to comment.