namecheap 0.2.0 → 0.3.0
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.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/COPYING +159 -668
- data/Gemfile +10 -2
- data/README.md +35 -27
- data/lib/namecheap.rb +17 -12
- data/lib/namecheap/api.rb +51 -11
- data/lib/namecheap/config.rb +3 -46
- data/lib/namecheap/dns.rb +32 -27
- data/lib/namecheap/domains.rb +46 -31
- data/lib/namecheap/ns.rb +16 -16
- data/lib/namecheap/ssl.rb +37 -27
- data/lib/namecheap/transfers.rb +16 -12
- data/lib/namecheap/users.rb +31 -17
- data/lib/namecheap/version.rb +1 -1
- data/lib/namecheap/whois_guard.rb +24 -19
- data/namecheap.gemspec +5 -3
- data/spec/helper.rb +25 -0
- data/spec/namecheap/dns_spec.rb +13 -0
- data/spec/{domains_spec.rb → namecheap/domains_spec.rb} +4 -2
- data/spec/namecheap/ns_spec.rb +13 -0
- data/spec/namecheap/ssl_spec.rb +17 -0
- data/spec/namecheap/transfers.rb +13 -0
- data/spec/namecheap/users_spec.rb +13 -0
- data/spec/namecheap/whois_guard_spec.rb +13 -0
- data/spec/namecheap_spec.rb +25 -34
- metadata +85 -73
- data/.rvmrc +0 -3
- data/lib/monkey_patch.rb +0 -84
- data/spec/spec_helper.rb +0 -10
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
|
-
|
5
|
-
|
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
|
-
|
12
|
-
|
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
|
-
|
19
|
-
|
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
|
-
|
26
|
-
|
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
|
data/lib/namecheap/ssl.rb
CHANGED
@@ -1,60 +1,70 @@
|
|
1
1
|
module Namecheap
|
2
2
|
class Ssl < Api
|
3
|
+
# Activates a newly purchased SSL certificate.
|
4
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:activate
|
3
5
|
def activate(id, options = {})
|
4
|
-
|
5
|
-
|
6
|
-
api_call('namecheap.ssl.activate', args)
|
6
|
+
options = {:CertificateID => id}.merge(options)
|
7
|
+
get 'ssl.activate', options
|
7
8
|
end
|
8
9
|
|
10
|
+
# Retrieves information about the requested SSL certificate.
|
11
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:getinfo
|
9
12
|
def get_info(id, options = {})
|
10
|
-
|
11
|
-
|
12
|
-
api_call('namecheap.ssl.getInfo', args)
|
13
|
+
options = {:CertificateID => id}.merge(options)
|
14
|
+
get 'ssl.getInfo', options
|
13
15
|
end
|
14
16
|
|
17
|
+
# Parsers the CSR.
|
18
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:parsecsr
|
15
19
|
def parse_csr(csr, options = {})
|
16
|
-
|
17
|
-
|
18
|
-
api_call('namecheap.ssl.parseCSR', args)
|
20
|
+
options = {:csr => csr}.merge(options)
|
21
|
+
get 'ssl.parseCSR', options
|
19
22
|
end
|
20
23
|
|
24
|
+
# Gets approver email list for the requested domain.
|
25
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:getapproveremaillist
|
21
26
|
def get_approver_email_list(domain, options = {})
|
22
|
-
|
23
|
-
|
24
|
-
api_call('namecheap.ssl.getApproverEmailList', args)
|
27
|
+
options = {:DomainName => domain}.merge(options)
|
28
|
+
get 'ssl.getApproverEmailList', options
|
25
29
|
end
|
26
30
|
|
31
|
+
# Returns a list of SSL certificates for a particular user.
|
32
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:getlist
|
27
33
|
def get_list(options = {})
|
28
|
-
|
29
|
-
api_call('namecheap.ssl.getList', args)
|
34
|
+
get 'ssl.getList', options
|
30
35
|
end
|
31
36
|
|
37
|
+
# Creates a new SSL certificate.
|
38
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:create
|
32
39
|
def create(options = {})
|
33
|
-
|
34
|
-
api_call('namecheap.ssl.create', args)
|
40
|
+
get 'ssl.create', options
|
35
41
|
end
|
36
42
|
|
43
|
+
# Renews an SSL certificate.
|
44
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:renew
|
37
45
|
def renew(options = {})
|
38
|
-
|
39
|
-
api_call('namecheap.ssl.renew', args)
|
46
|
+
get 'ssl.renew', options
|
40
47
|
end
|
41
48
|
|
49
|
+
# Resends the approver email.
|
50
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:resendapproveremail
|
42
51
|
def resend_approver_email(id, options = {})
|
43
|
-
|
44
|
-
|
45
|
-
api_call('namecheap.ssl.resendApproverEmail', args)
|
52
|
+
options = {:CertificateID => id}.merge(options)
|
53
|
+
get 'ssl.resendApproverEmail', options
|
46
54
|
end
|
47
55
|
|
56
|
+
# Resends the fulfilment email containing the certificate.
|
57
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:resendfulfillmentemail
|
48
58
|
def resend_fulfillment_email(id, options = {})
|
49
|
-
|
50
|
-
|
51
|
-
api_call('namecheap.ssl.resendfulfillmentemail', args)
|
59
|
+
options = {:CertificateID => id}.merge(options)
|
60
|
+
get 'ssl.resendfulfillmentemail', options
|
52
61
|
end
|
53
62
|
|
63
|
+
# Reissues an SSL certificate.
|
64
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:ssl:reissue
|
54
65
|
def reissue(id, options = {})
|
55
|
-
|
56
|
-
|
57
|
-
api_call('namecheap.ssl.reissue', args)
|
66
|
+
options = {:CertificateID => id}.merge(options)
|
67
|
+
get 'ssl.reissue', options
|
58
68
|
end
|
59
69
|
end
|
60
70
|
end
|
data/lib/namecheap/transfers.rb
CHANGED
@@ -1,26 +1,30 @@
|
|
1
1
|
module Namecheap
|
2
2
|
class Transfers < Api
|
3
|
+
# Transfers a domain to Namecheap.
|
4
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.transfer:create
|
3
5
|
def create(domain, options = {})
|
4
|
-
|
5
|
-
|
6
|
-
api_call('namecheap.domains.transfer.create', args)
|
6
|
+
options = {:DomainName => domain}.merge(options)
|
7
|
+
get 'domains.transfer.create', options
|
7
8
|
end
|
8
9
|
|
10
|
+
# Gets the status of a particular transfer.
|
11
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.transfer:getstatus
|
9
12
|
def get_status(id, options = {})
|
10
|
-
|
11
|
-
|
12
|
-
api_call('namecheap.domains.transfer.getStatus', args)
|
13
|
+
options = {:TransferID => id}.merge(options)
|
14
|
+
get 'domains.transfer.getStatus', options
|
13
15
|
end
|
14
16
|
|
17
|
+
# Updates the status of a particular transfer.
|
18
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.transfer:updatestatus
|
15
19
|
def update_status(id, options = {})
|
16
|
-
|
17
|
-
|
18
|
-
api_call('namecheap.domains.transfer.updateStatus', args)
|
20
|
+
options = {:TransferID => id}.merge(options)
|
21
|
+
get 'domains.transfer.updateStatus', options
|
19
22
|
end
|
20
|
-
|
23
|
+
|
24
|
+
# Gets the list of domain transfers.
|
25
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:domains.transfer:getlist
|
21
26
|
def get_list(options = {})
|
22
|
-
|
23
|
-
api_call('namecheap.domains.transfer.getList', args)
|
27
|
+
get 'domains.transfer.getList', options
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
data/lib/namecheap/users.rb
CHANGED
@@ -1,44 +1,58 @@
|
|
1
1
|
module Namecheap
|
2
2
|
class Users < Api
|
3
|
+
# Creates a new user account at NameCheap.
|
4
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:create
|
5
|
+
def create(options = {})
|
6
|
+
get 'users.create', options
|
7
|
+
end
|
8
|
+
|
9
|
+
# Returns pricing information for a requested product type.
|
10
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:getpricing
|
3
11
|
def get_pricing(options = {})
|
4
|
-
|
5
|
-
api_call('namecheap.users.getPricing', args)
|
12
|
+
get 'users.getPricing', options
|
6
13
|
end
|
7
14
|
|
15
|
+
# Gets information about fund in the user's account.
|
16
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:getbalances
|
8
17
|
def get_balances(options = {})
|
9
|
-
|
10
|
-
api_call('namecheap.users.getBalances', args)
|
18
|
+
get 'users.getBalances', options
|
11
19
|
end
|
12
20
|
|
21
|
+
# Changes the password for a user.
|
22
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:changepassword
|
13
23
|
def change_password(options = {})
|
14
|
-
|
15
|
-
api_call('namecheap.users.changePassword', args)
|
24
|
+
get 'users.changePassword', options
|
16
25
|
end
|
17
26
|
|
27
|
+
# Updates user account information for the particular user.
|
28
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:update
|
18
29
|
def update(options = {})
|
19
|
-
|
20
|
-
api_call('namecheap.users.update', args)
|
30
|
+
get 'users.update', options
|
21
31
|
end
|
22
32
|
|
33
|
+
# Allows you to add funds to a user account.
|
34
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:createaddfundsrequest
|
23
35
|
def create_add_funds_request(options = {})
|
24
|
-
|
25
|
-
api_call('namecheap.users.createaddfundsrequest', args)
|
36
|
+
get 'users.createaddfundsrequest', options
|
26
37
|
end
|
27
38
|
|
39
|
+
# Gets the status of add funds request.
|
40
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:getaddfundsstatus
|
28
41
|
def get_add_funds_status(id, options = {})
|
29
|
-
|
30
|
-
|
31
|
-
api_call('namecheap.users.getAddFundsStatus', args)
|
42
|
+
options = {:TokenId => id}.merge(options)
|
43
|
+
get 'users.getAddFundsStatus', options
|
32
44
|
end
|
33
45
|
|
46
|
+
# Validates the username and password of user accounts you have created.
|
47
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:login
|
34
48
|
def login(options = {})
|
35
|
-
|
36
|
-
api_call('namecheap.users.login', args)
|
49
|
+
get 'users.login', options
|
37
50
|
end
|
38
51
|
|
52
|
+
# Sends a reset password link to user.
|
53
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:users:resetpassword
|
39
54
|
def reset_password(options = {})
|
40
|
-
|
41
|
-
api_call('namecheap.users.resetPassword', args)
|
55
|
+
get 'users.resetPassword', options
|
42
56
|
end
|
43
57
|
end
|
44
58
|
end
|
data/lib/namecheap/version.rb
CHANGED
@@ -1,40 +1,45 @@
|
|
1
1
|
module Namecheap
|
2
2
|
class Whois_Guard < Api
|
3
|
+
# Allots WhoisGuard privacy protection.
|
4
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:whoisguard:allot
|
3
5
|
def allot(id, domain, options = {})
|
4
|
-
|
5
|
-
|
6
|
-
args['DomainName'] = domain
|
7
|
-
api_call('namecheap.whoisguard.allot', args)
|
6
|
+
options = {:WhoisguardId => id, :DomainName => domain}.merge(options)
|
7
|
+
get 'whoisguard.allot', options
|
8
8
|
end
|
9
9
|
|
10
|
+
# Discards the WhoisGuard.
|
11
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:whoisguard:discard
|
10
12
|
def discard(id, options = {})
|
11
|
-
|
12
|
-
|
13
|
-
api_call('namecheap.whoisguard.discard', args)
|
13
|
+
options = {:WhoisguardId => id}.merge(options)
|
14
|
+
get 'whoisguard.discard', options
|
14
15
|
end
|
15
16
|
|
17
|
+
# Unallots WhoisGuard privacy protection for the WhoisguardID.
|
18
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:whoisguard:unallot
|
16
19
|
def unallot(id, options = {})
|
17
|
-
|
18
|
-
|
19
|
-
api_call('namecheap.whoisguard.unallot', args)
|
20
|
+
options = {:WhoisguardId => id}.merge(options)
|
21
|
+
get 'whoisguard.unallot', options
|
20
22
|
end
|
21
23
|
|
24
|
+
# Disables WhoisGuard privacy protection for the WhoisguardID.
|
25
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:whoisguard:disable
|
22
26
|
def disable(id, options = {})
|
23
|
-
|
24
|
-
|
25
|
-
api_call('namecheap.whoisguard.disable', args)
|
27
|
+
options = {:WhoisguardId => id}.merge(options)
|
28
|
+
get 'whoisguard.disable', options
|
26
29
|
end
|
27
30
|
|
31
|
+
# Enables WhoisGuard privacy protection for the WhoisguardID.
|
32
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:whoisguard:enable
|
28
33
|
def enable(id, options = {})
|
29
|
-
|
30
|
-
|
31
|
-
api_call('namecheap.whoisguard.enable', args)
|
34
|
+
options = {:WhoisguardId => id}.merge(options)
|
35
|
+
get 'whoisguard.enable', options
|
32
36
|
end
|
33
37
|
|
38
|
+
# Changes WhoisGuard email address.
|
39
|
+
# @see http://developer.namecheap.com/docs/doku.php?id=api-reference:whoisguard:changeemailaddress
|
34
40
|
def change_email_address(id, options = {})
|
35
|
-
|
36
|
-
|
37
|
-
api_call('namecheap.whoisguard.changeemailaddress', args)
|
41
|
+
options = {:WhoisguardId => id}.merge(options)
|
42
|
+
get 'whoisguard.changeemailaddress', options
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
data/namecheap.gemspec
CHANGED
@@ -8,8 +8,10 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["parasquid"]
|
9
9
|
s.email = ["tristan.gomez@gmail.com"]
|
10
10
|
s.homepage = "https://github.com/parasquid/namecheap"
|
11
|
-
s.summary = %q{Ruby wrapper for the Namecheap API}
|
12
11
|
s.description = %q{Ruby wrapper for the Namecheap API}
|
12
|
+
s.summary = s.description
|
13
|
+
s.homepage = 'https://github.com/parasquid/namecheap'
|
14
|
+
s.licenses = ['GNU']
|
13
15
|
|
14
16
|
s.rubyforge_project = "namecheap"
|
15
17
|
|
@@ -18,8 +20,8 @@ Gem::Specification.new do |s|
|
|
18
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
21
|
s.require_paths = ["lib"]
|
20
22
|
|
21
|
-
# specify any dependencies here; for example:
|
22
23
|
s.add_development_dependency "rspec"
|
23
|
-
|
24
|
+
s.add_development_dependency 'rspec-its'
|
24
25
|
s.add_runtime_dependency "httparty"
|
26
|
+
s.add_runtime_dependency "activesupport", '>= 3.0.0'
|
25
27
|
end
|
data/spec/helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
begin
|
2
|
+
require 'rspec'
|
3
|
+
require 'rspec/its'
|
4
|
+
rescue LoadError
|
5
|
+
require 'rubygems'
|
6
|
+
gem 'rspec'
|
7
|
+
require 'spec'
|
8
|
+
end
|
9
|
+
|
10
|
+
$:.unshift File.expand_path('../../lib',__FILE__)
|
11
|
+
require 'namecheap'
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
def reset_config
|
15
|
+
Namecheap.config.username = nil
|
16
|
+
Namecheap.config.key = nil
|
17
|
+
Namecheap.config.client_ip = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_dummy_config
|
21
|
+
Namecheap.config.username = "the_username"
|
22
|
+
Namecheap.config.key = "the_key"
|
23
|
+
Namecheap.config.client_ip = "127.0.0.1"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Namecheap::Dns do
|
4
|
+
before { set_dummy_config }
|
5
|
+
|
6
|
+
it 'should initialize' do
|
7
|
+
Namecheap::Dns.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be already initialized from the Namecheap namespace' do
|
11
|
+
Namecheap.dns.should_not be_nil
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Namecheap::Ssl do
|
4
|
+
before { set_dummy_config }
|
5
|
+
|
6
|
+
it 'should initialize' do
|
7
|
+
Namecheap::Ssl.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be already initialized from the Namecheap namespace' do
|
11
|
+
Namecheap.ssl.should_not be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should not raise an error' do
|
15
|
+
Namecheap.ssl.get_list
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Namecheap::Transfers do
|
4
|
+
before { set_dummy_config }
|
5
|
+
|
6
|
+
it 'should initialize' do
|
7
|
+
Namecheap::Transfers.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be already initialized from the Namecheap namespace' do
|
11
|
+
Namecheap.transfers.should_not be_nil
|
12
|
+
end
|
13
|
+
end
|