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.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +3 -9
  4. data/{CHANGELOG.markdown → CHANGELOG.md} +4 -0
  5. data/Gemfile +0 -2
  6. data/LICENSE +1 -1
  7. data/README.md +5 -0
  8. data/Rakefile +0 -15
  9. data/dnsimple-ruby.gemspec +11 -19
  10. data/lib/dnsimple-ruby.rb +2 -0
  11. metadata +20 -288
  12. data/README.markdown +0 -159
  13. data/bin/dnsimple +0 -4
  14. data/bin/dnsimple.rb +0 -156
  15. data/features/README.md +0 -9
  16. data/features/cli/certificates/purchase_certificate.feature +0 -10
  17. data/features/cli/contacts/create_contact.feature +0 -10
  18. data/features/cli/domains/check_domain.feature +0 -10
  19. data/features/cli/domains/create_domain.feature +0 -10
  20. data/features/cli/domains/delete_domain.feature +0 -11
  21. data/features/cli/domains/register_domain.feature +0 -10
  22. data/features/cli/records/create_ptr_record.feature +0 -11
  23. data/features/cli/records/create_record.feature +0 -12
  24. data/features/cli/records/delete_record.feature +0 -14
  25. data/features/cli/templates/apply_template.feature +0 -11
  26. data/features/step_definitions/certificate_steps.rb +0 -3
  27. data/features/step_definitions/cli_steps.rb +0 -8
  28. data/features/step_definitions/domain_steps.rb +0 -32
  29. data/features/step_definitions/record_steps.rb +0 -38
  30. data/features/step_definitions/template_steps.rb +0 -9
  31. data/features/support/env.rb +0 -19
  32. data/lib/dnsimple.rb +0 -33
  33. data/lib/dnsimple/base.rb +0 -10
  34. data/lib/dnsimple/certificate.rb +0 -140
  35. data/lib/dnsimple/cli.rb +0 -121
  36. data/lib/dnsimple/client.rb +0 -128
  37. data/lib/dnsimple/commands/certificate_describe.rb +0 -34
  38. data/lib/dnsimple/commands/certificate_list.rb +0 -15
  39. data/lib/dnsimple/commands/certificate_purchase.rb +0 -17
  40. data/lib/dnsimple/commands/certificate_submit.rb +0 -17
  41. data/lib/dnsimple/commands/contact_create.rb +0 -23
  42. data/lib/dnsimple/commands/contact_delete.rb +0 -14
  43. data/lib/dnsimple/commands/contact_describe.rb +0 -25
  44. data/lib/dnsimple/commands/contact_list.rb +0 -13
  45. data/lib/dnsimple/commands/contact_update.rb +0 -25
  46. data/lib/dnsimple/commands/domain_apply_template.rb +0 -15
  47. data/lib/dnsimple/commands/domain_check.rb +0 -11
  48. data/lib/dnsimple/commands/domain_clear.rb +0 -16
  49. data/lib/dnsimple/commands/domain_create.rb +0 -16
  50. data/lib/dnsimple/commands/domain_delete.rb +0 -14
  51. data/lib/dnsimple/commands/domain_describe.rb +0 -14
  52. data/lib/dnsimple/commands/domain_list.rb +0 -13
  53. data/lib/dnsimple/commands/domain_register.rb +0 -33
  54. data/lib/dnsimple/commands/domain_transfer.rb +0 -21
  55. data/lib/dnsimple/commands/extended_attribute_list.rb +0 -25
  56. data/lib/dnsimple/commands/me.rb +0 -18
  57. data/lib/dnsimple/commands/record_create.rb +0 -18
  58. data/lib/dnsimple/commands/record_delete.rb +0 -16
  59. data/lib/dnsimple/commands/record_describe.rb +0 -16
  60. data/lib/dnsimple/commands/record_list.rb +0 -19
  61. data/lib/dnsimple/commands/record_update.rb +0 -23
  62. data/lib/dnsimple/commands/service_add.rb +0 -14
  63. data/lib/dnsimple/commands/service_describe.rb +0 -12
  64. data/lib/dnsimple/commands/service_list.rb +0 -14
  65. data/lib/dnsimple/commands/service_list_applied.rb +0 -16
  66. data/lib/dnsimple/commands/service_list_available.rb +0 -16
  67. data/lib/dnsimple/commands/service_remove.rb +0 -14
  68. data/lib/dnsimple/commands/template_create.rb +0 -14
  69. data/lib/dnsimple/commands/template_delete.rb +0 -13
  70. data/lib/dnsimple/commands/template_list.rb +0 -13
  71. data/lib/dnsimple/commands/template_record_create.rb +0 -18
  72. data/lib/dnsimple/commands/template_record_delete.rb +0 -16
  73. data/lib/dnsimple/commands/template_record_list.rb +0 -17
  74. data/lib/dnsimple/contact.rb +0 -154
  75. data/lib/dnsimple/domain.rb +0 -217
  76. data/lib/dnsimple/error.rb +0 -32
  77. data/lib/dnsimple/extended_attribute.rb +0 -52
  78. data/lib/dnsimple/record.rb +0 -94
  79. data/lib/dnsimple/service.rb +0 -42
  80. data/lib/dnsimple/template.rb +0 -63
  81. data/lib/dnsimple/template_record.rb +0 -80
  82. data/lib/dnsimple/transfer_order.rb +0 -34
  83. data/lib/dnsimple/user.rb +0 -51
  84. data/lib/dnsimple/version.rb +0 -3
  85. data/spec/ci/.dnsimple.test +0 -3
  86. data/spec/commands/certificate_purchase_spec.rb +0 -25
  87. data/spec/commands/certificate_submit_spec.rb +0 -18
  88. data/spec/commands/record_create_spec.rb +0 -23
  89. data/spec/commands/record_list_spec.rb +0 -23
  90. data/spec/commands/service_add_spec.rb +0 -20
  91. data/spec/dnsimple/certificate_spec.rb +0 -59
  92. data/spec/dnsimple/client_spec.rb +0 -154
  93. data/spec/dnsimple/contact_spec.rb +0 -45
  94. data/spec/dnsimple/domain_spec.rb +0 -133
  95. data/spec/dnsimple/extended_attributes_spec.rb +0 -54
  96. data/spec/dnsimple/record_spec.rb +0 -51
  97. data/spec/dnsimple/template_spec.rb +0 -31
  98. data/spec/dnsimple/user_spec.rb +0 -70
  99. data/spec/files/2fa/error-badtoken.http +0 -22
  100. data/spec/files/2fa/error-required.http +0 -23
  101. data/spec/files/2fa/exchange-token.http +0 -25
  102. data/spec/files/account/user/success.http +0 -19
  103. data/spec/files/certificates/index/success.http +0 -19
  104. data/spec/files/certificates/show/notfound.http +0 -17
  105. data/spec/files/certificates/show/success.http +0 -19
  106. data/spec/files/contacts/show/notfound.http +0 -17
  107. data/spec/files/contacts/show/success.http +0 -19
  108. data/spec/files/domains/auto_renewal_disable/notfound.http +0 -21
  109. data/spec/files/domains/auto_renewal_disable/success.http +0 -23
  110. data/spec/files/domains/auto_renewal_enable/notfound.http +0 -21
  111. data/spec/files/domains/auto_renewal_enable/success.http +0 -23
  112. data/spec/files/domains/show/notfound.http +0 -17
  113. data/spec/files/domains/show/success.http +0 -19
  114. data/spec/files/extended_attributes/ca.http +0 -19
  115. data/spec/files/extended_attributes/com.http +0 -19
  116. data/spec/files/extended_attributes/success.http +0 -19
  117. data/spec/files/records/index/success.http +0 -19
  118. data/spec/files/records/show/notfound.http +0 -17
  119. data/spec/files/records/show/success.http +0 -19
  120. data/spec/files/templates/show/notfound.http +0 -17
  121. data/spec/files/templates/show/success.http +0 -19
  122. data/spec/spec_helper.rb +0 -39
  123. data/spec/support/helpers.rb +0 -15
  124. 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,14 +0,0 @@
1
- module DNSimple
2
- module Commands
3
- class ContactDelete
4
- def execute(args, options = {})
5
- id = args.shift
6
-
7
- contact = Contact.find(id)
8
- contact.delete
9
-
10
- puts "Deleted #{contact.name} (id: #{contact.id})"
11
- end
12
- end
13
- end
14
- 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,11 +0,0 @@
1
- module DNSimple
2
- module Commands
3
- class DomainCheck
4
- def execute(args, options = {})
5
- name = args.shift
6
- response = Domain.check(name)
7
- puts "Check domain result for #{name}: #{response}"
8
- end
9
- end
10
- end
11
- 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 DomainDelete
4
- def execute(args, options = {})
5
- name_or_id = args.shift
6
-
7
- domain = Domain.find(name_or_id)
8
- domain.delete
9
-
10
- puts "Deleted #{domain.name}"
11
- end
12
- end
13
- end
14
- 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,13 +0,0 @@
1
- module DNSimple
2
- module Commands
3
- class DomainList
4
- def execute(args, options = {})
5
- domains = Domain.all
6
- puts "Found #{domains.length} domains:"
7
- domains.each do |domain|
8
- puts "\t#{domain.name}"
9
- end
10
- end
11
- end
12
- end
13
- 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
@@ -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