dnsimple-ruby 1.7.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -9
- data/{CHANGELOG.markdown → CHANGELOG.md} +4 -0
- data/Gemfile +0 -2
- data/LICENSE +1 -1
- data/README.md +5 -0
- data/Rakefile +0 -15
- data/dnsimple-ruby.gemspec +11 -19
- data/lib/dnsimple-ruby.rb +2 -0
- metadata +20 -288
- data/README.markdown +0 -159
- data/bin/dnsimple +0 -4
- data/bin/dnsimple.rb +0 -156
- data/features/README.md +0 -9
- data/features/cli/certificates/purchase_certificate.feature +0 -10
- data/features/cli/contacts/create_contact.feature +0 -10
- data/features/cli/domains/check_domain.feature +0 -10
- data/features/cli/domains/create_domain.feature +0 -10
- data/features/cli/domains/delete_domain.feature +0 -11
- data/features/cli/domains/register_domain.feature +0 -10
- data/features/cli/records/create_ptr_record.feature +0 -11
- data/features/cli/records/create_record.feature +0 -12
- data/features/cli/records/delete_record.feature +0 -14
- data/features/cli/templates/apply_template.feature +0 -11
- data/features/step_definitions/certificate_steps.rb +0 -3
- data/features/step_definitions/cli_steps.rb +0 -8
- data/features/step_definitions/domain_steps.rb +0 -32
- data/features/step_definitions/record_steps.rb +0 -38
- data/features/step_definitions/template_steps.rb +0 -9
- data/features/support/env.rb +0 -19
- data/lib/dnsimple.rb +0 -33
- data/lib/dnsimple/base.rb +0 -10
- data/lib/dnsimple/certificate.rb +0 -140
- data/lib/dnsimple/cli.rb +0 -121
- data/lib/dnsimple/client.rb +0 -128
- data/lib/dnsimple/commands/certificate_describe.rb +0 -34
- data/lib/dnsimple/commands/certificate_list.rb +0 -15
- data/lib/dnsimple/commands/certificate_purchase.rb +0 -17
- data/lib/dnsimple/commands/certificate_submit.rb +0 -17
- data/lib/dnsimple/commands/contact_create.rb +0 -23
- data/lib/dnsimple/commands/contact_delete.rb +0 -14
- data/lib/dnsimple/commands/contact_describe.rb +0 -25
- data/lib/dnsimple/commands/contact_list.rb +0 -13
- data/lib/dnsimple/commands/contact_update.rb +0 -25
- data/lib/dnsimple/commands/domain_apply_template.rb +0 -15
- data/lib/dnsimple/commands/domain_check.rb +0 -11
- data/lib/dnsimple/commands/domain_clear.rb +0 -16
- data/lib/dnsimple/commands/domain_create.rb +0 -16
- data/lib/dnsimple/commands/domain_delete.rb +0 -14
- data/lib/dnsimple/commands/domain_describe.rb +0 -14
- data/lib/dnsimple/commands/domain_list.rb +0 -13
- data/lib/dnsimple/commands/domain_register.rb +0 -33
- data/lib/dnsimple/commands/domain_transfer.rb +0 -21
- data/lib/dnsimple/commands/extended_attribute_list.rb +0 -25
- data/lib/dnsimple/commands/me.rb +0 -18
- data/lib/dnsimple/commands/record_create.rb +0 -18
- data/lib/dnsimple/commands/record_delete.rb +0 -16
- data/lib/dnsimple/commands/record_describe.rb +0 -16
- data/lib/dnsimple/commands/record_list.rb +0 -19
- data/lib/dnsimple/commands/record_update.rb +0 -23
- data/lib/dnsimple/commands/service_add.rb +0 -14
- data/lib/dnsimple/commands/service_describe.rb +0 -12
- data/lib/dnsimple/commands/service_list.rb +0 -14
- data/lib/dnsimple/commands/service_list_applied.rb +0 -16
- data/lib/dnsimple/commands/service_list_available.rb +0 -16
- data/lib/dnsimple/commands/service_remove.rb +0 -14
- data/lib/dnsimple/commands/template_create.rb +0 -14
- data/lib/dnsimple/commands/template_delete.rb +0 -13
- data/lib/dnsimple/commands/template_list.rb +0 -13
- data/lib/dnsimple/commands/template_record_create.rb +0 -18
- data/lib/dnsimple/commands/template_record_delete.rb +0 -16
- data/lib/dnsimple/commands/template_record_list.rb +0 -17
- data/lib/dnsimple/contact.rb +0 -154
- data/lib/dnsimple/domain.rb +0 -217
- data/lib/dnsimple/error.rb +0 -32
- data/lib/dnsimple/extended_attribute.rb +0 -52
- data/lib/dnsimple/record.rb +0 -94
- data/lib/dnsimple/service.rb +0 -42
- data/lib/dnsimple/template.rb +0 -63
- data/lib/dnsimple/template_record.rb +0 -80
- data/lib/dnsimple/transfer_order.rb +0 -34
- data/lib/dnsimple/user.rb +0 -51
- data/lib/dnsimple/version.rb +0 -3
- data/spec/ci/.dnsimple.test +0 -3
- data/spec/commands/certificate_purchase_spec.rb +0 -25
- data/spec/commands/certificate_submit_spec.rb +0 -18
- data/spec/commands/record_create_spec.rb +0 -23
- data/spec/commands/record_list_spec.rb +0 -23
- data/spec/commands/service_add_spec.rb +0 -20
- data/spec/dnsimple/certificate_spec.rb +0 -59
- data/spec/dnsimple/client_spec.rb +0 -154
- data/spec/dnsimple/contact_spec.rb +0 -45
- data/spec/dnsimple/domain_spec.rb +0 -133
- data/spec/dnsimple/extended_attributes_spec.rb +0 -54
- data/spec/dnsimple/record_spec.rb +0 -51
- data/spec/dnsimple/template_spec.rb +0 -31
- data/spec/dnsimple/user_spec.rb +0 -70
- data/spec/files/2fa/error-badtoken.http +0 -22
- data/spec/files/2fa/error-required.http +0 -23
- data/spec/files/2fa/exchange-token.http +0 -25
- data/spec/files/account/user/success.http +0 -19
- data/spec/files/certificates/index/success.http +0 -19
- data/spec/files/certificates/show/notfound.http +0 -17
- data/spec/files/certificates/show/success.http +0 -19
- data/spec/files/contacts/show/notfound.http +0 -17
- data/spec/files/contacts/show/success.http +0 -19
- data/spec/files/domains/auto_renewal_disable/notfound.http +0 -21
- data/spec/files/domains/auto_renewal_disable/success.http +0 -23
- data/spec/files/domains/auto_renewal_enable/notfound.http +0 -21
- data/spec/files/domains/auto_renewal_enable/success.http +0 -23
- data/spec/files/domains/show/notfound.http +0 -17
- data/spec/files/domains/show/success.http +0 -19
- data/spec/files/extended_attributes/ca.http +0 -19
- data/spec/files/extended_attributes/com.http +0 -19
- data/spec/files/extended_attributes/success.http +0 -19
- data/spec/files/records/index/success.http +0 -19
- data/spec/files/records/show/notfound.http +0 -17
- data/spec/files/records/show/success.http +0 -19
- data/spec/files/templates/show/notfound.http +0 -17
- data/spec/files/templates/show/success.http +0 -19
- data/spec/spec_helper.rb +0 -39
- data/spec/support/helpers.rb +0 -15
- data/spec/support/webmock.rb +0 -11
@@ -1,34 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class CertificateDescribe
|
4
|
-
def execute(args, options = {})
|
5
|
-
domain_name = args.shift
|
6
|
-
certificate_id = args.shift
|
7
|
-
domain = Domain.find(domain_name)
|
8
|
-
certificate = Certificate.find(domain, certificate_id)
|
9
|
-
puts "Certificate: #{certificate.fqdn}"
|
10
|
-
puts "\tID: #{certificate.id}"
|
11
|
-
puts "\tStatus: #{certificate.certificate_status}"
|
12
|
-
puts "\tCreated: #{certificate.created_at}"
|
13
|
-
puts "\tOrder Date: #{certificate.order_date}"
|
14
|
-
puts "\tExpires: #{certificate.expiration_date}"
|
15
|
-
|
16
|
-
if certificate.approver_email =~ /\S+/
|
17
|
-
puts "\tApprover email: #{certificate.approver_email}"
|
18
|
-
else
|
19
|
-
puts "\tAvailable approver emails:"
|
20
|
-
certificate.available_approver_emails.split(",").each do |email|
|
21
|
-
puts "\t\t#{email}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
puts
|
26
|
-
puts "#{certificate.csr}"
|
27
|
-
puts
|
28
|
-
puts "#{certificate.private_key}"
|
29
|
-
puts
|
30
|
-
puts "#{certificate.ssl_certificate}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class CertificateList
|
4
|
-
def execute(args, options = {})
|
5
|
-
domain_name = args.shift
|
6
|
-
domain = DNSimple::Domain.find(domain_name)
|
7
|
-
certificates = DNSimple::Certificate.all(domain)
|
8
|
-
puts "Found #{certificates.length} certificate for #{domain_name}"
|
9
|
-
certificates.each do |certificate|
|
10
|
-
puts "\t#{certificate.fqdn} (id: #{certificate.id}, status: #{certificate.certificate_status})"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class CertificatePurchase
|
4
|
-
def execute(args, options = {})
|
5
|
-
domain_name = args.shift
|
6
|
-
name = args.shift
|
7
|
-
contact_id = args.shift
|
8
|
-
|
9
|
-
domain = Domain.find(domain_name)
|
10
|
-
contact = Contact.find(contact_id)
|
11
|
-
|
12
|
-
certificate = Certificate.purchase(domain, name, contact)
|
13
|
-
puts "Purchased certificate for #{certificate.fqdn}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class CertificateSubmit
|
4
|
-
def execute(args, options = {})
|
5
|
-
domain_name = args.shift
|
6
|
-
certificate_id = args.shift
|
7
|
-
approver_email = args.shift
|
8
|
-
|
9
|
-
domain = DNSimple::Domain.find(domain_name)
|
10
|
-
certificate = DNSimple::Certificate.find(domain, certificate_id)
|
11
|
-
certificate.submit(approver_email)
|
12
|
-
|
13
|
-
puts "Certificate submitted, authorization by email required"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
|
4
|
-
# Command to create a contact.
|
5
|
-
#
|
6
|
-
# contact:create [ name:value name:value ... ]
|
7
|
-
#
|
8
|
-
class ContactCreate
|
9
|
-
def execute(args, options = {})
|
10
|
-
attributes = {}
|
11
|
-
attributes['state_province_choice'] = 'S'
|
12
|
-
args.each do |arg|
|
13
|
-
name, value = arg.split(":")
|
14
|
-
attributes[Contact.resolve(name)] = value
|
15
|
-
end
|
16
|
-
|
17
|
-
contact = Contact.create(attributes, options)
|
18
|
-
puts "Created contact #{contact.name} (id: #{contact.id})"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class ContactDescribe
|
4
|
-
def execute(args, options = {})
|
5
|
-
id = args.shift
|
6
|
-
contact = Contact.find(id)
|
7
|
-
puts "Contact: #{contact.name}:"
|
8
|
-
puts "\tID: #{contact.id}"
|
9
|
-
puts "\tFirst Name: #{contact.first_name}"
|
10
|
-
puts "\tLast Name: #{contact.last_name}"
|
11
|
-
puts "\tOrganization Name: #{contact.organization_name}" if contact.organization_name
|
12
|
-
puts "\tJob Title: #{contact.job_title}" if contact.job_title
|
13
|
-
puts "\tAddress 1: #{contact.address1}"
|
14
|
-
puts "\tAddress 2: #{contact.address2}"
|
15
|
-
puts "\tCity: #{contact.city}"
|
16
|
-
puts "\tState or Province: #{contact.state_province}"
|
17
|
-
puts "\tPostal Code: #{contact.postal_code}"
|
18
|
-
puts "\tCountry: #{contact.country}"
|
19
|
-
puts "\tEmail: #{contact.email_address}"
|
20
|
-
puts "\tPhone: #{contact.phone}"
|
21
|
-
puts "\tPhone Ext: #{contact.phone_ext}" if contact.phone_ext
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class ContactList
|
4
|
-
def execute(args, options = {})
|
5
|
-
contacts = Contact.all
|
6
|
-
puts "Found #{contacts.length} contacts:"
|
7
|
-
contacts.each do |contact|
|
8
|
-
puts "\t#{contact.name} (id:#{contact.id})"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class ContactUpdate
|
4
|
-
# Execute the contact:update command.
|
5
|
-
#
|
6
|
-
# Args expected:
|
7
|
-
# id [name:value name:value ...]
|
8
|
-
def execute(args, options = {})
|
9
|
-
attributes = {}
|
10
|
-
id = args.shift
|
11
|
-
args.each do |arg|
|
12
|
-
name, value = arg.split(":")
|
13
|
-
attributes[Contact.resolve(name)] = value
|
14
|
-
end
|
15
|
-
|
16
|
-
contact = Contact.find(id)
|
17
|
-
attributes.each do |name, value|
|
18
|
-
contact.send("#{name}=", value)
|
19
|
-
end
|
20
|
-
contact.save
|
21
|
-
puts "Updated contact #{contact.name} (id: #{contact.id})"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class DomainApplyTemplate
|
4
|
-
def execute(args, options = {})
|
5
|
-
domain_name = args.shift
|
6
|
-
template_name = args.shift
|
7
|
-
|
8
|
-
domain = Domain.find(domain_name)
|
9
|
-
domain.apply(template_name)
|
10
|
-
|
11
|
-
puts "Applied template #{template_name} to #{domain.name}"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class DomainClear
|
4
|
-
def execute(args, options = {})
|
5
|
-
name = args.shift
|
6
|
-
|
7
|
-
records = Record.all(name)
|
8
|
-
records.each do |record|
|
9
|
-
record.delete
|
10
|
-
end
|
11
|
-
|
12
|
-
puts "Deleted #{records.length} records from #{name}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class DomainCreate
|
4
|
-
def execute(args, options = {})
|
5
|
-
name = args.shift
|
6
|
-
domain = Domain.create(name)
|
7
|
-
puts "Created #{domain.name}"
|
8
|
-
|
9
|
-
if template = options.delete(:template)
|
10
|
-
domain.apply(template)
|
11
|
-
puts "Applied template #{template} to #{domain.name}"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class DomainDescribe
|
4
|
-
def execute(args, options = {})
|
5
|
-
name = args.shift
|
6
|
-
domain = Domain.find(name)
|
7
|
-
puts "Domain #{domain.name}:"
|
8
|
-
puts "\tID: #{domain.id}"
|
9
|
-
puts "\tCreated: #{domain.created_at}"
|
10
|
-
puts "\tName Server Status: #{domain.name_server_status}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class DomainRegister
|
4
|
-
def execute(args, options = {})
|
5
|
-
name = args.shift
|
6
|
-
registrant = nil
|
7
|
-
|
8
|
-
registrant_id_or_attribute = args.shift
|
9
|
-
if registrant_id_or_attribute
|
10
|
-
if registrant_id_or_attribute =~ /^\d+$/
|
11
|
-
registrant = {:id => registrant_id_or_attribute}
|
12
|
-
else
|
13
|
-
args.unshift(registrant_id_or_attribute)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
extended_attributes = {}
|
18
|
-
args.each do |arg|
|
19
|
-
n, v = arg.split(":")
|
20
|
-
extended_attributes[n] = v
|
21
|
-
end
|
22
|
-
|
23
|
-
domain = Domain.register(name, registrant, extended_attributes)
|
24
|
-
puts "Registered #{domain.name}"
|
25
|
-
|
26
|
-
if template = options.delete(:template)
|
27
|
-
domain.apply(template)
|
28
|
-
puts "Applied template #{template} to #{domain.name}"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class DomainTransfer
|
4
|
-
def execute(args, options = {})
|
5
|
-
name = args.shift
|
6
|
-
registrant = {:id => args.shift}
|
7
|
-
authinfo = args.shift unless args.empty?
|
8
|
-
authinfo ||= ''
|
9
|
-
|
10
|
-
extended_attributes = {}
|
11
|
-
args.each do |arg|
|
12
|
-
n, v = arg.split(":")
|
13
|
-
extended_attributes[n] = v
|
14
|
-
end
|
15
|
-
|
16
|
-
transfer_order = TransferOrder.create(name, authinfo, registrant, extended_attributes)
|
17
|
-
puts "Transfer order issued for #{name}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class ExtendedAttributeList
|
4
|
-
def execute(args, options = {})
|
5
|
-
tld = args.shift
|
6
|
-
extended_attributes = ExtendedAttribute.find(tld)
|
7
|
-
puts "Extended attributes: "
|
8
|
-
extended_attributes.each do |extended_attribute|
|
9
|
-
o = " #{extended_attribute.name}"
|
10
|
-
o << " (required)" if extended_attribute.required
|
11
|
-
o << " : #{extended_attribute.description}\n"
|
12
|
-
unless extended_attribute.options.empty?
|
13
|
-
o << " Options:\n"
|
14
|
-
extended_attribute.options.each do |option|
|
15
|
-
o << " #{option.title}: #{option.value}"
|
16
|
-
o << " (#{option.description})" if option.description
|
17
|
-
o << "\n"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
puts o
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/dnsimple/commands/me.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class Me
|
4
|
-
def execute(args, options = {})
|
5
|
-
puts "Connecting to #{Client.base_uri}"
|
6
|
-
user = User.me
|
7
|
-
puts "User details:"
|
8
|
-
puts "\tID:#{user.id}"
|
9
|
-
puts "\tCreated: #{user.created_at}"
|
10
|
-
puts "\tEmail: #{user.email}"
|
11
|
-
puts "\tSuccessful logins: #{user.login_count}"
|
12
|
-
puts "\tFailed logins: #{user.failed_login_count}"
|
13
|
-
puts "\tDomains in account: #{user.domain_count}"
|
14
|
-
puts "\tDomains allowed: #{user.domain_limit}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class RecordCreate
|
4
|
-
def execute(args, options = {})
|
5
|
-
name = args.shift
|
6
|
-
record_name = args.shift
|
7
|
-
record_type = args.shift
|
8
|
-
content = args.shift
|
9
|
-
ttl = args.shift
|
10
|
-
|
11
|
-
domain = Domain.find(name)
|
12
|
-
record = Record.create(domain, record_name, record_type, content, :ttl => ttl, :prio => options[:prio])
|
13
|
-
|
14
|
-
puts "Created #{record.record_type} record for #{domain.name} (id:#{record.id})"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module DNSimple
|
2
|
-
module Commands
|
3
|
-
class RecordDelete
|
4
|
-
def execute(args, options = {})
|
5
|
-
domain_name = args.shift
|
6
|
-
id = args.shift
|
7
|
-
|
8
|
-
domain = Domain.find(domain_name)
|
9
|
-
record = Record.find(domain, id)
|
10
|
-
record.delete
|
11
|
-
|
12
|
-
puts "Deleted #{record.id} from #{domain.name}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|