forked from dnsimple/dnsimple-ruby
/
README
125 lines (85 loc) · 3.8 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
A Ruby command line utility and wrapper for the DNSimple API.
DNSimple is a hosted DNS service that can be found at http://dnsimple.com/
== Credentials
Create a file in your home directory called .dnsimple
In this file add the following:
username: YOUR_USERNAME
password: YOUR_PASSWORD
== Commands
There are two ways to interact with the DNSimple Ruby wrapper. The first is
to use the command line utility that is included. The commands available
are as follows:
For help:
* dnsimple help
The following commands are available for domains:
* dnsimple list
* dnsimple describe domain.com
* dnsimple create domain.com
* dnsimple register domain.com registrant_id
* dnsimple transfer domain.com registrant_id [authinfo]
* dnsimple delete domain.com
* dnsimple apply domain.com template_short_name
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.
The following commands are available for records:
* dnsimple record:create [--prio=priority] domain.com name type content [ttl]
* dnsimple record:list domain.com
* dnsimple record:delete domain.com record_id
The following commands are available for custom templates:
* dnsimple template:list
* dnsimple template:create name short_name [description]
* dnsimple template:delete short_name
* dnsimple template:list_records short_name
* dnsimple template:add_record short_name name type content [ttl] [prio]
* dnsimple template:delete_record short_name template_record_id
The following commands are available for managing contacts:
* dnsimple contact:list
* dnsimple contact:describe id
* dnsimple contact:create [name:value name:value ...]
* dnsimple contact:update id [name:value name:value ...]
* dnsimple contact:delete id
The following commands are available for purchasing certificates:
* dnsimple certificate:purchase domain.com name contact_id
* dnsimple certificate:submit id
The contact name/value pairs are:
* first_name
* last_name
* organization_name (optional)
* job_title (required if organization name is specified)
* address1
* address2 (optional)
* city
* state_province (also aliased as state)
* postal_code
* country
* email
* phone
* phone_ext (optional)
* fax (optional)
== Wrapper Classes
In addition to the command line utility you may also use the included Ruby
classes directly in your Ruby applications.
Sample:
require 'rubygems'
require 'dnsimple'
DNSimple::Client.username = 'YOUR_USERNAME'
DNSimple::Client.password = 'YOUR_PASSWORD'
puts "Domains..."
Domain.all.each do |domain|
puts " #{domain.name}"
end
domain = Domain.find("example.com")
domain.apply("template") # applies a standard or custom template to the domain
domain = Domain.create("newdomain.com")
puts "Added #{domain.name}"
domain.delete # removes from DNSimple
The complete RDoc for the wrapper classes can be found here:
http://rdoc.info/projects/aetrion/dnsimple-ruby
== Running Rspec Tests
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:
username: foo@bar.com
password: test
And in spec/spec_helper.rb uncomment this line:
# c.allow_http_connections_when_no_cassette = true
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:
site: "http://localhost:3000"
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.