dnsimple-ruby 1.3.2 → 1.4.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.
Files changed (111) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +9 -2
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +7 -0
  7. data/CHANGELOG.md +20 -0
  8. data/Gemfile +0 -2
  9. data/LICENSE +2 -2
  10. data/README.md +121 -0
  11. data/Rakefile +30 -14
  12. data/bin/dnsimple.rb +1 -1
  13. data/dnsimple-ruby.gemspec +9 -8
  14. data/features/README +1 -1
  15. data/features/step_definitions/cli_steps.rb +1 -1
  16. data/features/support/env.rb +4 -4
  17. data/fixtures/vcr_cassettes/DNSimple_Certificate/_all.yml +45 -32
  18. data/fixtures/vcr_cassettes/DNSimple_Certificate/_purchase.yml +45 -32
  19. data/fixtures/vcr_cassettes/DNSimple_Certificate/_submit.yml +45 -32
  20. data/fixtures/vcr_cassettes/DNSimple_Contact/a_new_contact.yml +39 -31
  21. data/fixtures/vcr_cassettes/DNSimple_Contact/an_existing_contact.yml +39 -31
  22. data/fixtures/vcr_cassettes/DNSimple_Domain/_all.yml +113 -94
  23. data/fixtures/vcr_cassettes/DNSimple_Domain/applying_templates.yml +186 -156
  24. data/fixtures/vcr_cassettes/DNSimple_Domain/creating_a_new_domain.yml +39 -32
  25. data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_id.yml +39 -32
  26. data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_name.yml +39 -32
  27. data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_a_new_registrant_contact.yml +40 -32
  28. data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_an_existing_contact.yml +40 -32
  29. data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_ca.yml +262 -29
  30. data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_com.yml +35 -29
  31. data/fixtures/vcr_cassettes/DNSimple_Record/_all.yml +147 -125
  32. data/fixtures/vcr_cassettes/DNSimple_Record/creating_a_new_record.yml +39 -32
  33. data/fixtures/vcr_cassettes/DNSimple_Record/find_a_record.yml +39 -32
  34. data/fixtures/vcr_cassettes/DNSimple_Template/a_template.yml +41 -32
  35. data/fixtures/vcr_cassettes/DNSimple_User/_me.yml +38 -31
  36. data/lib/dnsimple.rb +14 -1
  37. data/lib/dnsimple/base.rb +7 -5
  38. data/lib/dnsimple/certificate.rb +100 -95
  39. data/lib/dnsimple/cli.rb +92 -93
  40. data/lib/dnsimple/client.rb +109 -99
  41. data/lib/dnsimple/commands/{describe_certificate.rb → certificate_describe.rb} +2 -2
  42. data/lib/dnsimple/commands/{list_certificates.rb → certificate_list.rb} +2 -2
  43. data/lib/dnsimple/commands/{purchase_certificate.rb → certificate_purchase.rb} +3 -5
  44. data/lib/dnsimple/commands/{submit_certificate.rb → certificate_submit.rb} +3 -5
  45. data/lib/dnsimple/commands/{create_contact.rb → contact_create.rb} +8 -6
  46. data/lib/dnsimple/commands/{delete_contact.rb → contact_delete.rb} +2 -2
  47. data/lib/dnsimple/commands/{describe_contact.rb → contact_describe.rb} +2 -2
  48. data/lib/dnsimple/commands/{list_contacts.rb → contact_list.rb} +2 -2
  49. data/lib/dnsimple/commands/{update_contact.rb → contact_update.rb} +2 -2
  50. data/lib/dnsimple/commands/{apply_template.rb → domain_apply_template.rb} +2 -2
  51. data/lib/dnsimple/commands/{check_domain.rb → domain_check.rb} +2 -2
  52. data/lib/dnsimple/commands/{clear_domain.rb → domain_clear.rb} +2 -2
  53. data/lib/dnsimple/commands/{create_domain.rb → domain_create.rb} +2 -2
  54. data/lib/dnsimple/commands/{delete_domain.rb → domain_delete.rb} +2 -2
  55. data/lib/dnsimple/commands/{describe_domain.rb → domain_describe.rb} +2 -2
  56. data/lib/dnsimple/commands/{list_domains.rb → domain_list.rb} +2 -2
  57. data/lib/dnsimple/commands/{register_domain.rb → domain_register.rb} +2 -2
  58. data/lib/dnsimple/commands/{transfer_domain.rb → domain_transfer.rb} +2 -2
  59. data/lib/dnsimple/commands/{list_extended_attributes.rb → extended_attribute_list.rb} +2 -2
  60. data/lib/dnsimple/commands/{describe_user.rb → me.rb} +2 -2
  61. data/lib/dnsimple/commands/{create_record.rb → record_create.rb} +5 -7
  62. data/lib/dnsimple/commands/{delete_record.rb → record_delete.rb} +2 -2
  63. data/lib/dnsimple/commands/{describe_record.rb → record_describe.rb} +2 -2
  64. data/lib/dnsimple/commands/{list_records.rb → record_list.rb} +4 -6
  65. data/lib/dnsimple/commands/{update_record.rb → record_update.rb} +2 -2
  66. data/lib/dnsimple/commands/{add_service.rb → service_add.rb} +3 -5
  67. data/lib/dnsimple/commands/{describe_service.rb → service_describe.rb} +2 -2
  68. data/lib/dnsimple/commands/{list_services.rb → service_list.rb} +2 -2
  69. data/lib/dnsimple/commands/{list_applied_services.rb → service_list_applied.rb} +2 -2
  70. data/lib/dnsimple/commands/{list_available_services.rb → service_list_available.rb} +2 -2
  71. data/lib/dnsimple/commands/{remove_service.rb → service_remove.rb} +2 -2
  72. data/lib/dnsimple/commands/{create_template.rb → template_create.rb} +2 -2
  73. data/lib/dnsimple/commands/{delete_template.rb → template_delete.rb} +2 -2
  74. data/lib/dnsimple/commands/{add_template_record.rb → template_record_create.rb} +2 -2
  75. data/lib/dnsimple/commands/{delete_template_record.rb → template_record_delete.rb} +2 -2
  76. data/lib/dnsimple/commands/{list_template_records.rb → template_record_list.rb} +2 -2
  77. data/lib/dnsimple/commands/{list_templates.rb → templates_list.rb} +2 -2
  78. data/lib/dnsimple/contact.rb +115 -110
  79. data/lib/dnsimple/domain.rb +134 -132
  80. data/lib/dnsimple/error.rb +8 -19
  81. data/lib/dnsimple/extended_attribute.rb +39 -33
  82. data/lib/dnsimple/record.rb +71 -67
  83. data/lib/dnsimple/service.rb +31 -24
  84. data/lib/dnsimple/template.rb +52 -46
  85. data/lib/dnsimple/template_record.rb +61 -53
  86. data/lib/dnsimple/transfer_order.rb +24 -18
  87. data/lib/dnsimple/user.rb +22 -18
  88. data/lib/dnsimple/version.rb +1 -1
  89. data/spec/README +1 -1
  90. data/spec/ci/.dnsimple.test +3 -0
  91. data/spec/commands/{purchase_certificate_spec.rb → certificate_purchase_spec.rb} +3 -4
  92. data/spec/commands/{submit_certificate_spec.rb → certificate_submit_spec.rb} +3 -4
  93. data/spec/commands/{create_record_spec.rb → record_create_spec.rb} +4 -4
  94. data/spec/commands/{list_records_spec.rb → records_list_spec.rb} +2 -13
  95. data/spec/commands/{add_service_spec.rb → service_add_spec.rb} +3 -12
  96. data/spec/{certificate_spec.rb → dnsimple/certificate_spec.rb} +0 -0
  97. data/spec/dnsimple/client_spec.rb +45 -18
  98. data/spec/{contact_spec.rb → dnsimple/contact_spec.rb} +3 -1
  99. data/spec/{domain_spec.rb → dnsimple/domain_spec.rb} +2 -0
  100. data/spec/{extended_attributes_spec.rb → dnsimple/extended_attributes_spec.rb} +4 -0
  101. data/spec/{record_spec.rb → dnsimple/record_spec.rb} +2 -0
  102. data/spec/{template_spec.rb → dnsimple/template_spec.rb} +0 -0
  103. data/spec/{user_spec.rb → dnsimple/user_spec.rb} +2 -0
  104. data/spec/spec_helper.rb +24 -10
  105. metadata +96 -99
  106. data/Gemfile.lock +0 -71
  107. data/README +0 -108
  108. data/README.rdoc +0 -108
  109. data/README.textile +0 -138
  110. data/lib/dnsimple/command.rb +0 -10
  111. data/spec/command_spec.rb +0 -19
@@ -1,9 +1,7 @@
1
- require 'dnsimple/command'
2
-
3
1
  module DNSimple
4
2
  module Commands
5
- class PurchaseCertificate < Command
6
- def execute(args, options={})
3
+ class CertificatePurchase
4
+ def execute(args, options = {})
7
5
  domain_name = args.shift
8
6
  name = args.shift
9
7
  contact_id = args.shift
@@ -12,7 +10,7 @@ module DNSimple
12
10
  contact = Contact.find(contact_id)
13
11
 
14
12
  certificate = Certificate.purchase(domain, name, contact)
15
- say "Purchased certificate for #{certificate.fqdn}"
13
+ puts "Purchased certificate for #{certificate.fqdn}"
16
14
  end
17
15
  end
18
16
  end
@@ -1,9 +1,7 @@
1
- require 'dnsimple/command'
2
-
3
1
  module DNSimple
4
2
  module Commands
5
- class SubmitCertificate < Command
6
- def execute(args, options={})
3
+ class CertificateSubmit
4
+ def execute(args, options = {})
7
5
  domain_name = args.shift
8
6
  certificate_id = args.shift
9
7
  approver_email = args.shift
@@ -12,7 +10,7 @@ module DNSimple
12
10
  certificate = DNSimple::Certificate.find(domain, certificate_id)
13
11
  certificate.submit(approver_email)
14
12
 
15
- say "Certificate submitted, authorization by email required"
13
+ puts "Certificate submitted, authorization by email required"
16
14
  end
17
15
  end
18
16
  end
@@ -1,11 +1,12 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class CreateContact
4
- # Execute the contact:create command.
5
- #
6
- # Args expected to be:
7
- # [name:value name:value ...]
8
- def execute(args, options={})
3
+
4
+ # Command to create a contact.
5
+ #
6
+ # contact:create [ name:value name:value ... ]
7
+ #
8
+ class ContactCreate
9
+ def execute(args, options = {})
9
10
  attributes = {}
10
11
  attributes['state_province_choice'] = 'S'
11
12
  args.each do |arg|
@@ -17,5 +18,6 @@ module DNSimple
17
18
  puts "Created contact #{contact.name} (id: #{contact.id})"
18
19
  end
19
20
  end
21
+
20
22
  end
21
23
  end
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DeleteContact
4
- def execute(args, options={})
3
+ class ContactDelete
4
+ def execute(args, options = {})
5
5
  id = args.shift
6
6
 
7
7
  contact = Contact.find(id)
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DescribeContact
4
- def execute(args, options={})
3
+ class ContactDescribe
4
+ def execute(args, options = {})
5
5
  id = args.shift
6
6
  contact = Contact.find(id)
7
7
  puts "Contact: #{contact.name}:"
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class ListContacts
4
- def execute(args, options={})
3
+ class ContactList
4
+ def execute(args, options = {})
5
5
  contacts = Contact.all
6
6
  puts "Found #{contacts.length} contacts:"
7
7
  contacts.each do |contact|
@@ -1,11 +1,11 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class UpdateContact
3
+ class ContactUpdate
4
4
  # Execute the contact:update command.
5
5
  #
6
6
  # Args expected:
7
7
  # id [name:value name:value ...]
8
- def execute(args, options={})
8
+ def execute(args, options = {})
9
9
  attributes = {}
10
10
  id = args.shift
11
11
  args.each do |arg|
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class ApplyTemplate
4
- def execute(args, options={})
3
+ class DomainApplyTemplate
4
+ def execute(args, options = {})
5
5
  domain_name = args.shift
6
6
  template_name = args.shift
7
7
 
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class CheckDomain
4
- def execute(args, options={})
3
+ class DomainCheck
4
+ def execute(args, options = {})
5
5
  name = args.shift
6
6
  response = Domain.check(name)
7
7
  puts "Check domain result for #{name}: #{response}"
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class ClearDomain
4
- def execute(args, options={})
3
+ class DomainClear
4
+ def execute(args, options = {})
5
5
  name = args.shift
6
6
 
7
7
  records = Record.all(name)
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class CreateDomain
4
- def execute(args, options={})
3
+ class DomainCreate
4
+ def execute(args, options = {})
5
5
  name = args.shift
6
6
  domain = Domain.create(name)
7
7
  puts "Created #{domain.name}"
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DeleteDomain
4
- def execute(args, options={})
3
+ class DomainDelete
4
+ def execute(args, options = {})
5
5
  name_or_id = args.shift
6
6
 
7
7
  domain = Domain.find(name_or_id)
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DescribeDomain
4
- def execute(args, options={})
3
+ class DomainDescribe
4
+ def execute(args, options = {})
5
5
  name = args.shift
6
6
  domain = Domain.find(name)
7
7
  puts "Domain #{domain.name}:"
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class ListDomains
4
- def execute(args, options={})
3
+ class DomainList
4
+ def execute(args, options = {})
5
5
  domains = Domain.all
6
6
  puts "Found #{domains.length} domains:"
7
7
  domains.each do |domain|
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class RegisterDomain
4
- def execute(args, options={})
3
+ class DomainRegister
4
+ def execute(args, options = {})
5
5
  name = args.shift
6
6
  registrant = nil
7
7
 
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class TransferDomain
4
- def execute(args, options={})
3
+ class DomainTransfer
4
+ def execute(args, options = {})
5
5
  name = args.shift
6
6
  registrant = {:id => args.shift}
7
7
  authinfo = args.shift unless args.empty?
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class ListExtendedAttributes
4
- def execute(args, options={})
3
+ class ExtendedAttributeList
4
+ def execute(args, options = {})
5
5
  tld = args.shift
6
6
  extended_attributes = ExtendedAttribute.find(tld)
7
7
  puts "Extended attributes: "
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DescribeUser
4
- def execute(args, options={})
3
+ class Me
4
+ def execute(args, options = {})
5
5
  puts "Connecting to #{Client.base_uri}"
6
6
  user = User.me
7
7
  puts "User details:"
@@ -1,19 +1,17 @@
1
- require 'dnsimple/command'
2
-
3
1
  module DNSimple
4
2
  module Commands
5
- class CreateRecord < Command
6
- def execute(args, options={})
3
+ class RecordCreate
4
+ def execute(args, options = {})
7
5
  name = args.shift
8
6
  record_name = args.shift
9
7
  record_type = args.shift
10
8
  content = args.shift
11
9
  ttl = args.shift
12
-
10
+
13
11
  domain = Domain.find(name)
14
12
  record = Record.create(domain, record_name, record_type, content, :ttl => ttl, :prio => options[:prio])
15
-
16
- say "Created #{record.record_type} record for #{domain.name} (id:#{record.id})"
13
+
14
+ puts "Created #{record.record_type} record for #{domain.name} (id:#{record.id})"
17
15
  end
18
16
  end
19
17
  end
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DeleteRecord
4
- def execute(args, options={})
3
+ class RecordDelete
4
+ def execute(args, options = {})
5
5
  domain_name = args.shift
6
6
  id = args.shift
7
7
 
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DescribeRecord
4
- def execute(args, options={})
3
+ class RecordDescribe
4
+ def execute(args, options = {})
5
5
  name = args.shift
6
6
  id = args.shift
7
7
  record = Record.find(name, id)
@@ -1,19 +1,17 @@
1
- require 'dnsimple/command'
2
-
3
1
  module DNSimple
4
2
  module Commands
5
- class ListRecords < Command
6
- def execute(args, options={})
3
+ class RecordList
4
+ def execute(args, options = {})
7
5
  domain_name = args.shift
8
6
 
9
7
  records = Record.all(DNSimple::Domain.new(:name => domain_name))
10
8
 
11
- say "Found #{records.length} records for #{domain_name}"
9
+ puts "Found #{records.length} records for #{domain_name}"
12
10
  records.each do |record|
13
11
  extra = ["ttl:#{record.ttl}", "id:#{record.id}"]
14
12
  extra << "prio:#{record.prio}" if record.record_type == "MX"
15
13
  extra = "(#{extra.join(', ')})"
16
- say "\t#{record.name}.#{record.domain.name} (#{record.record_type})-> #{record.content} #{extra}"
14
+ puts "\t#{record.name}.#{record.domain.name} (#{record.record_type})-> #{record.content} #{extra}"
17
15
  end
18
16
  end
19
17
  end
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class UpdateRecord
4
- def execute(args, options={})
3
+ class RecordUpdate
4
+ def execute(args, options = {})
5
5
  attributes = {}
6
6
  domain_name = args.shift
7
7
  id = args.shift
@@ -1,15 +1,13 @@
1
- require 'dnsimple/command'
2
-
3
1
  module DNSimple
4
2
  module Commands
5
- class AddService < Command
6
- def execute(args, options={})
3
+ class ServiceAdd
4
+ def execute(args, options = {})
7
5
  domain_name = args.shift
8
6
  domain = Domain.find(domain_name)
9
7
  short_name = args.shift
10
8
  service = Service.find(short_name)
11
9
  domain.add_service(short_name)
12
- say "Added #{service.name} to #{domain_name}"
10
+ puts "Added #{service.name} to #{domain_name}"
13
11
  end
14
12
  end
15
13
  end
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DescribeService
4
- def execute(args, options={})
3
+ class ServiceDescribe
4
+ def execute(args, options = {})
5
5
  short_name = args.shift
6
6
  service = Service.find(short_name)
7
7
  puts "\t#{service.name} (short: #{service.short_name}, id: #{service.id})"
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class ListServices
4
- def execute(args, options={})
3
+ class ServiceList
4
+ def execute(args, options = {})
5
5
  services = Service.all
6
6
  puts "Found #{services.length} services:"
7
7
  services.each do |service|
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class ListAppliedServices
4
- def execute(args, options={})
3
+ class ServiceListApplied
4
+ def execute(args, options = {})
5
5
  domain_name = args.shift
6
6
  domain = Domain.find(domain_name)
7
7
  services = domain.applied_services
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class ListAvailableServices
4
- def execute(args, options={})
3
+ class ServiceListAvailable
4
+ def execute(args, options = {})
5
5
  domain_name = args.shift
6
6
  domain = Domain.find(domain_name)
7
7
  services = domain.available_services
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class RemoveService
4
- def execute(args, options={})
3
+ class ServiceRemove
4
+ def execute(args, options = {})
5
5
  domain_name = args.shift
6
6
  domain = Domain.find(domain_name)
7
7
  short_name = args.shift
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class CreateTemplate
4
- def execute(args, options={})
3
+ class TemplateCreate
4
+ def execute(args, options = {})
5
5
  name = args.shift
6
6
  short_name = args.shift
7
7
  description = args.shift unless args.empty?
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DeleteTemplate
4
- def execute(args, options={})
3
+ class TemplateDelete
4
+ def execute(args, options = {})
5
5
  short_name = args.shift
6
6
  template = Template.find(short_name)
7
7
  template.delete
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class AddTemplateRecord
4
- def execute(args, options={})
3
+ class TemplateRecordCreate
4
+ def execute(args, options = {})
5
5
  short_name = args.shift
6
6
  record_name = args.shift
7
7
  record_type = args.shift
@@ -1,7 +1,7 @@
1
1
  module DNSimple
2
2
  module Commands
3
- class DeleteTemplateRecord
4
- def execute(args, options={})
3
+ class TemplateRecordDelete
4
+ def execute(args, options = {})
5
5
  short_name = args.shift
6
6
  id = args.shift
7
7