dnsimple-ruby 1.7.1 → 2.0.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 (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,159 +0,0 @@
1
- # DNSimple Ruby Client
2
-
3
- A Ruby client for the [DNSimple API](http://developer.dnsimple.com/).
4
-
5
- [![Build Status](https://travis-ci.org/aetrion/dnsimple-ruby.svg?branch=master)](https://travis-ci.org/aetrion/dnsimple-ruby)
6
- [![Coverage Status](https://img.shields.io/coveralls/aetrion/dnsimple-ruby.svg)](https://coveralls.io/r/aetrion/dnsimple-ruby?branch=master)
7
-
8
- [DNSimple](https://dnsimple.com/) provides DNS hosting and domain registration that is simple and friendly.
9
- We provide a full API and an easy-to-use web interface so you can get your domain registered and set up with a minimal amount of effort.
10
-
11
- ## Installation
12
-
13
- $ gem install dnsimple-ruby
14
-
15
- ## DNSimple Client
16
-
17
- This library provides a Ruby DNSimple client you can use to interact with the [DNSimple API](http://developer.dnsimple.com/). Here's a short example.
18
-
19
- ```ruby
20
- require 'dnsimple'
21
-
22
- DNSimple::Client.username = 'YOUR_USERNAME'
23
- DNSimple::Client.password = 'YOUR_PASSWORD'
24
-
25
- user = DNSimple::User.me
26
- puts "#{user.domain_count} domains"
27
-
28
- puts "Domains..."
29
- DNSimple::Domain.all.each do |domain|
30
- puts " #{domain.name}"
31
- end
32
-
33
- domain = DNSimple::Domain.find("example.com")
34
- domain.apply("template") # applies a standard or custom template to the domain
35
-
36
- domain = DNSimple::Domain.create("newdomain.com")
37
- puts "Added #{domain.name}"
38
- domain.delete # removes from DNSimple
39
- ```
40
-
41
- For the full API documentation visit http://rubydoc.info/gems/dnsimple-ruby
42
-
43
- ### Authentication
44
-
45
- This client supports both the HTTP Basic and API Token authentication mechanism.
46
-
47
- #### HTTP Basic
48
-
49
- ```ruby
50
- DNSimple::Client.username = 'YOUR_USERNAME'
51
- DNSimple::Client.password = 'YOUR_PASSWORD'
52
-
53
- user = DNSimple::User.me
54
- ```
55
-
56
- #### HTTP Basic with two-factor authentication enabled
57
-
58
- See the [2FA API documentation](http://developer.dnsimple.com/authentication/#twofa).
59
-
60
- ```ruby
61
- # Request the 2FA exchange token
62
- DNSimple::Client.username = 'YOUR_USERNAME'
63
- DNSimple::Client.password = 'YOUR_PASSWORD'
64
- token = DNSimple::User.two_factor_exchange_token('otp-token')
65
-
66
- # Authenticate with the exchange token
67
- DNSimple::Client.exchange_token = token
68
- user = DNSimple::User.me
69
- ```
70
-
71
- #### API Token
72
-
73
- ```ruby
74
- DNSimple::Client.api_token = 'the-token'
75
-
76
- user = DNSimple::User.me
77
- ```
78
-
79
-
80
- ## Credentials
81
-
82
- Create a file in your home directory called `.dnsimple`.
83
-
84
- In this file add the following:
85
-
86
- username: YOUR_USERNAME
87
- password: YOUR_PASSWORD
88
-
89
- Or if using an API token
90
-
91
- username: YOUR_USERNAME
92
- api_token: YOUR_API_TOKEN
93
-
94
- ## Commands
95
-
96
- There are two ways to interact with the DNSimple Ruby wrapper. The first is
97
- to use the command line utility that is included. The commands available
98
- are as follows:
99
-
100
- For help:
101
-
102
- - dnsimple help
103
-
104
- The following commands are available for domains:
105
-
106
- - dnsimple list
107
- - dnsimple describe domain.com
108
- - dnsimple create domain.com
109
- - dnsimple register domain.com registrant_id
110
- - dnsimple transfer domain.com registrant_id [authinfo]
111
- - dnsimple delete domain.com
112
- - dnsimple apply domain.com template_short_name
113
-
114
- Please note that domain registration and transfer can only be done through the API for domains that do not require extended attributes. A future version of the API will add support for extended attributes.
115
-
116
- The following commands are available for records:
117
-
118
- - dnsimple record:create [--prio=priority] domain.com name type content [ttl]
119
- - dnsimple record:list domain.com
120
- - dnsimple record:delete domain.com record_id
121
-
122
- The following commands are available for custom templates:
123
-
124
- - dnsimple template:list
125
- - dnsimple template:create name short_name [description]
126
- - dnsimple template:delete short_name
127
- - dnsimple template:list_records short_name
128
- - dnsimple template:add_record short_name name type content [ttl] [prio]
129
- - dnsimple template:delete_record short_name template_record_id
130
-
131
- The following commands are available for managing contacts:
132
-
133
- - dnsimple contact:list
134
- - dnsimple contact:describe id
135
- - dnsimple contact:create [name:value name:value ...]
136
- - dnsimple contact:update id [name:value name:value ...]
137
- - dnsimple contact:delete id
138
-
139
- The following commands are available for purchasing certificates:
140
-
141
- - dnsimple certificate:purchase domain.com name contact_id
142
- - dnsimple certificate:submit id
143
-
144
- The contact name/value pairs are:
145
-
146
- - first_name
147
- - last_name
148
- - organization_name (optional)
149
- - job_title (required if organization name is specified)
150
- - address1
151
- - address2 (optional)
152
- - city
153
- - state_province (also aliased as state)
154
- - postal_code
155
- - country
156
- - email
157
- - phone
158
- - phone_ext (optional)
159
- - fax (optional)
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require File.dirname(__FILE__) + '/dnsimple'
@@ -1,156 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift(File.dirname(__FILE__) + '/../lib')
4
- require 'dnsimple'
5
- require 'dnsimple/cli'
6
-
7
- cli = DNSimple::CLI.new
8
-
9
- require 'optparse'
10
-
11
- def usage
12
- $stderr.puts <<EOF
13
-
14
- NOTICE: The CLI is moving out into its own repository and its own gem! Visit
15
- https://github.com/aetrion/dnsimple-cli
16
-
17
- This is a command line tool for DNSimple. More information about DNSimple can
18
- be found at http://dnsimple.com/
19
-
20
- Before using this tool you should create a file called .dnsimple in your home
21
- directory and add the following to that file:
22
-
23
- username: YOUR_USERNAME
24
- password: YOUR_PASSWORD
25
-
26
- Alternatively you can pass the credentials via command-line arguments, as in:
27
-
28
- dnsimple -u username -p password command
29
-
30
- == Commands
31
-
32
- All commands are executed as dnsimple [options] command [command-options] args
33
-
34
-
35
- The following commands are available:
36
-
37
- help # Show this usage
38
-
39
- info # Show your account information
40
-
41
- check domain.com # Check if a domain is available (for registration)
42
- create [--template=short_name] domain.com # Add the given domain
43
- register [--template=short_name] domain.com registrant_id \ # Register the given domain with DNSimple
44
- [[name:value] [name:value]] # name:value pairs can be given for extended attributes
45
- transfer domain.com registrant_id [authinfo] \ # Transfer the given domain into DNSimple
46
- [[name:value] [name:value] ...] # name:value pairs can be given for extended attributes
47
- describe domain.com # Describe the given domain
48
- list # List all domains
49
- delete domain.com # Delete the given domain
50
- clear domain.com # Remove all records from the domain
51
- apply domain.com template_short_name # Apply a template to the domain
52
-
53
- record:describe domain.com record_id # Describe the given record
54
- record:create [--prio=priority] domain.com name type \\
55
- content [ttl] # Create the DNS record on the domain
56
- record:list domain.com # List all records for the domain
57
- record:update domain.com record_id \ # Update a specific record
58
- [[name:value] [name:value] ...] # name:value pairs are given for updateable attributes
59
- record:delete domain.com record_id # Delete the given domain
60
-
61
- template:create name short_name [description] # Create a template
62
- template:list # List all templates
63
- template:delete short_name # Delete the given template
64
-
65
- template:list_records short_name # List all of the records for a template
66
- template:add_record [--prio=priority] short_name name \\
67
- type content [ttl] # Add a template record to the given template
68
- template:delete_record short_name template_record_id # Delete the given template record
69
-
70
- contact:create [[name:value [name:value] ...] # Create a contact
71
- contact:list # List all contacts
72
- contact:describe contact_id # Describe the given contact
73
- contact:update contact_id [[name:value] [name:value] ...] # Update the given contact
74
- contact:delete contact_id # Delete the given contact
75
-
76
- extended-attributes:list tld # List all extended attributes for the given TLD
77
-
78
- service:list # List all supported services
79
- service:describe short_name # Describe a specific service
80
-
81
- service:applied domain.com # List all of the services applied to the domain
82
- service:available domain.com # List all of the services available for the domain
83
- service:add domain.com short_name # Add the service to the domain
84
- service:remove domain.com short_name # Remove the service from the domain
85
-
86
- certificate:list domain.com # List all certificates for a domain
87
- certificate:describe domain.com id # Get a specific certificate for a domain
88
- certificate:purchase domain.com name contact_id # Purchase a certificate
89
- certificate:submit domain.com id approver_email # Submit a certificate for processing
90
-
91
- Please see the DNSimple documentation at http://developer.dnsimple.com for additional
92
- information on the commands that are available to DNSimple customers.
93
-
94
- EOF
95
- end
96
-
97
- if $0.split("/").last == 'dnsimple'
98
-
99
- options = {}
100
-
101
- global = OptionParser.new do |opts|
102
- opts.on("-s", "--site [ARG]") do |site|
103
- DNSimple::Client.site_uri = site
104
- end
105
- opts.on("-u", "--username [ARG]") do |username|
106
- DNSimple::Client.username = username
107
- end
108
- opts.on("-p", "--password [ARG]") do |password|
109
- DNSimple::Client.password = password
110
- end
111
- opts.on("-c", "--credentials [ARG]") do |credentials|
112
- DNSimple::Client.load_credentials(credentials)
113
- end
114
- opts.on("-d") do
115
- DNSimple::Client.debug = true
116
- end
117
- end
118
-
119
- subcommands = {
120
- 'create' => OptionParser.new do |opts|
121
- opts.on("--template [ARG]") do |opt|
122
- options[:template] = opt
123
- end
124
- end,
125
- 'register' => OptionParser.new do |opts|
126
- opts.on("--template [ARG]") do |opt|
127
- options[:template] = opt
128
- end
129
- end,
130
- 'record:create' => OptionParser.new do |opts|
131
- opts.on("--prio [ARG]") do |prio|
132
- options[:prio] = prio
133
- end
134
- end,
135
- 'template:add_record' => OptionParser.new do |opts|
136
- opts.on("--prio [ARG]") do |prio|
137
- options[:prio] = prio
138
- end
139
- end,
140
- }
141
-
142
- global.order!
143
- command = ARGV.shift
144
- if command.nil? || command == 'help'
145
- usage
146
- else
147
- options_parser = subcommands[command]
148
- options_parser.order! if options_parser
149
- begin
150
- cli.execute(command, ARGV, options)
151
- rescue DNSimple::CommandNotFound => e
152
- puts e.message
153
- end
154
- end
155
-
156
- end
@@ -1,9 +0,0 @@
1
- Before running the DNSimple Ruby Client cucumber feature files, you must do the following:
2
-
3
- 1. If you haven't already go to https://sandbox.dnsimple.com and create an account. Activate your account to the Platinum level using the credit card number of "1".
4
-
5
- 2. Create a file in your home directory called .dnsimple.test and include the following:
6
-
7
- username: YOUR_USERNAME
8
- password: YOUR_PASSWORD
9
- base_uri: https://api.sandbox.dnsimple.com/
@@ -1,10 +0,0 @@
1
- Feature: purchase a certificate with the CLI
2
- As a user
3
- In order to purchase a certificate
4
- I should be able to use the CLI for purchasing a certificate
5
-
6
- @announce-cmd @announce-stdout
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple certificate:purchase` with a domain I created
10
- Then the output should show that a certificate was purchased
@@ -1,10 +0,0 @@
1
- Feature: create a contact with the CLI
2
- As a user
3
- In order to add a contact to my list of contacts
4
- I should be able to use the CLI to create a contact
5
-
6
- @announce-cmd
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple contact:create first:John last:Smith address1:"Example Road" city:Anytown state:Florida postal_code:12345 country:US email:john.smith@example.com phone:12225051122 label:test-contact`
10
- Then the output should contain "Created contact John Smith"
@@ -1,10 +0,0 @@
1
- Feature: check a domain with the CLI
2
- As a user
3
- In order to check if a domain is available for registration
4
- I should be able to use the CLI to check domains
5
-
6
- @announce-cmd
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple check domain.com`
10
- Then the output should contain "Check domain result for domain.com: registered"
@@ -1,10 +0,0 @@
1
- Feature: add a domain with the CLI
2
- As a user
3
- In order to add a domain to my account
4
- I should be able to use the CLI to add domains
5
-
6
- @announce-cmd
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple create` with a new domain
10
- Then the output should show that the domain was created
@@ -1,11 +0,0 @@
1
- Feature: delete a domain with the CLI
2
- As a user
3
- In order to remove a domain from my account
4
- I should be able to use the CLI to delete domains
5
-
6
- @announce-cmd @skip-delete
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple delete` with a domain I created
10
- Then the output should show that the domain was deleted
11
-
@@ -1,10 +0,0 @@
1
- Feature: register a domain with the CLI
2
- As a user
3
- In order to register a domain
4
- I should be able to use the CLI for domain registration
5
-
6
- @announce-cmd @announce-stdout
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple register` with a new domain
10
- Then the output should show that the domain was registered
@@ -1,11 +0,0 @@
1
- Feature: add a PTR record with the CLI
2
- As a user
3
- In order to add a PTR record to a domain in my account
4
- I should be able to use the CLI to add the PTR record
5
-
6
- @announce-cmd @announce-stdout
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple create` with a in-addr.arpa domain
10
- And I run `dnsimple record:create` with the domain I added and the name "1" and the type "PTR" and the content "domain.com"
11
- Then the output should show that the "PTR" record was created
@@ -1,12 +0,0 @@
1
- Feature: add a record with the CLI
2
- As a user
3
- In order to add records to a domain in my account
4
- I should be able to use the CLI to add records
5
-
6
- @announce-cmd @announce-stdout
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple create` with a new domain
10
- And I run `dnsimple record:create` with the domain I added and no name and the type "A" and the content "1.2.3.4"
11
- Then the output should show that the "A" record was created
12
- And the output should include the record id
@@ -1,14 +0,0 @@
1
- Feature: delete a record with the CLI
2
- As a user
3
- In order to remove a record from a domain in my account
4
- I should be able to use the CLI to delete a record
5
-
6
- @announce-cmd @announce-stdout
7
- Scenario:
8
- Given I have set up my credentials
9
- When I run `dnsimple create` with a new domain
10
- And I run `dnsimple record:create` with the domain I added and no name and the type "A" and the content "1.2.3.4"
11
- And I note the id of the record I added
12
- And I run `dnsimple record:delete` with the id of the record
13
- Then the output should show that the record was deleted
14
-
@@ -1,11 +0,0 @@
1
- Feature: apply a template to a domain
2
- As a user
3
- In order to apply a set of records to a domain at once
4
- I should be able to use the CLI to apply a template
5
-
6
- Scenario:
7
- Given I have set up my credentials
8
- When I run `dnsimple create` with a new domain
9
- And I run `dnsimple apply` with the domain and the template named "googleapps"
10
- Then the output should show that the template was applied
11
- And I the domain should have 13 records