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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +15 -0
- data/COPYING +159 -668
- data/README.md +110 -59
- data/lib/namecheap/api.rb +69 -16
- data/lib/namecheap/config.rb +19 -47
- 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 +26 -19
- data/lib/namecheap.rb +19 -17
- metadata +124 -82
- data/.gitignore +0 -8
- data/.rvmrc +0 -3
- data/Gemfile +0 -4
- data/Rakefile +0 -6
- data/lib/monkey_patch.rb +0 -84
- data/namecheap.gemspec +0 -25
- data/spec/domains_spec.rb +0 -11
- data/spec/namecheap_spec.rb +0 -48
- data/spec/spec_helper.rb +0 -10
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
|
data/namecheap.gemspec
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
-
require "namecheap/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |s|
|
|
6
|
-
s.name = "namecheap"
|
|
7
|
-
s.version = Namecheap::VERSION
|
|
8
|
-
s.authors = ["parasquid"]
|
|
9
|
-
s.email = ["tristan.gomez@gmail.com"]
|
|
10
|
-
s.homepage = "https://github.com/parasquid/namecheap"
|
|
11
|
-
s.summary = %q{Ruby wrapper for the Namecheap API}
|
|
12
|
-
s.description = %q{Ruby wrapper for the Namecheap API}
|
|
13
|
-
|
|
14
|
-
s.rubyforge_project = "namecheap"
|
|
15
|
-
|
|
16
|
-
s.files = `git ls-files`.split("\n")
|
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
19
|
-
s.require_paths = ["lib"]
|
|
20
|
-
|
|
21
|
-
# specify any dependencies here; for example:
|
|
22
|
-
s.add_development_dependency "rspec"
|
|
23
|
-
# s.add_runtime_dependency "rest-client"
|
|
24
|
-
s.add_runtime_dependency "httparty"
|
|
25
|
-
end
|
data/spec/domains_spec.rb
DELETED
data/spec/namecheap_spec.rb
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "NamecheapAPI Wrapper" do
|
|
4
|
-
describe "initializating settings" do
|
|
5
|
-
|
|
6
|
-
before :each do
|
|
7
|
-
Namecheap.reset
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe "with defaults" do
|
|
11
|
-
it "should contain a username" do
|
|
12
|
-
Namecheap.username.should == 'apiuser'
|
|
13
|
-
end
|
|
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
|
|
21
|
-
|
|
22
|
-
describe "with defaults overidden" do
|
|
23
|
-
it "should contain an overidden key" do
|
|
24
|
-
Namecheap.configure do |config|
|
|
25
|
-
config.key = 'newkey'
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
Namecheap.key.should == 'newkey'
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "should contain an overridden username" do
|
|
32
|
-
Namecheap.configure do |config|
|
|
33
|
-
config.username = 'newuser'
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
Namecheap.username.should == 'newuser'
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "should contain an overridden client_ip" do
|
|
40
|
-
Namecheap.configure do |config|
|
|
41
|
-
config.client_ip = '192.168.0.1'
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
Namecheap.client_ip.should == '192.168.0.1'
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|