dnsimple-ruby 1.0.0 → 1.1.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/.bundle/config +3 -2
- data/Gemfile +1 -0
- data/Gemfile.lock +38 -30
- data/README +5 -0
- data/README.rdoc +5 -0
- data/README.textile +18 -0
- data/VERSION +1 -1
- data/bin/dnsimple.rb +2 -0
- data/dnsimple-ruby.gemspec +64 -10
- data/fixtures/vcr_cassettes/DNSimple_Certificate/_all.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Certificate/_purchase.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Certificate/_submit.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Contact/a_new_contact.yml +16 -18
- data/fixtures/vcr_cassettes/DNSimple_Contact/an_existing_contact.yml +15 -17
- data/fixtures/vcr_cassettes/DNSimple_Domain/_all.yml +45 -96
- data/fixtures/vcr_cassettes/DNSimple_Domain/applying_templates.yml +69 -169
- data/fixtures/vcr_cassettes/DNSimple_Domain/creating_a_new_domain.yml +16 -18
- data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_id.yml +15 -17
- data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_name.yml +15 -17
- data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_a_new_registrant_contact.yml +16 -18
- data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_an_existing_contact.yml +16 -18
- data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_ca.yml +12 -14
- data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_com.yml +12 -14
- data/fixtures/vcr_cassettes/DNSimple_Record/_all.yml +59 -247
- data/fixtures/vcr_cassettes/DNSimple_Record/creating_a_new_record.yml +16 -63
- data/fixtures/vcr_cassettes/DNSimple_Record/find_a_record.yml +13 -60
- data/fixtures/vcr_cassettes/DNSimple_Template/a_template.yml +15 -17
- data/fixtures/vcr_cassettes/DNSimple_User/_me.yml +15 -17
- data/lib/dnsimple/certificate.rb +49 -6
- data/lib/dnsimple/command.rb +10 -0
- data/lib/dnsimple/commands/add_service.rb +4 -2
- data/lib/dnsimple/commands/purchase_certificate.rb +4 -2
- data/lib/dnsimple/commands/submit_certificate.rb +19 -0
- data/lib/dnsimple/domain.rb +5 -4
- data/lib/dnsimple/record.rb +11 -15
- data/spec/certificate_spec.rb +31 -3
- data/spec/command_spec.rb +19 -0
- data/spec/commands/add_service_spec.rb +29 -0
- data/spec/commands/purchase_certificate_spec.rb +14 -0
- data/spec/commands/submit_certificate_spec.rb +19 -0
- data/spec/contact_spec.rb +1 -1
- data/spec/domain_spec.rb +21 -19
- data/spec/record_spec.rb +10 -9
- data/spec/spec_helper.rb +1 -0
- data/spec/user_spec.rb +12 -12
- metadata +38 -12
- data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain.yml +0 -46
data/lib/dnsimple/domain.rb
CHANGED
|
@@ -30,7 +30,7 @@ module DNSimple #:nodoc:
|
|
|
30
30
|
# be undone.
|
|
31
31
|
def delete(options={})
|
|
32
32
|
options.merge!(DNSimple::Client.standard_options_with_credentials)
|
|
33
|
-
self.class.delete("#{DNSimple::Client.base_uri}/domains/#{
|
|
33
|
+
self.class.delete("#{DNSimple::Client.base_uri}/domains/#{name}", options)
|
|
34
34
|
end
|
|
35
35
|
alias :destroy :delete
|
|
36
36
|
|
|
@@ -38,8 +38,9 @@ module DNSimple #:nodoc:
|
|
|
38
38
|
# all of the records in the template to the domain.
|
|
39
39
|
def apply(template, options={})
|
|
40
40
|
options.merge!(DNSimple::Client.standard_options_with_credentials)
|
|
41
|
+
options.merge!(:body => {})
|
|
41
42
|
template = resolve_template(template)
|
|
42
|
-
self.class.post("#{DNSimple::Client.base_uri}/domains/#{
|
|
43
|
+
self.class.post("#{DNSimple::Client.base_uri}/domains/#{name}/templates/#{template.id}/apply", options)
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
#:nodoc:
|
|
@@ -54,7 +55,7 @@ module DNSimple #:nodoc:
|
|
|
54
55
|
|
|
55
56
|
def applied_services(options={})
|
|
56
57
|
options.merge!(DNSimple::Client.standard_options_with_credentials)
|
|
57
|
-
response = self.class.get("#{Client.base_uri}/domains/#{
|
|
58
|
+
response = self.class.get("#{Client.base_uri}/domains/#{name}/applied_services", options)
|
|
58
59
|
pp response if DNSimple::Client.debug?
|
|
59
60
|
case response.code
|
|
60
61
|
when 200
|
|
@@ -68,7 +69,7 @@ module DNSimple #:nodoc:
|
|
|
68
69
|
|
|
69
70
|
def available_services(options={})
|
|
70
71
|
options.merge!(DNSimple::Client.standard_options_with_credentials)
|
|
71
|
-
response = self.class.get("#{DNSimple::Client.base_uri}/domains/#{
|
|
72
|
+
response = self.class.get("#{DNSimple::Client.base_uri}/domains/#{name}/available_services", options)
|
|
72
73
|
pp response if DNSimple::Client.debug?
|
|
73
74
|
case response.code
|
|
74
75
|
when 200
|
data/lib/dnsimple/record.rb
CHANGED
|
@@ -65,18 +65,16 @@ module DNSimple
|
|
|
65
65
|
aliases[name] || name
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def self.create(
|
|
69
|
-
domain = DNSimple::Domain.find(domain_name)
|
|
70
|
-
|
|
68
|
+
def self.create(domain, name, record_type, content, options={})
|
|
71
69
|
record_hash = {:name => name, :record_type => record_type, :content => content}
|
|
72
70
|
record_hash[:ttl] = options.delete(:ttl) || 3600
|
|
73
71
|
record_hash[:prio] = options.delete(:priority)
|
|
74
72
|
record_hash[:prio] = options.delete(:prio) || ''
|
|
75
73
|
|
|
76
74
|
options.merge!(DNSimple::Client.standard_options_with_credentials)
|
|
77
|
-
options.merge!({:
|
|
75
|
+
options.merge!({:body => {:record => record_hash}})
|
|
78
76
|
|
|
79
|
-
response = self.post("#{DNSimple::Client.base_uri}/domains/#{domain.
|
|
77
|
+
response = self.post("#{DNSimple::Client.base_uri}/domains/#{domain.name}/records", options)
|
|
80
78
|
|
|
81
79
|
pp response if DNSimple::Client.debug?
|
|
82
80
|
|
|
@@ -86,16 +84,15 @@ module DNSimple
|
|
|
86
84
|
when 401
|
|
87
85
|
raise RuntimeError, "Authentication failed"
|
|
88
86
|
when 406
|
|
89
|
-
raise DNSimple::RecordExists.new("#{name}.#{
|
|
87
|
+
raise DNSimple::RecordExists.new("#{name}.#{domain.name}", response["errors"])
|
|
90
88
|
else
|
|
91
|
-
raise DNSimple::Error.new("#{name}.#{
|
|
89
|
+
raise DNSimple::Error.new("#{name}.#{domain.name}", response["errors"])
|
|
92
90
|
end
|
|
93
91
|
end
|
|
94
92
|
|
|
95
|
-
def self.find(
|
|
96
|
-
domain = DNSimple::Domain.find(domain_name)
|
|
93
|
+
def self.find(domain, id, options={})
|
|
97
94
|
options.merge!(DNSimple::Client.standard_options_with_credentials)
|
|
98
|
-
response = self.get("#{DNSimple::Client.base_uri}/domains/#{domain.
|
|
95
|
+
response = self.get("#{DNSimple::Client.base_uri}/domains/#{domain.name}/records/#{id}", options)
|
|
99
96
|
|
|
100
97
|
pp response if DNSimple::Client.debug?
|
|
101
98
|
|
|
@@ -105,16 +102,15 @@ module DNSimple
|
|
|
105
102
|
when 401
|
|
106
103
|
raise RuntimeError, "Authentication failed"
|
|
107
104
|
when 404
|
|
108
|
-
raise RuntimeError, "Could not find record #{id} for domain #{
|
|
105
|
+
raise RuntimeError, "Could not find record #{id} for domain #{domain.name}"
|
|
109
106
|
else
|
|
110
|
-
raise DNSimple::Error.new("#{
|
|
107
|
+
raise DNSimple::Error.new("#{domain.name}/#{id}", response["errors"])
|
|
111
108
|
end
|
|
112
109
|
end
|
|
113
110
|
|
|
114
|
-
def self.all(
|
|
115
|
-
domain = DNSimple::Domain.find(domain_name)
|
|
111
|
+
def self.all(domain, options={})
|
|
116
112
|
options.merge!(DNSimple::Client.standard_options_with_credentials)
|
|
117
|
-
response = self.get("#{DNSimple::Client.base_uri}/domains/#{domain.
|
|
113
|
+
response = self.get("#{DNSimple::Client.base_uri}/domains/#{domain.name}/records", options)
|
|
118
114
|
|
|
119
115
|
pp response if DNSimple::Client.debug?
|
|
120
116
|
|
data/spec/certificate_spec.rb
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe DNSimple::Certificate do
|
|
4
|
-
let(:
|
|
4
|
+
let(:domain_name) { 'example.com' }
|
|
5
|
+
let(:domain) { DNSimple::Domain.new(:name => domain_name) }
|
|
6
|
+
|
|
5
7
|
describe "#fqdn" do
|
|
6
8
|
it "joins the name and domain name" do
|
|
7
9
|
certificate = DNSimple::Certificate.new(:name => 'www')
|
|
8
10
|
certificate.domain = domain
|
|
9
|
-
certificate.fqdn.should eq(
|
|
11
|
+
certificate.fqdn.should eq("www.#{domain_name}")
|
|
10
12
|
end
|
|
11
13
|
it "strips blank parts from name" do
|
|
12
14
|
certificate = DNSimple::Certificate.new(:name => '')
|
|
13
15
|
certificate.domain = domain
|
|
14
|
-
certificate.fqdn.should eq(
|
|
16
|
+
certificate.fqdn.should eq(domain_name)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe ".purchase" do
|
|
21
|
+
let(:contact) { DNSimple::Contact.new(:id => 1) }
|
|
22
|
+
use_vcr_cassette
|
|
23
|
+
it "purchases a certificate" do
|
|
24
|
+
certificate = DNSimple::Certificate.purchase(domain, 'www', contact)
|
|
25
|
+
certificate.fqdn.should eq("www.#{domain_name}")
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe ".all" do
|
|
30
|
+
use_vcr_cassette
|
|
31
|
+
it "returns all certificates for the specific domain" do
|
|
32
|
+
certificates = DNSimple::Certificate.all(domain)
|
|
33
|
+
certificates.length.should eq(1)
|
|
34
|
+
certificates.first.fqdn.should eq('www.example.com')
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe "#submit" do
|
|
39
|
+
use_vcr_cassette
|
|
40
|
+
let(:certificate) { DNSimple::Certificate.new(:id => 1, :domain => domain) }
|
|
41
|
+
it "submits a certificate for purchase" do
|
|
42
|
+
certificate.submit("admin@example.com")
|
|
15
43
|
end
|
|
16
44
|
end
|
|
17
45
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'dnsimple/command'
|
|
3
|
+
|
|
4
|
+
class FakeCommand < DNSimple::Command
|
|
5
|
+
def execute
|
|
6
|
+
say "done"
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe DNSimple::Command do
|
|
11
|
+
describe "#say" do
|
|
12
|
+
it "writes to the output" do
|
|
13
|
+
s = StringIO.new
|
|
14
|
+
command = FakeCommand.new(s)
|
|
15
|
+
command.execute
|
|
16
|
+
s.string.should eq("done\n")
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'dnsimple/commands/add_service'
|
|
3
|
+
|
|
4
|
+
describe DNSimple::Commands::AddService do
|
|
5
|
+
let(:out) { StringIO.new }
|
|
6
|
+
|
|
7
|
+
let(:domain_name) { 'example.com' }
|
|
8
|
+
let(:short_name) { 'service-name' }
|
|
9
|
+
let(:args) { [domain_name, short_name] }
|
|
10
|
+
|
|
11
|
+
let(:domain) { DNSimple::Domain.new(:name => domain_name) }
|
|
12
|
+
let(:service) { stub("service", :name => "Service") }
|
|
13
|
+
|
|
14
|
+
before do
|
|
15
|
+
DNSimple::Domain.expects(:find).with(domain_name).returns(domain)
|
|
16
|
+
DNSimple::Service.expects(:find).with(short_name).returns(service)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "adds a service to a domain" do
|
|
20
|
+
domain.expects(:add_service).with(short_name)
|
|
21
|
+
DNSimple::Commands::AddService.new(out).execute(args)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "reports to the caller" do
|
|
25
|
+
domain.stubs(:add_service)
|
|
26
|
+
DNSimple::Commands::AddService.new(out).execute(args)
|
|
27
|
+
out.string.should eq("Added #{service.name} to #{domain_name}\n")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'dnsimple/certificate'
|
|
3
|
+
require 'dnsimple/commands/purchase_certificate'
|
|
4
|
+
|
|
5
|
+
describe DNSimple::Commands::PurchaseCertificate do
|
|
6
|
+
let(:out) { StringIO.new }
|
|
7
|
+
let(:domain_name) { 'example.com' }
|
|
8
|
+
context "with one argument" do
|
|
9
|
+
it "purchases the certificate" do
|
|
10
|
+
DNSimple::Certificate.expects(:purchase).with(domain_name, '').returns(stub("certificate", :fqdn => domain_name))
|
|
11
|
+
DNSimple::Commands::PurchaseCertificate.new(out).execute([domain_name])
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'dnsimple/commands/submit_certificate'
|
|
3
|
+
|
|
4
|
+
describe DNSimple::Commands::SubmitCertificate do
|
|
5
|
+
let(:out) { StringIO.new }
|
|
6
|
+
let(:domain) { DNSimple::Domain.new(:name => domain_name) }
|
|
7
|
+
let(:domain_name) { 'example.com' }
|
|
8
|
+
let(:name) { 'www' }
|
|
9
|
+
let(:certificate) { DNSimple::Certificate.new(:id => certificate_id, :domain => domain) }
|
|
10
|
+
let(:certificate_id) { 1 }
|
|
11
|
+
let(:approver_email) { 'admin@example.com' }
|
|
12
|
+
|
|
13
|
+
it "submits the certificate" do
|
|
14
|
+
DNSimple::Domain.stubs(:find).with(domain_name).returns(domain)
|
|
15
|
+
DNSimple::Certificate.expects(:find).with(domain, certificate_id).returns(certificate)
|
|
16
|
+
certificate.expects(:submit).with(approver_email)
|
|
17
|
+
DNSimple::Commands::SubmitCertificate.new(out).execute([domain_name, certificate_id, approver_email])
|
|
18
|
+
end
|
|
19
|
+
end
|
data/spec/contact_spec.rb
CHANGED
data/spec/domain_spec.rb
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
2
2
|
|
|
3
3
|
describe DNSimple::Domain do
|
|
4
|
+
let(:domain_name) { "example.com" }
|
|
5
|
+
let(:contact_id) { 1 }
|
|
6
|
+
|
|
4
7
|
describe "creating a new domain" do
|
|
5
8
|
use_vcr_cassette
|
|
6
9
|
it "has specific attributes" do
|
|
7
|
-
@domain = DNSimple::Domain.create(
|
|
8
|
-
@domain.name.should eql(
|
|
10
|
+
@domain = DNSimple::Domain.create(domain_name)
|
|
11
|
+
@domain.name.should eql(domain_name)
|
|
9
12
|
@domain.id.should_not be_nil
|
|
10
13
|
end
|
|
11
14
|
end
|
|
@@ -13,33 +16,34 @@ describe DNSimple::Domain do
|
|
|
13
16
|
context "by id" do
|
|
14
17
|
use_vcr_cassette
|
|
15
18
|
it "can be found" do
|
|
16
|
-
domain = DNSimple::Domain.find(
|
|
17
|
-
domain.name.should eql(
|
|
19
|
+
domain = DNSimple::Domain.find(39)
|
|
20
|
+
domain.name.should eql(domain_name)
|
|
18
21
|
domain.id.should_not be_nil
|
|
19
22
|
end
|
|
20
23
|
end
|
|
21
24
|
context "by name" do
|
|
22
25
|
use_vcr_cassette
|
|
23
26
|
it "can be found" do
|
|
24
|
-
domain = DNSimple::Domain.find(
|
|
25
|
-
domain.name.should eql(
|
|
27
|
+
domain = DNSimple::Domain.find(domain_name)
|
|
28
|
+
domain.name.should eql(domain_name)
|
|
26
29
|
domain.id.should_not be_nil
|
|
27
30
|
end
|
|
28
31
|
end
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
context "registration" do
|
|
32
|
-
let(:name) { "testdomain.net" }
|
|
33
35
|
|
|
34
36
|
context "with an existing contact" do
|
|
37
|
+
let(:domain_name) { "dnsimple-example-1321042237.com" }
|
|
35
38
|
use_vcr_cassette
|
|
36
39
|
it "can be registered" do
|
|
37
|
-
domain = DNSimple::Domain.register(
|
|
38
|
-
domain.name.should eql(
|
|
40
|
+
domain = DNSimple::Domain.register(domain_name, {:id => contact_id})
|
|
41
|
+
domain.name.should eql(domain_name)
|
|
39
42
|
end
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
context "with a new registrant contact" do
|
|
46
|
+
let(:domain_name) { "dnsimple-example-1321042288.com" }
|
|
43
47
|
use_vcr_cassette
|
|
44
48
|
it "can be registered" do
|
|
45
49
|
registrant = {
|
|
@@ -52,8 +56,8 @@ describe DNSimple::Domain do
|
|
|
52
56
|
:postal_code => '33143',
|
|
53
57
|
:phone => '321 555 1212'
|
|
54
58
|
}
|
|
55
|
-
domain = DNSimple::Domain.register(
|
|
56
|
-
domain.name.should eql(
|
|
59
|
+
domain = DNSimple::Domain.register(domain_name, registrant)
|
|
60
|
+
domain.name.should eql(domain_name)
|
|
57
61
|
end
|
|
58
62
|
end
|
|
59
63
|
end
|
|
@@ -62,8 +66,8 @@ describe DNSimple::Domain do
|
|
|
62
66
|
use_vcr_cassette
|
|
63
67
|
before do
|
|
64
68
|
@domains = []
|
|
65
|
-
|
|
66
|
-
@domains << DNSimple::Domain.create("
|
|
69
|
+
2.times do |n|
|
|
70
|
+
@domains << DNSimple::Domain.create("example#{n}.com")
|
|
67
71
|
end
|
|
68
72
|
end
|
|
69
73
|
it "returns a list of domains" do
|
|
@@ -74,13 +78,11 @@ describe DNSimple::Domain do
|
|
|
74
78
|
|
|
75
79
|
describe "applying templates" do
|
|
76
80
|
use_vcr_cassette
|
|
77
|
-
|
|
78
|
-
@domain = DNSimple::Domain.find("testdomain.com")
|
|
79
|
-
end
|
|
81
|
+
let(:domain) { DNSimple::Domain.find("example.com") }
|
|
80
82
|
it "applies a named template" do
|
|
81
|
-
DNSimple::Record.all(
|
|
82
|
-
|
|
83
|
-
DNSimple::Record.all(
|
|
83
|
+
DNSimple::Record.all(domain).should be_empty
|
|
84
|
+
domain.apply("googleapps")
|
|
85
|
+
DNSimple::Record.all(domain).should_not be_empty
|
|
84
86
|
end
|
|
85
87
|
end
|
|
86
88
|
end
|
data/spec/record_spec.rb
CHANGED
|
@@ -2,23 +2,24 @@ require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
|
2
2
|
|
|
3
3
|
describe DNSimple::Record do
|
|
4
4
|
|
|
5
|
-
let(:
|
|
5
|
+
let(:domain_name) { 'example.com' }
|
|
6
|
+
let(:domain) { DNSimple::Domain.new(:name => domain_name) }
|
|
6
7
|
|
|
7
8
|
describe "#fqdn" do
|
|
8
9
|
it "joins the name and domain name" do
|
|
9
10
|
record = DNSimple::Record.new(:name => 'www', :domain => domain)
|
|
10
|
-
record.fqdn.should eq(
|
|
11
|
+
record.fqdn.should eq("www.#{domain_name}")
|
|
11
12
|
end
|
|
12
13
|
it "strips a blank name" do
|
|
13
14
|
record = DNSimple::Record.new(:name => '', :domain => domain)
|
|
14
|
-
record.fqdn.should eq(
|
|
15
|
+
record.fqdn.should eq(domain_name)
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
describe "creating a new record" do
|
|
19
20
|
use_vcr_cassette
|
|
20
21
|
it "has specific attributes" do
|
|
21
|
-
record = DNSimple::Record.create(
|
|
22
|
+
record = DNSimple::Record.create(domain, "", "A", "1.2.3.4", :ttl => 600)
|
|
22
23
|
record.name.should eql("")
|
|
23
24
|
record.record_type.should eql("A")
|
|
24
25
|
record.content.should eql("1.2.3.4")
|
|
@@ -29,7 +30,7 @@ describe DNSimple::Record do
|
|
|
29
30
|
describe "find a record" do
|
|
30
31
|
use_vcr_cassette
|
|
31
32
|
it "can be found by id" do
|
|
32
|
-
record = DNSimple::Record.find(
|
|
33
|
+
record = DNSimple::Record.find(domain, 70)
|
|
33
34
|
record.name.should eql("")
|
|
34
35
|
record.record_type.should eql("A")
|
|
35
36
|
record.content.should eql("1.2.3.4")
|
|
@@ -43,13 +44,13 @@ describe DNSimple::Record do
|
|
|
43
44
|
before do
|
|
44
45
|
@records = []
|
|
45
46
|
|
|
46
|
-
@records << DNSimple::Record.create(
|
|
47
|
-
@records << DNSimple::Record.create(
|
|
48
|
-
@records << DNSimple::Record.create(
|
|
47
|
+
@records << DNSimple::Record.create(domain, "", "A", "4.5.6.7")
|
|
48
|
+
@records << DNSimple::Record.create(domain, "www", "CNAME", "testdomain.com")
|
|
49
|
+
@records << DNSimple::Record.create(domain, "", "MX", "mail.foo.com", :prio => 10)
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
it "returns a list of records" do
|
|
52
|
-
records = DNSimple::Record.all(
|
|
53
|
+
records = DNSimple::Record.all(domain)
|
|
53
54
|
records.should_not be_empty
|
|
54
55
|
records.length.should eql(@records.length)
|
|
55
56
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/user_spec.rb
CHANGED
|
@@ -3,21 +3,21 @@ require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
|
3
3
|
describe DNSimple::User do
|
|
4
4
|
describe ".me" do
|
|
5
5
|
use_vcr_cassette
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end
|
|
6
|
+
let(:user) { DNSimple::User.me }
|
|
7
|
+
|
|
9
8
|
it "returns the current user" do
|
|
10
|
-
|
|
9
|
+
user.should_not be_nil
|
|
11
10
|
end
|
|
11
|
+
|
|
12
12
|
it "has attributes" do
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
user.id.should_not be_nil
|
|
14
|
+
user.created_at.should_not be_nil
|
|
15
|
+
user.updated_at.should_not be_nil
|
|
16
|
+
user.email.should_not be_nil
|
|
17
|
+
user.login_count.should_not be_nil
|
|
18
|
+
user.failed_login_count.should_not be_nil
|
|
19
|
+
user.domain_count.should_not be_nil
|
|
20
|
+
user.domain_limit.should_not be_nil
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dnsimple-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 17
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 1.
|
|
8
|
+
- 1
|
|
9
|
+
- 1
|
|
10
|
+
version: 1.1.1
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Anthony Eden
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-11-
|
|
18
|
+
date: 2011-11-12 00:00:00 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
@@ -86,7 +86,7 @@ dependencies:
|
|
|
86
86
|
- 0
|
|
87
87
|
version: "0"
|
|
88
88
|
version_requirements: *id005
|
|
89
|
-
name:
|
|
89
|
+
name: mocha
|
|
90
90
|
prerelease: false
|
|
91
91
|
type: :development
|
|
92
92
|
- !ruby/object:Gem::Dependency
|
|
@@ -100,7 +100,7 @@ dependencies:
|
|
|
100
100
|
- 0
|
|
101
101
|
version: "0"
|
|
102
102
|
version_requirements: *id006
|
|
103
|
-
name:
|
|
103
|
+
name: ruby-debug
|
|
104
104
|
prerelease: false
|
|
105
105
|
type: :development
|
|
106
106
|
- !ruby/object:Gem::Dependency
|
|
@@ -114,7 +114,7 @@ dependencies:
|
|
|
114
114
|
- 0
|
|
115
115
|
version: "0"
|
|
116
116
|
version_requirements: *id007
|
|
117
|
-
name:
|
|
117
|
+
name: cucumber
|
|
118
118
|
prerelease: false
|
|
119
119
|
type: :development
|
|
120
120
|
- !ruby/object:Gem::Dependency
|
|
@@ -128,7 +128,7 @@ dependencies:
|
|
|
128
128
|
- 0
|
|
129
129
|
version: "0"
|
|
130
130
|
version_requirements: *id008
|
|
131
|
-
name:
|
|
131
|
+
name: aruba
|
|
132
132
|
prerelease: false
|
|
133
133
|
type: :development
|
|
134
134
|
- !ruby/object:Gem::Dependency
|
|
@@ -142,7 +142,7 @@ dependencies:
|
|
|
142
142
|
- 0
|
|
143
143
|
version: "0"
|
|
144
144
|
version_requirements: *id009
|
|
145
|
-
name:
|
|
145
|
+
name: ruby-debug
|
|
146
146
|
prerelease: false
|
|
147
147
|
type: :development
|
|
148
148
|
- !ruby/object:Gem::Dependency
|
|
@@ -156,7 +156,7 @@ dependencies:
|
|
|
156
156
|
- 0
|
|
157
157
|
version: "0"
|
|
158
158
|
version_requirements: *id010
|
|
159
|
-
name:
|
|
159
|
+
name: fakeweb
|
|
160
160
|
prerelease: false
|
|
161
161
|
type: :development
|
|
162
162
|
- !ruby/object:Gem::Dependency
|
|
@@ -170,6 +170,20 @@ dependencies:
|
|
|
170
170
|
- 0
|
|
171
171
|
version: "0"
|
|
172
172
|
version_requirements: *id011
|
|
173
|
+
name: vcr
|
|
174
|
+
prerelease: false
|
|
175
|
+
type: :development
|
|
176
|
+
- !ruby/object:Gem::Dependency
|
|
177
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
|
178
|
+
none: false
|
|
179
|
+
requirements:
|
|
180
|
+
- - ">="
|
|
181
|
+
- !ruby/object:Gem::Version
|
|
182
|
+
hash: 3
|
|
183
|
+
segments:
|
|
184
|
+
- 0
|
|
185
|
+
version: "0"
|
|
186
|
+
version_requirements: *id012
|
|
173
187
|
name: httparty
|
|
174
188
|
prerelease: false
|
|
175
189
|
type: :runtime
|
|
@@ -215,12 +229,14 @@ files:
|
|
|
215
229
|
- features/step_definitions/record_steps.rb
|
|
216
230
|
- features/step_definitions/template_steps.rb
|
|
217
231
|
- features/support/env.rb
|
|
232
|
+
- fixtures/vcr_cassettes/DNSimple_Certificate/_all.yml
|
|
233
|
+
- fixtures/vcr_cassettes/DNSimple_Certificate/_purchase.yml
|
|
234
|
+
- fixtures/vcr_cassettes/DNSimple_Certificate/_submit.yml
|
|
218
235
|
- fixtures/vcr_cassettes/DNSimple_Contact/a_new_contact.yml
|
|
219
236
|
- fixtures/vcr_cassettes/DNSimple_Contact/an_existing_contact.yml
|
|
220
237
|
- fixtures/vcr_cassettes/DNSimple_Domain/_all.yml
|
|
221
238
|
- fixtures/vcr_cassettes/DNSimple_Domain/applying_templates.yml
|
|
222
239
|
- fixtures/vcr_cassettes/DNSimple_Domain/creating_a_new_domain.yml
|
|
223
|
-
- fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain.yml
|
|
224
240
|
- fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_id.yml
|
|
225
241
|
- fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_name.yml
|
|
226
242
|
- fixtures/vcr_cassettes/DNSimple_Domain/registration/with_a_new_registrant_contact.yml
|
|
@@ -236,6 +252,7 @@ files:
|
|
|
236
252
|
- lib/dnsimple/certificate.rb
|
|
237
253
|
- lib/dnsimple/cli.rb
|
|
238
254
|
- lib/dnsimple/client.rb
|
|
255
|
+
- lib/dnsimple/command.rb
|
|
239
256
|
- lib/dnsimple/commands/add_service.rb
|
|
240
257
|
- lib/dnsimple/commands/add_template_record.rb
|
|
241
258
|
- lib/dnsimple/commands/apply_template.rb
|
|
@@ -267,6 +284,7 @@ files:
|
|
|
267
284
|
- lib/dnsimple/commands/purchase_certificate.rb
|
|
268
285
|
- lib/dnsimple/commands/register_domain.rb
|
|
269
286
|
- lib/dnsimple/commands/remove_service.rb
|
|
287
|
+
- lib/dnsimple/commands/submit_certificate.rb
|
|
270
288
|
- lib/dnsimple/commands/transfer_domain.rb
|
|
271
289
|
- lib/dnsimple/commands/update_contact.rb
|
|
272
290
|
- lib/dnsimple/commands/update_record.rb
|
|
@@ -282,6 +300,10 @@ files:
|
|
|
282
300
|
- lib/dnsimple/user.rb
|
|
283
301
|
- spec/README
|
|
284
302
|
- spec/certificate_spec.rb
|
|
303
|
+
- spec/command_spec.rb
|
|
304
|
+
- spec/commands/add_service_spec.rb
|
|
305
|
+
- spec/commands/purchase_certificate_spec.rb
|
|
306
|
+
- spec/commands/submit_certificate_spec.rb
|
|
285
307
|
- spec/contact_spec.rb
|
|
286
308
|
- spec/domain_spec.rb
|
|
287
309
|
- spec/extended_attributes_spec.rb
|
|
@@ -324,6 +346,10 @@ specification_version: 3
|
|
|
324
346
|
summary: A ruby wrapper for the DNSimple API
|
|
325
347
|
test_files:
|
|
326
348
|
- spec/certificate_spec.rb
|
|
349
|
+
- spec/command_spec.rb
|
|
350
|
+
- spec/commands/add_service_spec.rb
|
|
351
|
+
- spec/commands/purchase_certificate_spec.rb
|
|
352
|
+
- spec/commands/submit_certificate_spec.rb
|
|
327
353
|
- spec/contact_spec.rb
|
|
328
354
|
- spec/domain_spec.rb
|
|
329
355
|
- spec/extended_attributes_spec.rb
|