sparqcode-dnsimple-ruby 1.2.6
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 -0
- data/.rvmrc +1 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +71 -0
- data/LICENSE +22 -0
- data/README +125 -0
- data/README.rdoc +125 -0
- data/README.textile +161 -0
- data/Rakefile +33 -0
- data/VERSION +1 -0
- data/bin/dnsimple +4 -0
- data/bin/dnsimple.rb +153 -0
- data/dnsimple-ruby.gemspec +191 -0
- data/features/README +12 -0
- data/features/cli/certificates/purchase_certificate.feature +10 -0
- data/features/cli/contacts/create_contact.feature +10 -0
- data/features/cli/domains/check_domain.feature +10 -0
- data/features/cli/domains/create_domain.feature +10 -0
- data/features/cli/domains/delete_domain.feature +11 -0
- data/features/cli/domains/register_domain.feature +10 -0
- data/features/cli/records/create_ptr_record.feature +11 -0
- data/features/cli/records/create_record.feature +12 -0
- data/features/cli/records/delete_record.feature +14 -0
- data/features/cli/templates/apply_template.feature +11 -0
- data/features/step_definitions/certificate_steps.rb +3 -0
- data/features/step_definitions/cli_steps.rb +8 -0
- data/features/step_definitions/domain_steps.rb +32 -0
- data/features/step_definitions/record_steps.rb +38 -0
- data/features/step_definitions/template_steps.rb +9 -0
- data/features/support/env.rb +17 -0
- 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 +42 -0
- data/fixtures/vcr_cassettes/DNSimple_Contact/an_existing_contact.yml +42 -0
- data/fixtures/vcr_cassettes/DNSimple_Domain/_all.yml +130 -0
- data/fixtures/vcr_cassettes/DNSimple_Domain/applying_templates.yml +216 -0
- data/fixtures/vcr_cassettes/DNSimple_Domain/creating_a_new_domain.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_id.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_name.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_a_new_registrant_contact.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_an_existing_contact.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Domain/setting_name_servers.yml +30 -0
- data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_ca.yml +40 -0
- data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_com.yml +40 -0
- data/fixtures/vcr_cassettes/DNSimple_Record/_all.yml +173 -0
- data/fixtures/vcr_cassettes/DNSimple_Record/creating_a_new_record.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Record/find_a_record.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_Template/a_template.yml +44 -0
- data/fixtures/vcr_cassettes/DNSimple_User/_me.yml +42 -0
- data/lib/dnsimple.rb +19 -0
- data/lib/dnsimple/certificate.rb +158 -0
- data/lib/dnsimple/cli.rb +122 -0
- data/lib/dnsimple/client.rb +74 -0
- data/lib/dnsimple/command.rb +10 -0
- data/lib/dnsimple/commands/add_service.rb +16 -0
- data/lib/dnsimple/commands/add_template_record.rb +18 -0
- data/lib/dnsimple/commands/apply_template.rb +15 -0
- data/lib/dnsimple/commands/check_domain.rb +11 -0
- data/lib/dnsimple/commands/clear_domain.rb +16 -0
- data/lib/dnsimple/commands/create_contact.rb +21 -0
- data/lib/dnsimple/commands/create_domain.rb +16 -0
- data/lib/dnsimple/commands/create_record.rb +20 -0
- data/lib/dnsimple/commands/create_template.rb +14 -0
- data/lib/dnsimple/commands/delete_contact.rb +14 -0
- data/lib/dnsimple/commands/delete_domain.rb +14 -0
- data/lib/dnsimple/commands/delete_record.rb +16 -0
- data/lib/dnsimple/commands/delete_template.rb +13 -0
- data/lib/dnsimple/commands/delete_template_record.rb +16 -0
- data/lib/dnsimple/commands/describe_certificate.rb +34 -0
- data/lib/dnsimple/commands/describe_contact.rb +25 -0
- data/lib/dnsimple/commands/describe_domain.rb +14 -0
- data/lib/dnsimple/commands/describe_record.rb +16 -0
- data/lib/dnsimple/commands/describe_service.rb +12 -0
- data/lib/dnsimple/commands/describe_user.rb +18 -0
- data/lib/dnsimple/commands/list_applied_services.rb +16 -0
- data/lib/dnsimple/commands/list_available_services.rb +16 -0
- data/lib/dnsimple/commands/list_certificates.rb +15 -0
- data/lib/dnsimple/commands/list_contacts.rb +13 -0
- data/lib/dnsimple/commands/list_domains.rb +13 -0
- data/lib/dnsimple/commands/list_extended_attributes.rb +25 -0
- data/lib/dnsimple/commands/list_records.rb +21 -0
- data/lib/dnsimple/commands/list_services.rb +14 -0
- data/lib/dnsimple/commands/list_template_records.rb +17 -0
- data/lib/dnsimple/commands/list_templates.rb +13 -0
- data/lib/dnsimple/commands/purchase_certificate.rb +19 -0
- data/lib/dnsimple/commands/register_domain.rb +33 -0
- data/lib/dnsimple/commands/remove_service.rb +14 -0
- data/lib/dnsimple/commands/submit_certificate.rb +19 -0
- data/lib/dnsimple/commands/transfer_domain.rb +21 -0
- data/lib/dnsimple/commands/update_contact.rb +25 -0
- data/lib/dnsimple/commands/update_record.rb +23 -0
- data/lib/dnsimple/contact.rb +181 -0
- data/lib/dnsimple/domain.rb +246 -0
- data/lib/dnsimple/error.rb +32 -0
- data/lib/dnsimple/extended_attribute.rb +73 -0
- data/lib/dnsimple/record.rb +128 -0
- data/lib/dnsimple/service.rb +58 -0
- data/lib/dnsimple/template.rb +91 -0
- data/lib/dnsimple/template_record.rb +103 -0
- data/lib/dnsimple/transfer_order.rb +45 -0
- data/lib/dnsimple/user.rb +44 -0
- data/spec/README +10 -0
- data/spec/certificate_spec.rb +46 -0
- data/spec/command_spec.rb +19 -0
- data/spec/commands/add_service_spec.rb +29 -0
- data/spec/commands/create_record_spec.rb +23 -0
- data/spec/commands/list_records_spec.rb +34 -0
- data/spec/commands/purchase_certificate_spec.rb +24 -0
- data/spec/commands/submit_certificate_spec.rb +19 -0
- data/spec/contact_spec.rb +35 -0
- data/spec/domain_spec.rb +97 -0
- data/spec/extended_attributes_spec.rb +19 -0
- data/spec/record_spec.rb +59 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/template_spec.rb +11 -0
- data/spec/user_spec.rb +23 -0
- metadata +353 -0
data/.bundle/config
ADDED
data/.rvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rvm use ruby-1.8.7@dnsimple-ruby --create
|
data/Gemfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gem 'httparty'
|
|
4
|
+
|
|
5
|
+
group :development do
|
|
6
|
+
gem 'rake'
|
|
7
|
+
gem 'jeweler'
|
|
8
|
+
gem 'rspec', '>= 2.0.0'
|
|
9
|
+
gem 'mocha'
|
|
10
|
+
gem 'ruby-debug', :platforms => 'ruby_18'
|
|
11
|
+
gem 'cucumber'
|
|
12
|
+
gem 'aruba'
|
|
13
|
+
gem 'ruby-debug'
|
|
14
|
+
gem 'fakeweb'
|
|
15
|
+
gem 'vcr'
|
|
16
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: http://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
aruba (0.4.7)
|
|
5
|
+
childprocess (>= 0.2.2)
|
|
6
|
+
cucumber (>= 1.1.1)
|
|
7
|
+
ffi (= 1.0.9)
|
|
8
|
+
rspec (>= 2.7.0)
|
|
9
|
+
builder (3.0.0)
|
|
10
|
+
childprocess (0.2.2)
|
|
11
|
+
ffi (~> 1.0.6)
|
|
12
|
+
columnize (0.3.4)
|
|
13
|
+
cucumber (1.1.2)
|
|
14
|
+
builder (>= 2.1.2)
|
|
15
|
+
diff-lcs (>= 1.1.2)
|
|
16
|
+
gherkin (~> 2.6.2)
|
|
17
|
+
json (>= 1.4.6)
|
|
18
|
+
term-ansicolor (>= 1.0.6)
|
|
19
|
+
diff-lcs (1.1.3)
|
|
20
|
+
fakeweb (1.3.0)
|
|
21
|
+
ffi (1.0.9)
|
|
22
|
+
gherkin (2.6.3)
|
|
23
|
+
json (>= 1.4.6)
|
|
24
|
+
git (1.2.5)
|
|
25
|
+
httparty (0.8.1)
|
|
26
|
+
multi_json
|
|
27
|
+
multi_xml
|
|
28
|
+
jeweler (1.6.4)
|
|
29
|
+
bundler (~> 1.0)
|
|
30
|
+
git (>= 1.2.5)
|
|
31
|
+
rake
|
|
32
|
+
json (1.6.1)
|
|
33
|
+
linecache (0.46)
|
|
34
|
+
rbx-require-relative (> 0.0.4)
|
|
35
|
+
metaclass (0.0.1)
|
|
36
|
+
mocha (0.10.0)
|
|
37
|
+
metaclass (~> 0.0.1)
|
|
38
|
+
multi_json (1.0.3)
|
|
39
|
+
multi_xml (0.4.1)
|
|
40
|
+
rake (0.9.2.2)
|
|
41
|
+
rbx-require-relative (0.0.5)
|
|
42
|
+
rspec (2.7.0)
|
|
43
|
+
rspec-core (~> 2.7.0)
|
|
44
|
+
rspec-expectations (~> 2.7.0)
|
|
45
|
+
rspec-mocks (~> 2.7.0)
|
|
46
|
+
rspec-core (2.7.1)
|
|
47
|
+
rspec-expectations (2.7.0)
|
|
48
|
+
diff-lcs (~> 1.1.2)
|
|
49
|
+
rspec-mocks (2.7.0)
|
|
50
|
+
ruby-debug (0.10.4)
|
|
51
|
+
columnize (>= 0.1)
|
|
52
|
+
ruby-debug-base (~> 0.10.4.0)
|
|
53
|
+
ruby-debug-base (0.10.4)
|
|
54
|
+
linecache (>= 0.3)
|
|
55
|
+
term-ansicolor (1.0.7)
|
|
56
|
+
vcr (1.11.3)
|
|
57
|
+
|
|
58
|
+
PLATFORMS
|
|
59
|
+
ruby
|
|
60
|
+
|
|
61
|
+
DEPENDENCIES
|
|
62
|
+
aruba
|
|
63
|
+
cucumber
|
|
64
|
+
fakeweb
|
|
65
|
+
httparty
|
|
66
|
+
jeweler
|
|
67
|
+
mocha
|
|
68
|
+
rake
|
|
69
|
+
rspec (>= 2.0.0)
|
|
70
|
+
ruby-debug
|
|
71
|
+
vcr
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010-2011 Aetrion LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
22
|
+
|
data/README
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
A Ruby command line utility and wrapper for the DNSimple API.
|
|
2
|
+
|
|
3
|
+
DNSimple is a hosted DNS service that can be found at http://dnsimple.com/
|
|
4
|
+
|
|
5
|
+
== Credentials
|
|
6
|
+
|
|
7
|
+
Create a file in your home directory called .dnsimple
|
|
8
|
+
|
|
9
|
+
In this file add the following:
|
|
10
|
+
|
|
11
|
+
username: YOUR_USERNAME
|
|
12
|
+
password: YOUR_PASSWORD
|
|
13
|
+
|
|
14
|
+
== Commands
|
|
15
|
+
|
|
16
|
+
There are two ways to interact with the DNSimple Ruby wrapper. The first is
|
|
17
|
+
to use the command line utility that is included. The commands available
|
|
18
|
+
are as follows:
|
|
19
|
+
|
|
20
|
+
For help:
|
|
21
|
+
|
|
22
|
+
* dnsimple help
|
|
23
|
+
|
|
24
|
+
The following commands are available for domains:
|
|
25
|
+
|
|
26
|
+
* dnsimple list
|
|
27
|
+
* dnsimple describe domain.com
|
|
28
|
+
* dnsimple create domain.com
|
|
29
|
+
* dnsimple register domain.com registrant_id
|
|
30
|
+
* dnsimple transfer domain.com registrant_id [authinfo]
|
|
31
|
+
* dnsimple delete domain.com
|
|
32
|
+
* dnsimple apply domain.com template_short_name
|
|
33
|
+
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
The following commands are available for records:
|
|
37
|
+
|
|
38
|
+
* dnsimple record:create [--prio=priority] domain.com name type content [ttl]
|
|
39
|
+
* dnsimple record:list domain.com
|
|
40
|
+
* dnsimple record:delete domain.com record_id
|
|
41
|
+
|
|
42
|
+
The following commands are available for custom templates:
|
|
43
|
+
|
|
44
|
+
* dnsimple template:list
|
|
45
|
+
* dnsimple template:create name short_name [description]
|
|
46
|
+
* dnsimple template:delete short_name
|
|
47
|
+
* dnsimple template:list_records short_name
|
|
48
|
+
* dnsimple template:add_record short_name name type content [ttl] [prio]
|
|
49
|
+
* dnsimple template:delete_record short_name template_record_id
|
|
50
|
+
|
|
51
|
+
The following commands are available for managing contacts:
|
|
52
|
+
|
|
53
|
+
* dnsimple contact:list
|
|
54
|
+
* dnsimple contact:describe id
|
|
55
|
+
* dnsimple contact:create [name:value name:value ...]
|
|
56
|
+
* dnsimple contact:update id [name:value name:value ...]
|
|
57
|
+
* dnsimple contact:delete id
|
|
58
|
+
|
|
59
|
+
The following commands are available for purchasing certificates:
|
|
60
|
+
|
|
61
|
+
* dnsimple certificate:purchase domain.com name contact_id
|
|
62
|
+
* dnsimple certificate:submit id
|
|
63
|
+
|
|
64
|
+
The contact name/value pairs are:
|
|
65
|
+
|
|
66
|
+
* first_name
|
|
67
|
+
* last_name
|
|
68
|
+
* organization_name (optional)
|
|
69
|
+
* job_title (required if organization name is specified)
|
|
70
|
+
* address1
|
|
71
|
+
* address2 (optional)
|
|
72
|
+
* city
|
|
73
|
+
* state_province (also aliased as state)
|
|
74
|
+
* postal_code
|
|
75
|
+
* country
|
|
76
|
+
* email
|
|
77
|
+
* phone
|
|
78
|
+
* phone_ext (optional)
|
|
79
|
+
* fax (optional)
|
|
80
|
+
|
|
81
|
+
== Wrapper Classes
|
|
82
|
+
|
|
83
|
+
In addition to the command line utility you may also use the included Ruby
|
|
84
|
+
classes directly in your Ruby applications.
|
|
85
|
+
|
|
86
|
+
Sample:
|
|
87
|
+
|
|
88
|
+
require 'rubygems'
|
|
89
|
+
require 'dnsimple'
|
|
90
|
+
|
|
91
|
+
DNSimple::Client.username = 'YOUR_USERNAME'
|
|
92
|
+
DNSimple::Client.password = 'YOUR_PASSWORD'
|
|
93
|
+
|
|
94
|
+
puts "Domains..."
|
|
95
|
+
Domain.all.each do |domain|
|
|
96
|
+
puts " #{domain.name}"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
domain = Domain.find("example.com")
|
|
100
|
+
domain.apply("template") # applies a standard or custom template to the domain
|
|
101
|
+
|
|
102
|
+
domain = Domain.create("newdomain.com")
|
|
103
|
+
puts "Added #{domain.name}"
|
|
104
|
+
domain.delete # removes from DNSimple
|
|
105
|
+
|
|
106
|
+
The complete RDoc for the wrapper classes can be found here:
|
|
107
|
+
|
|
108
|
+
http://rdoc.info/projects/aetrion/dnsimple-ruby
|
|
109
|
+
|
|
110
|
+
== Running Rspec Tests
|
|
111
|
+
|
|
112
|
+
There are two ways you can run the tests, either using VCR mocked responses or by hitting the test site. Either way you need to create a configuration file in your home directory called .dnsimple.local. To run the tests with the DNSimple test site this file should include:
|
|
113
|
+
|
|
114
|
+
username: foo@bar.com
|
|
115
|
+
password: test
|
|
116
|
+
|
|
117
|
+
And in spec/spec_helper.rb uncomment this line:
|
|
118
|
+
|
|
119
|
+
# c.allow_http_connections_when_no_cassette = true
|
|
120
|
+
|
|
121
|
+
The username and password must match the credentials you used to create your account on http://test.dnsimple.com. To run the tests with VCR mocks you need to include an additional line in the .dnsimple.local file:
|
|
122
|
+
|
|
123
|
+
site: "http://localhost:3000"
|
|
124
|
+
|
|
125
|
+
All of the VCR mocks trigger on http://localhost:3000. If you are using VCR mocks you should leave c.allow_http_connections_when_no_cassette = true commented out.
|
data/README.rdoc
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
A Ruby wrapper for the DNSimple API.
|
|
2
|
+
|
|
3
|
+
== Credentials
|
|
4
|
+
|
|
5
|
+
Create a file in your home directory called .dnsimple
|
|
6
|
+
|
|
7
|
+
In this file add the following:
|
|
8
|
+
|
|
9
|
+
username: YOUR_USERNAME
|
|
10
|
+
password: YOUR_PASSWORD
|
|
11
|
+
|
|
12
|
+
Alternatively you can pass the credentials via command-line arguments, as in:
|
|
13
|
+
|
|
14
|
+
dnsimple -u username -p password command
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
== Commands
|
|
18
|
+
|
|
19
|
+
The following commands are available for domains:
|
|
20
|
+
|
|
21
|
+
* dnsimple list
|
|
22
|
+
* dnsimple describe domain.com
|
|
23
|
+
* dnsimple create domain.com
|
|
24
|
+
* dnsimple register domain.com registrant_id
|
|
25
|
+
* dnsimple transfer domain.com registrant_id [authinfo]
|
|
26
|
+
* dnsimple delete domain.com
|
|
27
|
+
* dnsimple apply domain.com template_short_name
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
The following commands are available for records:
|
|
32
|
+
|
|
33
|
+
* dnsimple record:create [--prio=priority] domain.com name type content [ttl]
|
|
34
|
+
* dnsimple record:list domain.com
|
|
35
|
+
* dnsimple record:delete domain.com record_id
|
|
36
|
+
|
|
37
|
+
The following commands are available for custom templates:
|
|
38
|
+
|
|
39
|
+
* dnsimple template:list
|
|
40
|
+
* dnsimple template:create name short_name [description]
|
|
41
|
+
* dnsimple template:delete short_name
|
|
42
|
+
* dnsimple template:list_records short_name
|
|
43
|
+
* dnsimple template:add_record short_name name type content [ttl] [prio]
|
|
44
|
+
* dnsimple template:delete_record short_name template_record_id
|
|
45
|
+
|
|
46
|
+
The following commands are available for managing contacts:
|
|
47
|
+
|
|
48
|
+
* dnsimple contact:list
|
|
49
|
+
* dnsimple contact:describe id
|
|
50
|
+
* dnsimple contact:create [name:value name:value ...]
|
|
51
|
+
* dnsimple contact:update id [name:value name:value ...]
|
|
52
|
+
* dnsimple contact:delete id
|
|
53
|
+
|
|
54
|
+
The following commands are available for purchasing certificates:
|
|
55
|
+
|
|
56
|
+
* dnsimple certificate:purchase domain.com name
|
|
57
|
+
* dnsimple certificate:submit id
|
|
58
|
+
|
|
59
|
+
=== Contact Attributes
|
|
60
|
+
|
|
61
|
+
The contact attributes that can be used in the name:value pairs are:
|
|
62
|
+
|
|
63
|
+
* first_name
|
|
64
|
+
* last_name
|
|
65
|
+
* organization_name (optional)
|
|
66
|
+
* job_title (required if organization name is specified)
|
|
67
|
+
* address1
|
|
68
|
+
* address2 (optional)
|
|
69
|
+
* city
|
|
70
|
+
* state_province (also aliased as state)
|
|
71
|
+
* postal_code
|
|
72
|
+
* country
|
|
73
|
+
* email
|
|
74
|
+
* phone
|
|
75
|
+
* phone_ext (optional)
|
|
76
|
+
* fax (optional)
|
|
77
|
+
|
|
78
|
+
== Wrapper Classes
|
|
79
|
+
|
|
80
|
+
In addition to the command line utility you may also use the included Ruby
|
|
81
|
+
classes directly in your Ruby applications.
|
|
82
|
+
|
|
83
|
+
Sample:
|
|
84
|
+
|
|
85
|
+
require 'rubygems'
|
|
86
|
+
require 'dnsimple'
|
|
87
|
+
|
|
88
|
+
DNSimple::Client.username = 'YOUR_USERNAME'
|
|
89
|
+
DNSimple::Client.password = 'YOUR_PASSWORD'
|
|
90
|
+
|
|
91
|
+
user = User.me
|
|
92
|
+
puts "#{user.domain_count} domains"
|
|
93
|
+
|
|
94
|
+
puts "Domains..."
|
|
95
|
+
Domain.all.each do |domain|
|
|
96
|
+
puts " #{domain.name}"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
domain = Domain.find("example.com")
|
|
100
|
+
domain.apply("template") # applies a standard or custom template to the domain
|
|
101
|
+
|
|
102
|
+
domain = Domain.create("newdomain.com")
|
|
103
|
+
puts "Added #{domain.name}"
|
|
104
|
+
domain.delete # removes from DNSimple
|
|
105
|
+
|
|
106
|
+
The complete RDoc for the wrapper classes can be found here:
|
|
107
|
+
|
|
108
|
+
http://rdoc.info/projects/aetrion/dnsimple-ruby
|
|
109
|
+
|
|
110
|
+
== Running Rspec Tests
|
|
111
|
+
|
|
112
|
+
There are two ways you can run the tests, either using VCR mocked responses or by hitting the test site. Either way you need to create a configuration file in your home directory called .dnsimple.local. To run the tests with the DNSimple test site this file should include:
|
|
113
|
+
|
|
114
|
+
username: foo@bar.com
|
|
115
|
+
password: test
|
|
116
|
+
|
|
117
|
+
And in spec/spec_helper.rb uncomment this line:
|
|
118
|
+
|
|
119
|
+
# c.allow_http_connections_when_no_cassette = true
|
|
120
|
+
|
|
121
|
+
The username and password must match the credentials you used to create your account on http://test.dnsimple.com. To run the tests with VCR mocks you need to include an additional line in the .dnsimple.local file:
|
|
122
|
+
|
|
123
|
+
site: "http://localhost:3000"
|
|
124
|
+
|
|
125
|
+
All of the VCR mocks trigger on http://localhost:3000. If you are using VCR mocks you should leave c.allow_http_connections_when_no_cassette = true commented out.
|
data/README.textile
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
A Ruby command line utility and wrapper for the DNSimple API.
|
|
2
|
+
|
|
3
|
+
DNSimple is a hosted DNS service that can be found at "http://dnsimple.com/":http://dnsimple.com/
|
|
4
|
+
|
|
5
|
+
h2. Installation
|
|
6
|
+
|
|
7
|
+
<pre><code>[sudo] gem install dnsimple-ruby</code></pre>
|
|
8
|
+
|
|
9
|
+
h2. Credentials
|
|
10
|
+
|
|
11
|
+
Create a file in your home directory called .dnsimple
|
|
12
|
+
|
|
13
|
+
In this file add the following:
|
|
14
|
+
|
|
15
|
+
<pre><code>username: YOUR_USERNAME
|
|
16
|
+
password: YOUR_PASSWORD
|
|
17
|
+
</code></pre>
|
|
18
|
+
|
|
19
|
+
Alternatively you can pass the credentials via command-line arguments, as in:
|
|
20
|
+
|
|
21
|
+
<pre><code>dnsimple -u username -p password list</code></pre>
|
|
22
|
+
|
|
23
|
+
h2. Commands
|
|
24
|
+
|
|
25
|
+
There are two ways to interact with the DNSimple Ruby wrapper. The first is
|
|
26
|
+
to use the command line utility that is included.
|
|
27
|
+
|
|
28
|
+
The commands available are as follows:
|
|
29
|
+
|
|
30
|
+
For help:
|
|
31
|
+
|
|
32
|
+
* dnsimple help
|
|
33
|
+
|
|
34
|
+
The following commands are available for domains:
|
|
35
|
+
|
|
36
|
+
* dnsimple list
|
|
37
|
+
* dnsimple describe domain.com
|
|
38
|
+
* dnsimple create domain.com
|
|
39
|
+
* dnsimple register domain.com registrant_id
|
|
40
|
+
* dnsimple transfer domain.com registrant_id [authinfo]
|
|
41
|
+
* dnsimple delete domain.com
|
|
42
|
+
* dnsimple apply domain.com template_short_name
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
The following commands are available for records:
|
|
47
|
+
|
|
48
|
+
* dnsimple record:create [--prio=priority] domain.com name type content [ttl]
|
|
49
|
+
* dnsimple record:list domain.com
|
|
50
|
+
* dnsimple record:delete domain.com record_id
|
|
51
|
+
|
|
52
|
+
The following commands are available for custom templates:
|
|
53
|
+
|
|
54
|
+
* dnsimple template:list
|
|
55
|
+
* dnsimple template:create name short_name [description]
|
|
56
|
+
* dnsimple template:delete short_name
|
|
57
|
+
* dnsimple template:list_records short_name
|
|
58
|
+
* dnsimple template:add_record short_name name type content [ttl] [prio]
|
|
59
|
+
* dnsimple template:delete_record short_name template_record_id
|
|
60
|
+
|
|
61
|
+
The following commands are available for managing contacts:
|
|
62
|
+
|
|
63
|
+
* dnsimple contact:list
|
|
64
|
+
* dnsimple contact:describe id
|
|
65
|
+
* dnsimple contact:create [name:value name:value ...]
|
|
66
|
+
* dnsimple contact:update id [name:value name:value ...]
|
|
67
|
+
* dnsimple contact:delete id
|
|
68
|
+
|
|
69
|
+
To list all extended attributes for a given TLD:
|
|
70
|
+
|
|
71
|
+
* dnsimple extended-attributes:list tld
|
|
72
|
+
|
|
73
|
+
The following commands are available for listing services and adding and removing them from domains
|
|
74
|
+
|
|
75
|
+
* service:list
|
|
76
|
+
* service:describe short_name
|
|
77
|
+
* service:applied domain.com
|
|
78
|
+
* service:available domain.com
|
|
79
|
+
* service:add domain.com short_name
|
|
80
|
+
* service:remove domain.com short_name
|
|
81
|
+
|
|
82
|
+
The following commands are available for purchasing certificates:
|
|
83
|
+
|
|
84
|
+
* dnsimple certificate:purchase domain.com name
|
|
85
|
+
* dnsimple certificate:submit domain.com id approver_email
|
|
86
|
+
|
|
87
|
+
h3. Contact Attributes
|
|
88
|
+
|
|
89
|
+
The contact attributes that can be used in the name:value pairs are:
|
|
90
|
+
|
|
91
|
+
* first_name
|
|
92
|
+
* last_name
|
|
93
|
+
* organization_name (optional)
|
|
94
|
+
* job_title (required if organization name is specified)
|
|
95
|
+
* address1
|
|
96
|
+
* address2 (optional)
|
|
97
|
+
* city
|
|
98
|
+
* state_province (also aliased as state)
|
|
99
|
+
* postal_code
|
|
100
|
+
* country
|
|
101
|
+
* email
|
|
102
|
+
* phone
|
|
103
|
+
* phone_ext (optional)
|
|
104
|
+
* fax (optional)
|
|
105
|
+
|
|
106
|
+
h2. Wrapper Classes
|
|
107
|
+
|
|
108
|
+
In addition to the command line utility you may also use the included Ruby
|
|
109
|
+
classes directly in your Ruby applications.
|
|
110
|
+
|
|
111
|
+
Sample:
|
|
112
|
+
|
|
113
|
+
<pre><code>
|
|
114
|
+
require 'rubygems'
|
|
115
|
+
require 'dnsimple'
|
|
116
|
+
|
|
117
|
+
DNSimple::Client.username = 'YOUR_USERNAME'
|
|
118
|
+
DNSimple::Client.password = 'YOUR_PASSWORD'
|
|
119
|
+
|
|
120
|
+
user = User.me
|
|
121
|
+
puts "#{user.domain_count} domains"
|
|
122
|
+
|
|
123
|
+
puts "Domains..."
|
|
124
|
+
Domain.all.each do |domain|
|
|
125
|
+
puts " #{domain.name}"
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
domain = Domain.find("example.com")
|
|
129
|
+
domain.apply("template") # applies a standard or custom template to the domain
|
|
130
|
+
|
|
131
|
+
domain = Domain.create("newdomain.com")
|
|
132
|
+
puts "Added #{domain.name}"
|
|
133
|
+
domain.delete # removes from DNSimple
|
|
134
|
+
</pre></code>
|
|
135
|
+
|
|
136
|
+
The complete RDoc for the wrapper classes can be found here:
|
|
137
|
+
|
|
138
|
+
"http://rdoc.info/projects/aetrion/dnsimple-ruby":http://rdoc.info/projects/aetrion/dnsimple-ruby
|
|
139
|
+
|
|
140
|
+
h2. Running Rspec Tests
|
|
141
|
+
|
|
142
|
+
There are two ways you can run the tests, either using VCR mocked responses or by hitting the test site. Either way you need to create a configuration file in your home directory called .dnsimple.local. To run the tests with the DNSimple test site this file should include:
|
|
143
|
+
|
|
144
|
+
<pre><code>
|
|
145
|
+
username: foo@bar.com
|
|
146
|
+
password: test
|
|
147
|
+
</code></pre>
|
|
148
|
+
|
|
149
|
+
And in spec/spec_helper.rb uncomment this line:
|
|
150
|
+
|
|
151
|
+
<pre><code>
|
|
152
|
+
# c.allow_http_connections_when_no_cassette = true
|
|
153
|
+
</code></pre>
|
|
154
|
+
|
|
155
|
+
The username and password must match the credentials you used to create your account on http://test.dnsimple.com. To run the tests with VCR mocks you need to include an additional line in the .dnsimple.local file:
|
|
156
|
+
|
|
157
|
+
<pre><code>
|
|
158
|
+
site: "http://localhost:3000"
|
|
159
|
+
</code></pre>
|
|
160
|
+
|
|
161
|
+
All of the VCR mocks trigger on http://localhost:3000. If you are using VCR mocks you should leave c.allow_http_connections_when_no_cassette = true commented out.
|