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
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Namecheap::Users do
|
4
|
+
before { set_dummy_config }
|
5
|
+
|
6
|
+
it 'should initialize' do
|
7
|
+
Namecheap::Users.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be already initialized from the Namecheap namespace' do
|
11
|
+
Namecheap.users.should_not be_nil
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Namecheap::Whois_Guard do
|
4
|
+
before { set_dummy_config }
|
5
|
+
|
6
|
+
it 'should initialize' do
|
7
|
+
Namecheap::Whois_Guard.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be already initialized from the Namecheap namespace' do
|
11
|
+
Namecheap.whois_guard.should_not be_nil
|
12
|
+
end
|
13
|
+
end
|
data/spec/namecheap_spec.rb
CHANGED
@@ -1,48 +1,39 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
3
|
+
describe Namecheap do
|
4
|
+
before { reset_config }
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
end
|
6
|
+
context "with default config" do
|
7
|
+
subject { Namecheap.config }
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
it "should contain a key" do
|
15
|
-
Namecheap.key.should == 'apikey'
|
16
|
-
end
|
17
|
-
it "should contain a client_ip" do
|
18
|
-
Namecheap.client_ip.should == '127.0.0.1'
|
19
|
-
end
|
20
|
-
end
|
9
|
+
its(:username) { should be_nil }
|
10
|
+
its(:key) { should be_nil }
|
11
|
+
its(:client_ip) { should be_nil }
|
12
|
+
end
|
21
13
|
|
22
|
-
|
23
|
-
|
14
|
+
describe '.configure' do
|
15
|
+
it 'should set the api key' do
|
16
|
+
expect {
|
24
17
|
Namecheap.configure do |config|
|
25
|
-
config.key = '
|
18
|
+
config.key = 'the_apikey'
|
26
19
|
end
|
20
|
+
}.to change { Namecheap::Config.key }.to('the_apikey')
|
21
|
+
end
|
27
22
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
it "should contain an overridden username" do
|
23
|
+
it 'should set the username' do
|
24
|
+
expect {
|
32
25
|
Namecheap.configure do |config|
|
33
|
-
config.username = '
|
26
|
+
config.username = 'the_username'
|
34
27
|
end
|
28
|
+
}.to change { Namecheap::Config.username }.to('the_username')
|
29
|
+
end
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
it "should contain an overridden client_ip" do
|
31
|
+
it 'should set the client_ip' do
|
32
|
+
expect {
|
40
33
|
Namecheap.configure do |config|
|
41
|
-
config.client_ip = '
|
34
|
+
config.client_ip = 'the_client_ip'
|
42
35
|
end
|
43
|
-
|
44
|
-
Namecheap.client_ip.should == '192.168.0.1'
|
45
|
-
end
|
36
|
+
}.to change { Namecheap::Config.client_ip }.to('the_client_ip')
|
46
37
|
end
|
47
38
|
end
|
48
|
-
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,67 +1,85 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: namecheap
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- parasquid
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-08-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
22
21
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-its
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
32
34
|
type: :development
|
33
|
-
|
34
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
35
42
|
name: httparty
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
36
49
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0
|
46
62
|
type: :runtime
|
47
|
-
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.0
|
48
69
|
description: Ruby wrapper for the Namecheap API
|
49
|
-
email:
|
70
|
+
email:
|
50
71
|
- tristan.gomez@gmail.com
|
51
72
|
executables: []
|
52
|
-
|
53
73
|
extensions: []
|
54
|
-
|
55
74
|
extra_rdoc_files: []
|
56
|
-
|
57
|
-
files:
|
75
|
+
files:
|
58
76
|
- .gitignore
|
59
|
-
- .
|
77
|
+
- .ruby-version
|
78
|
+
- .travis.yml
|
60
79
|
- COPYING
|
61
80
|
- Gemfile
|
62
81
|
- README.md
|
63
82
|
- Rakefile
|
64
|
-
- lib/monkey_patch.rb
|
65
83
|
- lib/namecheap.rb
|
66
84
|
- lib/namecheap/api.rb
|
67
85
|
- lib/namecheap/config.rb
|
@@ -74,43 +92,37 @@ files:
|
|
74
92
|
- lib/namecheap/version.rb
|
75
93
|
- lib/namecheap/whois_guard.rb
|
76
94
|
- namecheap.gemspec
|
77
|
-
- spec/
|
95
|
+
- spec/helper.rb
|
96
|
+
- spec/namecheap/dns_spec.rb
|
97
|
+
- spec/namecheap/domains_spec.rb
|
98
|
+
- spec/namecheap/ns_spec.rb
|
99
|
+
- spec/namecheap/ssl_spec.rb
|
100
|
+
- spec/namecheap/transfers.rb
|
101
|
+
- spec/namecheap/users_spec.rb
|
102
|
+
- spec/namecheap/whois_guard_spec.rb
|
78
103
|
- spec/namecheap_spec.rb
|
79
|
-
- spec/spec_helper.rb
|
80
104
|
homepage: https://github.com/parasquid/namecheap
|
81
|
-
licenses:
|
82
|
-
|
105
|
+
licenses:
|
106
|
+
- GNU
|
107
|
+
metadata: {}
|
83
108
|
post_install_message:
|
84
109
|
rdoc_options: []
|
85
|
-
|
86
|
-
require_paths:
|
110
|
+
require_paths:
|
87
111
|
- lib
|
88
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
none: false
|
99
|
-
requirements:
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
hash: 3
|
103
|
-
segments:
|
104
|
-
- 0
|
105
|
-
version: "0"
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
106
122
|
requirements: []
|
107
|
-
|
108
123
|
rubyforge_project: namecheap
|
109
|
-
rubygems_version: 1.
|
124
|
+
rubygems_version: 2.1.5
|
110
125
|
signing_key:
|
111
|
-
specification_version:
|
126
|
+
specification_version: 4
|
112
127
|
summary: Ruby wrapper for the Namecheap API
|
113
|
-
test_files:
|
114
|
-
- spec/domains_spec.rb
|
115
|
-
- spec/namecheap_spec.rb
|
116
|
-
- spec/spec_helper.rb
|
128
|
+
test_files: []
|
data/.rvmrc
DELETED
data/lib/monkey_patch.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# Monkey-patches, mostly taken from Rails :)
|
2
|
-
|
3
|
-
class Hash
|
4
|
-
def symbolize_keys!
|
5
|
-
keys.each do |key|
|
6
|
-
self[(key.to_sym rescue key) || key] = delete(key)
|
7
|
-
end
|
8
|
-
self
|
9
|
-
end
|
10
|
-
|
11
|
-
def to_param(namespace = nil)
|
12
|
-
collect do |key, value|
|
13
|
-
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
|
14
|
-
end.sort * '&'
|
15
|
-
end
|
16
|
-
|
17
|
-
def camelize_keys!
|
18
|
-
keys.each do |key|
|
19
|
-
self[key.to_s.camelize] = delete(key)
|
20
|
-
end
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
protected
|
26
|
-
|
27
|
-
def to_query(key)
|
28
|
-
require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
|
29
|
-
"#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Module
|
34
|
-
# Delegate method
|
35
|
-
# It expects an array of arguments that contains
|
36
|
-
# the methods to be delegated and a hash of options
|
37
|
-
def delegate(*methods)
|
38
|
-
# Pop up the options hash from arguments array
|
39
|
-
options = methods.pop
|
40
|
-
# Check the availability of the options hash
|
41
|
-
# and more specifically the :to option
|
42
|
-
# Raises an error if one of them is not there
|
43
|
-
unless options.is_a?(Hash) && to = options[:to]
|
44
|
-
raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)."
|
45
|
-
end
|
46
|
-
|
47
|
-
# Make sure the :to option follows syntax rules
|
48
|
-
# for method names
|
49
|
-
if options[:prefix] == true && options[:to].to_s =~ /^[^a-z_]/
|
50
|
-
raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method."
|
51
|
-
end
|
52
|
-
|
53
|
-
# Set the real prefix value
|
54
|
-
prefix = options[:prefix] && "#{options[:prefix] == true ? to : options[:prefix]}_"
|
55
|
-
|
56
|
-
# Here comes the magic of ruby :)
|
57
|
-
# Reflection techniques are used here:
|
58
|
-
# module_eval is used to add new methods on the fly which:
|
59
|
-
# expose the contained methods' objects
|
60
|
-
methods.each do |method|
|
61
|
-
module_eval("def #{prefix}#{method}(*args, &block)\n#{to}.__send__(#{method.inspect}, *args, &block)\nend\n", "(__DELEGATION__)", 1)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
class String
|
67
|
-
def camelize(first_letter = :upper)
|
68
|
-
case first_letter
|
69
|
-
when :upper then _camelize(self, true)
|
70
|
-
when :lower then _camelize(self, false)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def _camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
|
77
|
-
if first_letter_in_uppercase
|
78
|
-
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
79
|
-
else
|
80
|
-
lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1]
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|