namecheap 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,86 +1,137 @@
1
- Overview
2
- ========
1
+ # Namecheap
3
2
 
4
- About this project
5
- -------------
3
+ `namecheap` is a Ruby wrapper for the [Namecheap XML API](https://www.namecheap.com/support/api/intro/). It supports the existing domains, DNS, nameserver, transfer, SSL, user, and domain privacy commands exposed by the gem.
6
4
 
7
- Namecheap is a ruby wrapper for the [Namecheap API](http://developer.namecheap.com/docs/doku.php?id=api-reference:index)
5
+ Version 0.3.1 requires Ruby 3.3 or newer.
8
6
 
9
- The code was originally forked from https://github.com/hashrocket/namecheap
7
+ ## Installation
10
8
 
11
- At [Mindvalley](http://www.mindvalley.com) (the company I work for) we have something
12
- called 'HackdayFridays' where we spend the whole day hacking on an interesting
13
- project that may or may not be directly related to the business. It was enacted
14
- so that the tech and production team can unwind from what can be a monotonous
15
- work week, and hack on something more interesting.
9
+ Add the gem to your bundle:
16
10
 
17
- One of the proposed projects was a 'big red button' where someone can just type
18
- in the domain name, push a big red button, and magically:
11
+ ```ruby
12
+ gem "namecheap"
13
+ ```
19
14
 
20
- * the domain name is purchased
21
- * the DNS is pointed to our load balancer
22
- * a subversion repository is created (with users)
23
- * a template is committed to the repository with default pages
24
- * a project is created in webistrano
25
- * the initial setup and deployment is done
15
+ Then run `bundle install`.
26
16
 
27
- Mostly everything is already automated except the domain name purchase and dns.
28
- We purchase most of our domains from Namecheap (and some from GoDaddy) and it was
29
- fortunate that Namecheap has an API. Unfortunately there didn't seem to be a gem
30
- that already existed.
17
+ ## API setup
31
18
 
32
- A search brought me to HashRocket's namecheap API wrapper. It didn't have any of
33
- the purchase API wrappers, but it was a good starting point (and allowed me to
34
- study how seasoned pros would approach API wrappers). So I forked, published a
35
- gem based on the fork, and hacked on it. And that's how it all began :)
19
+ Enable API access in your Namecheap account and whitelist the public IPv4 address that will make requests. Sandbox and production use separate accounts and credentials.
36
20
 
37
- Usage
38
- -----
21
+ The gem uses the sandbox endpoint unless `RACK_ENV` (or `Rails.env`) is `production`. Test requests against the sandbox before enabling production:
39
22
 
40
- In your initializers, configure Namecheap like so:
23
+ ```ruby
24
+ Namecheap.configure do |config|
25
+ config.key = ENV.fetch("NAMECHEAP_API_KEY")
26
+ config.username = ENV.fetch("NAMECHEAP_USERNAME")
27
+ config.client_ip = ENV.fetch("NAMECHEAP_CLIENT_IP")
28
+ end
29
+ ```
41
30
 
42
- Namecheap.configure do |config|
43
- config.key = 'apikey'
44
- config.username = 'apiuser'
45
- config.client_ip = '127.0.0.1'
46
- end
31
+ Applications can select the Namecheap environment independently of `RACK_ENV`
32
+ or `Rails.env`. This is useful when a staging application runs in production
33
+ mode but must continue using Namecheap's sandbox:
47
34
 
48
- Then you can do something like:
35
+ ```ruby
36
+ Namecheap.configure do |config|
37
+ config.environment = "sandbox"
38
+ end
39
+ ```
49
40
 
50
- Namecheap.domains.get_list
41
+ Set `environment` to either `"sandbox"` or `"production"`. Leave it unset, or
42
+ set it to `nil`, to retain automatic Rails/Rack environment selection.
51
43
 
52
- Please see the Namecheap API documentation for more information
44
+ Avoid committing API keys or account configuration to source control.
53
45
 
54
- License
55
- -------
46
+ ## Usage
56
47
 
57
- Copyright (c) 2011 Tristan V. Gomez
48
+ The resource methods mirror Namecheap command names:
58
49
 
59
- This program is free software: you can redistribute it and/or modify
60
- it under the terms of the GNU General Public License as published by
61
- the Free Software Foundation, either version 3 of the License, or
62
- (at your option) any later version.
50
+ ```ruby
51
+ Namecheap.domains.get_list
52
+ Namecheap.domains.check(["example.com", "example.net"])
53
+ Namecheap.dns.get_hosts("example", "com")
54
+ ```
63
55
 
64
- This program is distributed in the hope that it will be useful,
65
- but WITHOUT ANY WARRANTY; without even the implied warranty of
66
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
67
- GNU General Public License for more details.
56
+ Additional command parameters can be passed as a final hash:
68
57
 
69
- You should have received a copy of the GNU General Public License
70
- along with this program. If not, see <http://www.gnu.org/licenses/>.
58
+ ```ruby
59
+ Namecheap.domains.get_list(page: 2, page_size: 50)
60
+ ```
71
61
 
62
+ Namecheap returns XML responses. This version returns the `HTTParty::Response` directly so existing applications can inspect the parsed response, status, and headers.
72
63
 
73
- Credits
74
- -------
64
+ Configuration can also be loaded from an ERB-enabled YAML file. The selected top-level key must match `RACK_ENV`, or `development` when it is unset:
75
65
 
76
- Tristan V. Gomez: tristan dot gomez at gmail dot com
66
+ ```yaml
67
+ development:
68
+ username: sandbox_user
69
+ key: <%= ENV.fetch("NAMECHEAP_API_KEY") %>
70
+ client_ip: 192.0.2.1
71
+ environment: sandbox
72
+ ```
77
73
 
78
- [Hashrocket](http://www.hashrocket.com/) from where the original code was forked from
74
+ ```ruby
75
+ Namecheap::Config.load!("config/namecheap.yml")
76
+ ```
79
77
 
80
- [Mongoid](http://www.mongoid.org) from where the configuration code was modified from
78
+ ## Development
81
79
 
80
+ Install dependencies and run the test and style checks:
82
81
 
83
- Plug!!
84
- ------
82
+ ```shell
83
+ mise exec -- bundle install
84
+ mise exec -- bundle exec rake
85
+ ```
85
86
 
86
- Mindvalley is [hiring](http://www.mindvalley.com/careers) :)
87
+ Build a local gem without publishing it:
88
+
89
+ ```shell
90
+ mise exec -- bundle exec gem build namecheap.gemspec
91
+ ```
92
+
93
+ ### Manual release
94
+
95
+ Releases from this legacy branch are intentionally manual. Start from a clean
96
+ `legacy/0.3` checkout and confirm that `lib/namecheap/version.rb` and the dated
97
+ changelog heading contain the same version. Then run:
98
+
99
+ ```shell
100
+ mise exec -- bundle install
101
+ mise exec -- bundle exec rake
102
+ mise exec -- bundle exec gem build namecheap.gemspec
103
+ mise exec -- ruby -rrubygems/package -e \
104
+ 'spec = Gem::Package.new(ARGV.fetch(0)).spec; puts "#{spec.name} #{spec.version} (Ruby #{spec.required_ruby_version})"' \
105
+ namecheap-0.3.1.gem
106
+ ```
107
+
108
+ Commit and push the finalized release changes before creating a signed,
109
+ annotated tag for the exact release commit:
110
+
111
+ ```shell
112
+ git tag -s v0.3.1 -m "Release 0.3.1"
113
+ git push origin legacy/0.3
114
+ git push origin v0.3.1
115
+ ```
116
+
117
+ Publish the artifact to RubyGems manually. RubyGems may prompt for MFA:
118
+
119
+ ```shell
120
+ mise exec -- gem push namecheap-0.3.1.gem
121
+ ```
122
+
123
+ After RubyGems reports version 0.3.1 as published, create the corresponding
124
+ GitHub Release:
125
+
126
+ ```shell
127
+ gh release create v0.3.1 --verify-tag --generate-notes --title v0.3.1
128
+ ```
129
+
130
+ Changing the version, building the gem, or pushing the branch does not publish
131
+ a release.
132
+
133
+ ## License
134
+
135
+ Copyright 2011 Tristan V. Gomez. This project is available under the GNU Lesser General Public License, version 3 or any later version. See [COPYING](COPYING).
136
+
137
+ The original API wrapper was forked from Hashrocket's `namecheap` project.
data/lib/namecheap/api.rb CHANGED
@@ -1,22 +1,75 @@
1
+ require "active_support/core_ext/string/inflections"
2
+
1
3
  module Namecheap
2
4
  class Api
3
- SANDBOX = 'https://api.sandbox.namecheap.com/xml.response'
4
- PRODUCTION = 'https://api.namecheap.com/xml.response'
5
- ENVIRONMENT = defined?(Rails) && Rails.respond_to?(:env) ? Rails.env : (ENV["RACK_ENV"] || 'development')
6
- ENDPOINT = (ENVIRONMENT == 'production' ? PRODUCTION : SANDBOX)
7
-
8
- def api_call(command, command_args)
9
- args = init_args(command_args.merge :command => command)
10
- query = ENDPOINT + '?' + args.to_param
11
- HTTParty.get(query)
5
+ SANDBOX = "https://api.sandbox.namecheap.com/xml.response"
6
+ PRODUCTION = "https://api.namecheap.com/xml.response"
7
+ ENVIRONMENT = (defined?(Rails) && Rails.respond_to?(:env)) ? Rails.env.to_s : (ENV["RACK_ENV"] || "development")
8
+ ENDPOINT = (ENVIRONMENT == "production") ? PRODUCTION : SANDBOX
9
+
10
+ def get(command, options = {})
11
+ request "get", command, options
12
+ end
13
+
14
+ def post(command, options = {})
15
+ request "post", command, options
16
+ end
17
+
18
+ def put(command, options = {})
19
+ request "put", command, options
20
+ end
21
+
22
+ def delete(command, options = {})
23
+ request "delete", command, options
12
24
  end
13
25
 
14
- def init_args(options = {})
15
- args = {}
16
- args['ApiUser'] = args['UserName'] = Namecheap.username
17
- args['ApiKey'] = Namecheap.key
18
- args['ClientIp'] = Namecheap.client_ip
19
- args.merge options.camelize_keys!
26
+ def request(method, command, options = {})
27
+ command = "namecheap.#{command}"
28
+ options = init_args.merge(options).merge(command: command)
29
+ options.keys.each do |key|
30
+ options[key.to_s.camelize] = options.delete(key)
31
+ end
32
+
33
+ case method
34
+ when "get"
35
+ HTTParty.get(endpoint, query: options)
36
+ when "post"
37
+ HTTParty.post(endpoint, query: options)
38
+ when "put"
39
+ HTTParty.put(endpoint, query: options)
40
+ when "delete"
41
+ HTTParty.delete(endpoint, query: options)
42
+ end
43
+ end
44
+
45
+ def init_args
46
+ %w[username key client_ip].each do |key|
47
+ if Namecheap.config.public_send(key).nil?
48
+ raise Namecheap::Config::RequiredOptionMissing,
49
+ "Configuration parameter missing: #{key}, " \
50
+ "please add it to the Namecheap.configure block"
51
+ end
52
+ end
53
+
54
+ {
55
+ api_user: Namecheap.config.username,
56
+ user_name: Namecheap.config.username,
57
+ api_key: Namecheap.config.key,
58
+ client_ip: Namecheap.config.client_ip
59
+ }
60
+ end
61
+
62
+ private
63
+
64
+ def endpoint
65
+ case Namecheap.config.environment
66
+ when "sandbox"
67
+ SANDBOX
68
+ when "production"
69
+ PRODUCTION
70
+ else
71
+ ENDPOINT
72
+ end
20
73
  end
21
74
  end
22
- end
75
+ end
@@ -1,44 +1,26 @@
1
+ require "erb"
2
+ require "yaml"
3
+
1
4
  module Namecheap
2
5
  module Config
3
- # Taken and modified from Mongoid config.rb
4
-
6
+ class RequiredOptionMissing < RuntimeError; end
5
7
  extend self
6
8
 
7
- attr_accessor :settings, :defaults
8
- @settings = {}
9
- @defaults = {}
10
-
11
- # Define a configuration option with a default.
12
- #
13
- # @example Define the option.
14
- # Config.option(:client_ip, :default => '127.0.0.1')
15
- #
16
- # @param [ Symbol ] name The name of the configuration option.
17
- # @param [ Hash ] options Extras for the option.
18
- #
19
- # @option options [ Object ] :default The default value.
20
- def option(name, options = {})
21
- defaults[name] = settings[name] = options[:default]
22
-
23
- class_eval <<-RUBY
24
- def #{name}
25
- settings[#{name.inspect}]
26
- end
9
+ ENVIRONMENTS = %w[sandbox production].freeze
27
10
 
28
- def #{name}=(value)
29
- settings[#{name.inspect}] = value
30
- end
11
+ attr_accessor :key, :username, :client_ip
12
+ attr_reader :environment
31
13
 
32
- def #{name}?
33
- #{name}
34
- end
35
- RUBY
14
+ def environment=(environment)
15
+ if environment.nil?
16
+ @environment = nil
17
+ elsif ENVIRONMENTS.include?(environment)
18
+ @environment = environment
19
+ else
20
+ raise ArgumentError, "environment must be sandbox or production"
21
+ end
36
22
  end
37
23
 
38
- option :key, :default => 'apikey'
39
- option :username, :default => 'apiuser'
40
- option :client_ip, :default => '127.0.0.1'
41
-
42
24
  # Configure namecheap from a hash. This is usually called after parsing a
43
25
  # yaml config file such as mongoid.yml.
44
26
  #
@@ -60,19 +42,9 @@ module Namecheap
60
42
  #
61
43
  # @param [ String ] path The path to the file.
62
44
  def load!(path)
63
- settings = YAML.load(ERB.new(File.new(path).read).result)[ENVIRONMENT]
64
- if settings.present?
65
- from_hash(settings)
66
- end
45
+ contents = ERB.new(File.read(path)).result
46
+ settings = YAML.safe_load(contents, aliases: true)&.fetch(Namecheap::Api::ENVIRONMENT, nil)
47
+ from_hash(settings) if settings && !settings.empty?
67
48
  end
68
-
69
- # Reset the configuration options to the defaults.
70
- #
71
- # @example Reset the configuration options.
72
- # config.reset
73
- def reset
74
- settings.replace(defaults)
75
- end
76
-
77
49
  end
78
- end
50
+ end
data/lib/namecheap/dns.rb CHANGED
@@ -1,51 +1,56 @@
1
1
  module Namecheap
2
2
  class Dns < Api
3
+ # Sets domain to use Namecheap's default DNS servers.
4
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.dns:setdefault
3
5
  def set_default(sld, tld, options = {})
4
- args = options.clone
5
- args['SLD'] = sld
6
- args['TLD'] = tld
7
- api_call('namecheap.domains.dns.setDefault', args)
6
+ options = {SLD: sld, TLD: tld}.merge(options)
7
+ get "domains.dns.setDefault", options
8
8
  end
9
9
 
10
+ # Sets domain to use custom DNS servers.
11
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.dns:setcustom
10
12
  def set_custom(sld, tld, nameservers = [], options = {})
11
- args = options.clone
12
- args['SLD'] = sld
13
- args['TLD'] = tld
14
- args['Nameservers'] = nameservers.respond_to?(:join) ? nameservers.join(',') : nameservers
15
- api_call('namecheap.domains.dns.setCustom', args)
13
+ if nameservers.respond_to?(:join)
14
+ nameservers = nameservers.join(",")
15
+ end
16
+
17
+ options = {SLD: sld, TLD: tld, Nameservers: nameservers}.merge(options)
18
+ get "domains.dns.setCustom", options
16
19
  end
17
20
 
21
+ # Gets a list of DNS servers associated with the requested domain.
22
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.dns:getlist
18
23
  def get_list(sld, tld, options = {})
19
- args = options.clone
20
- args['SLD'] = sld
21
- args['TLD'] = tld
22
- api_call('namecheap.domains.dns.getList', args)
24
+ options = {SLD: sld, TLD: tld}.merge(options)
25
+ get "domains.dns.getList", options
23
26
  end
24
27
 
28
+ # Retrieves DNS host record settings for the requested domain.
29
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.dns:gethosts
25
30
  def get_hosts(sld, tld, options = {})
26
- args = options.clone
27
- args['SLD'] = sld
28
- args['TLD'] = tld
29
- api_call('namecheap.domains.dns.getHosts', args)
31
+ options = {SLD: sld, TLD: tld}.merge(options)
32
+ get "domains.dns.getHosts", options
30
33
  end
31
34
 
35
+ # Gets email forwarding settings for the requested domain.
36
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.dns:getemailforwarding
32
37
  def get_email_forwarding(domain, options = {})
33
- args = options.clone
34
- args['DomainName'] = domain
35
- api_call('namecheap.domains.dns.getEmailForwarding', args)
38
+ options = {DomainName: domain}.merge(options)
39
+ get "domains.dns.getEmailForwarding", options
36
40
  end
37
41
 
42
+ # Sets email forwarding for a domain name.
43
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.dns:setemailforwarding
38
44
  def set_email_forwarding(domain, options = {})
39
- args = options.clone
40
- args['DomainName'] = domain
41
- api_call('namecheap.domains.dns.setEmailForwarding', args)
45
+ options = {DomainName: domain}.merge(options)
46
+ get "domains.dns.setEmailForwarding", options
42
47
  end
43
48
 
49
+ # Sets DNS host records settings for the requested domain.
50
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.dns:sethosts
44
51
  def set_hosts(sld, tld, options = {})
45
- args = options.clone
46
- args['SLD'] = sld
47
- args['TLD'] = tld
48
- api_call('namecheap.domains.dns.setHosts', args)
52
+ options = {SLD: sld, TLD: tld}.merge(options)
53
+ get "domains.dns.setHosts", options
49
54
  end
50
55
  end
51
56
  end
@@ -1,67 +1,82 @@
1
1
  module Namecheap
2
2
  class Domains < Api
3
+ # Returns a list of domains for the particular user.
4
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:getlist
3
5
  def get_list(options = {})
4
- args = options.clone
5
- api_call('namecheap.domains.getList', args)
6
+ get "domains.getList", options
6
7
  end
7
8
 
9
+ # Gets contact information for the requested domain.
10
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:getcontacts
8
11
  def get_contacts(domain, options = {})
9
- args = options.clone
10
- args['DomainName'] = domain
11
- api_call('namecheap.domains.getContacts', args)
12
+ options = {DomainName: domain}.merge(options)
13
+ get "domains.getContacts", options
12
14
  end
13
15
 
16
+ # Registers a domain.
17
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:create
14
18
  def create(domain, options = {})
15
- args = options.clone
16
- args['DomainName'] = domain
17
- api_call('namecheap.domains.create', args)
19
+ options = {DomainName: domain}.merge(options)
20
+ get "domains.create", options
18
21
  end
19
22
 
23
+ # Returns a list of tlds.
24
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:gettldlist
20
25
  def get_tld_list(options = {})
21
- args = options.clone
22
- api_call('namecheap.domains.getTldList', args)
26
+ get "domains.getTldList", options
23
27
  end
24
28
 
29
+ # Sets contact information for the requested domain.
30
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:setcontacts
25
31
  def set_contacts(domain, options = {})
26
- args = options.clone
27
- args['DomainName'] = domain
28
- api_call('namecheap.domains.setContacts', args)
32
+ options = {DomainName: domain}.merge(options)
33
+ get "domains.setContacts", options
29
34
  end
30
35
 
36
+ # Checks the availability of domains.
37
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:check
31
38
  def check(domains = [], options = {})
32
- args = options.clone
33
- args['DomainList'] = domains.respond_to?(:join) ? domains.join(',') : domains
34
- api_call('namecheap.domains.check', args)
39
+ if domains.respond_to?(:join)
40
+ domains = domains.join(",")
41
+ end
42
+
43
+ options = {DomainList: domains}.merge(options)
44
+ get "domains.check", options
35
45
  end
36
46
 
47
+ # Reactivates an expired domain.
48
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:reactivate
37
49
  def reactivate(domain, options = {})
38
- args = options.clone
39
- args['DomainName'] = domain
40
- api_call('namecheap.domains.reactivate', args)
50
+ options = {DomainName: domain}.merge(options)
51
+ get "domains.reactivate", options
41
52
  end
42
53
 
54
+ # Renews an expiring domain.
55
+ # http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:renew
43
56
  def renew(domain, options = {})
44
- args = options.clone
45
- args['DomainName'] = domain
46
- api_call('namecheap.domains.renew', args)
57
+ options = {DomainName: domain}.merge(options)
58
+ get "domains.renew", options
47
59
  end
48
60
 
61
+ # Gets the status of RegistrarLock for the requested domain.
62
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:getregistrarlock
49
63
  def get_registrar_lock(domain, options = {})
50
- args = options.clone
51
- args['DomainName'] = domain
52
- api_call('namecheap.domains.getRegistrarLock', args)
64
+ options = {DomainName: domain}.merge(options)
65
+ get "domains.getRegistrarLock", options
53
66
  end
54
67
 
68
+ # Sets the RegistrarLock status for a domain.
69
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:setregistrarlock
55
70
  def set_registrar_lock(domain, options = {})
56
- args = options.clone
57
- args['DomainName'] = domain
58
- api_call('namecheap.domains.setRegistrarLock', args)
71
+ options = {DomainName: domain}.merge(options)
72
+ get "domains.setRegistrarLock", options
59
73
  end
60
74
 
75
+ # Returns information about the requested domain.
76
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains:getinfo
61
77
  def get_info(domain, options = {})
62
- args = options.clone
63
- args['DomainName'] = domain
64
- api_call('namecheap.domains.getInfo', args)
78
+ options = {DomainName: domain}.merge(options)
79
+ get "domains.getInfo", options
65
80
  end
66
81
  end
67
82
  end
data/lib/namecheap/ns.rb CHANGED
@@ -1,31 +1,31 @@
1
1
  module Namecheap
2
2
  class Ns < Api
3
+ # Creates a new nameserver.
4
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.ns:create
3
5
  def create(sld, tld, options = {})
4
- args = options.clone
5
- args['SLD'] = sld
6
- args['TLD'] = tld
7
- api_call('namecheap.domains.ns.create', args)
6
+ options = {SLD: sld, TLD: tld}.merge(options)
7
+ get "domains.ns.create", options
8
8
  end
9
9
 
10
+ # Deletes a nameserver associated with the requested domain.
11
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.ns:delete
10
12
  def delete(sld, tld, options = {})
11
- args = options.clone
12
- args['SLD'] = sld
13
- args['TLD'] = tld
14
- api_call('namecheap.domains.ns.delete', args)
13
+ options = {SLD: sld, TLD: tld}.merge(options)
14
+ get "domains.ns.delete", options
15
15
  end
16
16
 
17
+ # Retrieves information about a registered nameserver.
18
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.ns:getinfo
17
19
  def get_info(sld, tld, options = {})
18
- args = options.clone
19
- args['SLD'] = sld
20
- args['TLD'] = tld
21
- api_call('namecheap.domains.ns.getInfo', args)
20
+ options = {SLD: sld, TLD: tld}.merge(options)
21
+ get "domains.ns.getInfo", options
22
22
  end
23
23
 
24
+ # Updates the IP address of a registered nameserver.
25
+ # @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.ns:update
24
26
  def update(sld, tld, options = {})
25
- args = options.clone
26
- args['SLD'] = sld
27
- args['TLD'] = tld
28
- api_call('namecheap.domains.ns.update', args)
27
+ options = {SLD: sld, TLD: tld}.merge(options)
28
+ get "domains.ns.update", options
29
29
  end
30
30
  end
31
31
  end