dnsimple 2.0.0.alpha2 → 2.0.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +6 -2
  3. data/README.markdown +32 -30
  4. data/dnsimple.gemspec +1 -2
  5. data/lib/dnsimple.rb +2 -13
  6. data/lib/dnsimple/client.rb +164 -53
  7. data/lib/dnsimple/client/certificates_service.rb +98 -0
  8. data/lib/dnsimple/client/client_service.rb +8 -0
  9. data/lib/dnsimple/client/contacts_service.rb +82 -0
  10. data/lib/dnsimple/client/domains_service.rb +333 -0
  11. data/lib/dnsimple/client/name_servers_service.rb +69 -0
  12. data/lib/dnsimple/client/registrars_service.rb +105 -0
  13. data/lib/dnsimple/client/services_service.rb +95 -0
  14. data/lib/dnsimple/client/templates_service.rb +180 -0
  15. data/lib/dnsimple/client/users_service.rb +37 -0
  16. data/lib/dnsimple/compatibility.rb +46 -0
  17. data/lib/dnsimple/default.rb +86 -0
  18. data/lib/dnsimple/error.rb +7 -11
  19. data/lib/dnsimple/extra.rb +54 -0
  20. data/lib/dnsimple/struct.rb +29 -0
  21. data/lib/dnsimple/struct/certificate.rb +56 -0
  22. data/lib/dnsimple/struct/contact.rb +61 -0
  23. data/lib/dnsimple/struct/domain.rb +40 -0
  24. data/lib/dnsimple/struct/email_forward.rb +14 -0
  25. data/lib/dnsimple/struct/extended_attribute.rb +39 -0
  26. data/lib/dnsimple/struct/membership.rb +22 -0
  27. data/lib/dnsimple/struct/price.rb +16 -0
  28. data/lib/dnsimple/struct/record.rb +22 -0
  29. data/lib/dnsimple/struct/service.rb +19 -0
  30. data/lib/dnsimple/struct/template.rb +19 -0
  31. data/lib/dnsimple/struct/template_record.rb +24 -0
  32. data/lib/dnsimple/struct/transfer_order.rb +10 -0
  33. data/lib/dnsimple/struct/user.rb +17 -0
  34. data/lib/dnsimple/struct/whois_privacy.rb +19 -0
  35. data/lib/dnsimple/version.rb +1 -1
  36. data/spec/dnsimple/client/certificates_service_spec.rb +196 -0
  37. data/spec/dnsimple/client/contacts_service_spec.rb +179 -0
  38. data/spec/dnsimple/client/domains_service_spec.rb +662 -0
  39. data/spec/dnsimple/client/name_servers_service_spec.rb +131 -0
  40. data/spec/dnsimple/client/registrars_service_spec.rb +160 -0
  41. data/spec/dnsimple/client/services_service_spec.rb +162 -0
  42. data/spec/dnsimple/client/templates_service_spec.rb +371 -0
  43. data/spec/dnsimple/client/users_service_spec.rb +70 -0
  44. data/spec/dnsimple/client_spec.rb +108 -99
  45. data/spec/dnsimple/compatibility_spec.rb +57 -0
  46. data/spec/files/2fa/exchange-token.http +8 -11
  47. data/spec/files/badgateway.http +14 -0
  48. data/spec/files/certificates/configure/success.http +19 -0
  49. data/spec/files/certificates/index/success.http +1 -1
  50. data/spec/files/certificates/notfound.http +19 -0
  51. data/spec/files/certificates/purchase/success.http +19 -0
  52. data/spec/files/certificates/show/success.http +1 -1
  53. data/spec/files/certificates/submit/success.http +19 -0
  54. data/spec/files/contacts/create/badrequest-missingcontact.http +19 -0
  55. data/spec/files/contacts/create/badrequest-validationerror.http +19 -0
  56. data/spec/files/contacts/create/created.http +22 -0
  57. data/spec/files/contacts/delete/success-204.http +18 -0
  58. data/spec/files/{extended_attributes/com.http → contacts/delete/success.http} +5 -5
  59. data/spec/files/{domains/auto_renewal_enable → contacts/index}/success.http +6 -6
  60. data/spec/files/contacts/notfound.http +19 -0
  61. data/spec/files/contacts/update/success.http +21 -0
  62. data/spec/files/domains/create/created.http +21 -0
  63. data/spec/files/domains/index/success.http +11 -9
  64. data/spec/files/domains/notfound.http +11 -9
  65. data/spec/files/domains/show/success.http +12 -10
  66. data/spec/files/domains_autorenewal/disable/success.http +21 -0
  67. data/spec/files/domains_autorenewal/enable/success.http +21 -0
  68. data/spec/files/domains_autorenewal/notfound-domain.http +19 -0
  69. data/spec/files/domains_forwards/create/created.http +22 -0
  70. data/spec/files/domains_forwards/delete/success.http +17 -0
  71. data/spec/files/domains_forwards/get/success.http +21 -0
  72. data/spec/files/domains_forwards/list/success.http +21 -0
  73. data/spec/files/domains_forwards/notfound-domain.http +19 -0
  74. data/spec/files/domains_forwards/notfound.http +19 -0
  75. data/spec/files/domains_records/create/created.http +21 -0
  76. data/spec/files/domains_records/delete/success-204.http +18 -0
  77. data/spec/files/{contacts/show/notfound.http → domains_records/delete/success.http} +9 -7
  78. data/spec/files/{records → domains_records}/index/success.http +0 -0
  79. data/spec/files/{records/show → domains_records}/notfound.http +1 -1
  80. data/spec/files/{records → domains_records}/show/success.http +0 -0
  81. data/spec/files/domains_records/update/success.http +21 -0
  82. data/spec/files/domains_sharing/create/success.http +21 -0
  83. data/spec/files/domains_sharing/delete/success.http +17 -0
  84. data/spec/files/domains_sharing/list/success.http +21 -0
  85. data/spec/files/domains_sharing/notfound-domain.http +19 -0
  86. data/spec/files/domains_sharing/notfound.http +19 -0
  87. data/spec/files/domains_whois_privacy/disable/success.http +21 -0
  88. data/spec/files/domains_whois_privacy/enable/success.http +22 -0
  89. data/spec/files/domains_zones/get/success.http +21 -0
  90. data/spec/files/domains_zones/notfound-domain.http +19 -0
  91. data/spec/files/{domains/auto_renewal_disable/notfound.http → nameservers/change/success.http} +23 -21
  92. data/spec/files/nameservers/deregister/success.http +17 -0
  93. data/spec/files/{domains/auto_renewal_enable/notfound.http → nameservers/list/success.http} +23 -21
  94. data/spec/files/nameservers/notfound-domain.http +19 -0
  95. data/spec/files/nameservers/register/badrequest-valueerror.http +19 -0
  96. data/spec/files/nameservers/register/success.http +21 -0
  97. data/spec/files/registrars/check/available.http +19 -0
  98. data/spec/files/registrars/check/registered.http +21 -0
  99. data/spec/files/registrars/register/badrequest-missingdomain.http +19 -0
  100. data/spec/files/registrars/register/badrequest-missingregistrant.http +19 -0
  101. data/spec/files/registrars/register/success.http +21 -0
  102. data/spec/files/registrars/renew/badrequest-missingrenewal.http +19 -0
  103. data/spec/files/registrars/renew/badrequest-unable.http +19 -0
  104. data/spec/files/registrars/renew/success.http +21 -0
  105. data/spec/files/registrars/transfer/success.http +21 -0
  106. data/spec/files/registrars_extended_attributes/list/success.http +21 -0
  107. data/spec/files/registrars_prices/list/success.http +21 -0
  108. data/spec/files/services/applied/success.http +21 -0
  109. data/spec/files/services/apply/success.http +21 -0
  110. data/spec/files/services/available/success.http +21 -0
  111. data/spec/files/services/index/success.http +21 -0
  112. data/spec/files/services/notfound.http +19 -0
  113. data/spec/files/services/show/success.http +21 -0
  114. data/spec/files/services/unapply/success.http +21 -0
  115. data/spec/files/subscription/show/success.http +21 -0
  116. data/spec/files/templates/apply/success.http +21 -0
  117. data/spec/files/templates/create/created.http +22 -0
  118. data/spec/files/templates/delete/success-204.http +21 -0
  119. data/spec/files/templates/delete/success.http +21 -0
  120. data/spec/files/templates/index/success.http +21 -0
  121. data/spec/files/templates/notfound.http +19 -0
  122. data/spec/files/templates/show/success.http +12 -10
  123. data/spec/files/templates/update/success.http +21 -0
  124. data/spec/files/templates_records/create/created.http +22 -0
  125. data/spec/files/templates_records/delete/success-204.http +19 -0
  126. data/spec/files/templates_records/delete/success.http +21 -0
  127. data/spec/files/templates_records/index/success.http +21 -0
  128. data/spec/files/templates_records/notfound.http +19 -0
  129. data/spec/files/templates_records/show/success.http +21 -0
  130. data/spec/files/templates_records/update/success.http +21 -0
  131. data/spec/files/users/user/success.http +21 -0
  132. data/spec/spec_helper.rb +0 -2
  133. metadata +206 -73
  134. data/lib/dnsimple/base.rb +0 -10
  135. data/lib/dnsimple/certificate.rb +0 -143
  136. data/lib/dnsimple/contact.rb +0 -157
  137. data/lib/dnsimple/domain.rb +0 -252
  138. data/lib/dnsimple/extended_attribute.rb +0 -52
  139. data/lib/dnsimple/record.rb +0 -94
  140. data/lib/dnsimple/service.rb +0 -42
  141. data/lib/dnsimple/template.rb +0 -65
  142. data/lib/dnsimple/template_record.rb +0 -80
  143. data/lib/dnsimple/transfer_order.rb +0 -34
  144. data/lib/dnsimple/user.rb +0 -50
  145. data/spec/dnsimple/certificate_spec.rb +0 -59
  146. data/spec/dnsimple/contact_spec.rb +0 -45
  147. data/spec/dnsimple/domain_spec.rb +0 -241
  148. data/spec/dnsimple/extended_attributes_spec.rb +0 -54
  149. data/spec/dnsimple/record_spec.rb +0 -51
  150. data/spec/dnsimple/template_spec.rb +0 -31
  151. data/spec/dnsimple/user_spec.rb +0 -70
  152. data/spec/files/account/user/success.http +0 -19
  153. data/spec/files/certificates/show/notfound.http +0 -17
  154. data/spec/files/domains/auto_renewal_disable/success.http +0 -23
  155. data/spec/files/domains/create/success.http +0 -19
  156. data/spec/files/extended_attributes/ca.http +0 -19
  157. data/spec/files/extended_attributes/success.http +0 -19
  158. data/spec/files/templates/show/notfound.http +0 -17
@@ -1,52 +0,0 @@
1
- module Dnsimple
2
-
3
- # Used for domains that require extended attributes.
4
- class ExtendedAttribute < Base
5
-
6
- # An option for an extended attribute
7
- class Option < Base
8
- # The option name
9
- attr_accessor :title
10
-
11
- # The option value
12
- attr_accessor :value
13
-
14
- # A long description of the option
15
- attr_accessor :description
16
- end
17
-
18
- # The extended attribute name
19
- attr_accessor :name
20
-
21
- # A description of the extended attribute
22
- attr_accessor :description
23
-
24
- # Boolean indicating if the extended attribute is required
25
- attr_accessor :required
26
-
27
- # An array of options for the extended attribute
28
- def options
29
- @options ||= []
30
- end
31
-
32
- def options=(opts)
33
- @options = []
34
- opts.each do |opt|
35
- @options << ExtendedAttribute::Option.new(opt)
36
- end
37
- end
38
-
39
- # Find the extended attributes for the given TLD
40
- def self.find(tld, options={})
41
- response = Client.get("/v1/extended_attributes/#{tld}", options)
42
-
43
- case response.code
44
- when 200
45
- response.map { |r| new(r) }
46
- else
47
- raise RequestError.new("Error finding extended attributes", response)
48
- end
49
- end
50
-
51
- end
52
- end
@@ -1,94 +0,0 @@
1
- module Dnsimple
2
-
3
- class Record < Base
4
- Aliases = {
5
- 'priority' => 'prio',
6
- 'time-to-live' => 'ttl'
7
- }
8
-
9
- attr_accessor :id
10
- attr_accessor :domain
11
- attr_accessor :name
12
- attr_accessor :content
13
- attr_accessor :ttl
14
- attr_accessor :prio
15
- attr_accessor :record_type
16
-
17
-
18
- def fqdn
19
- [name, domain.name].delete_if { |v| v !~ BLANK_REGEX }.join(".")
20
- end
21
-
22
- def save(options={})
23
- record_hash = {}
24
- %w(name content ttl prio).each do |attribute|
25
- record_hash[Record.resolve(attribute)] = self.send(attribute)
26
- end
27
-
28
- options.merge!(:body => {:record => record_hash})
29
-
30
- response = Client.put("/v1/domains/#{domain.id}/records/#{id}", options)
31
-
32
- case response.code
33
- when 200
34
- self
35
- else
36
- raise RequestError.new("Error updating record", response)
37
- end
38
- end
39
-
40
- def delete(options={})
41
- Client.delete("/v1/domains/#{domain.id}/records/#{id}", options)
42
- end
43
- alias :destroy :delete
44
-
45
- def self.resolve(name)
46
- Record::Aliases[name] || name
47
- end
48
-
49
- def self.create(domain, name, record_type, content, options={})
50
- record_hash = {:name => name, :record_type => record_type, :content => content}
51
- record_hash[:ttl] = options.delete(:ttl) || 3600
52
- record_hash[:prio] = options.delete(:priority)
53
- record_hash[:prio] = options.delete(:prio) || ''
54
-
55
- options.merge!({:body => {:record => record_hash}})
56
-
57
- response = Client.post("/v1/domains/#{domain.name}/records", options)
58
-
59
- case response.code
60
- when 201
61
- new({:domain => domain}.merge(response["record"]))
62
- when 406
63
- raise RecordExists, "Record #{name}.#{domain.name} already exists"
64
- else
65
- raise RequestError.new("Error creating record", response)
66
- end
67
- end
68
-
69
- def self.find(domain, id, options={})
70
- response = Client.get("/v1/domains/#{domain.name}/records/#{id}", options)
71
-
72
- case response.code
73
- when 200
74
- new({:domain => domain}.merge(response["record"]))
75
- when 404
76
- raise RecordNotFound, "Could not find record #{id} for domain #{domain.name}"
77
- else
78
- raise RequestError.new("Error finding record", response)
79
- end
80
- end
81
-
82
- def self.all(domain, options={})
83
- response = Client.get("/v1/domains/#{domain.name}/records", options)
84
-
85
- case response.code
86
- when 200
87
- response.map { |r| new({:domain => domain}.merge(r["record"])) }
88
- else
89
- raise RequestError.new("Error listing records", response)
90
- end
91
- end
92
-
93
- end
94
- end
@@ -1,42 +0,0 @@
1
- module Dnsimple
2
-
3
- # Represents a service that can be applied to a domain.
4
- class Service < Base
5
-
6
- attr_accessor :id
7
-
8
- attr_accessor :name
9
-
10
- attr_accessor :short_name
11
-
12
- attr_accessor :description
13
-
14
- # Find a service by its ID or short name
15
- def self.find(id_or_short_name, options={})
16
- id = id_or_short_name
17
- response = Client.get("/v1/services/#{id}", options)
18
-
19
- case response.code
20
- when 200
21
- new(response["service"])
22
- when 404
23
- raise RecordNotFound, "Could not find service #{id}"
24
- else
25
- raise RequestError.new("Error finding service", response)
26
- end
27
- end
28
-
29
- # Get all of the services that can be applied to a domain
30
- def self.all(options={})
31
- response = Client.get("/v1/services", options)
32
-
33
- case response.code
34
- when 200
35
- response.map { |r| new(r["service"]) }
36
- else
37
- raise RequestError.new("Error listing services", response)
38
- end
39
- end
40
-
41
- end
42
- end
@@ -1,65 +0,0 @@
1
- module Dnsimple
2
- class Template < Base
3
-
4
- attr_accessor :id
5
- attr_accessor :name
6
- attr_accessor :short_name
7
- attr_accessor :description
8
-
9
-
10
- def self.create(name, short_name, description=nil, options={})
11
- template_hash = {
12
- :name => name,
13
- :short_name => short_name,
14
- :description => description
15
- }
16
-
17
- options.merge!(:body => {:dns_template => template_hash})
18
-
19
- response = Client.post("/v1/templates", options)
20
-
21
- case response.code
22
- when 201
23
- new(response["dns_template"])
24
- else
25
- raise RequestError.new("Error creating template", response)
26
- end
27
- end
28
-
29
- def self.find(id_or_short_name, options={})
30
- id = id_or_short_name
31
- response = Client.get("/v1/templates/#{id}", options)
32
-
33
- case response.code
34
- when 200
35
- new(response["dns_template"])
36
- when 404
37
- raise RecordNotFound, "Could not find template #{id}"
38
- else
39
- raise RequestError.new("Error finding template", response)
40
- end
41
- end
42
-
43
- def self.all(options={})
44
- response = Client.get("/v1/templates", options)
45
-
46
- case response.code
47
- when 200
48
- response.map { |r| new(r["dns_template"]) }
49
- else
50
- raise RequestError.new("Error listing templates", response)
51
- end
52
- end
53
-
54
-
55
- # #delete the template from DNSimple.
56
- #
57
- # WARNING: this cannot be undone.
58
- #
59
- def delete(options={})
60
- Client.delete("/v1/templates/#{id}", options)
61
- end
62
- alias :destroy :delete
63
-
64
- end
65
- end
@@ -1,80 +0,0 @@
1
- module Dnsimple
2
-
3
- # A single record in a template.
4
- class TemplateRecord < Base
5
-
6
- # The id of the template record
7
- attr_accessor :id
8
-
9
- # The template the record belongs to
10
- attr_accessor :template
11
-
12
- # The name the record points to. This may be blank.
13
- attr_accessor :name
14
-
15
- # The content for the record.
16
- attr_accessor :content
17
-
18
- # The record type
19
- attr_accessor :record_type
20
-
21
- # The time-to-live
22
- attr_accessor :ttl
23
-
24
- # The priority (only for MX records)
25
- attr_accessor :prio
26
-
27
- def delete(options={})
28
- Client.delete("/v1/templates/#{template.id}/template_records/#{id}", options)
29
- end
30
- alias :destroy :delete
31
-
32
- def self.create(short_name, name, record_type, content, options={})
33
- template = Template.find(short_name)
34
-
35
- record_hash = {:name => name, :record_type => record_type, :content => content}
36
- record_hash[:ttl] = options.delete(:ttl) || 3600
37
- record_hash[:prio] = options.delete(:prio) || ''
38
-
39
- options.merge!({:query => {:dns_template_record => record_hash}})
40
-
41
- response = Client.post("/v1/templates/#{template.id}/template_records", options)
42
-
43
- case response.code
44
- when 201
45
- new({:template => template}.merge(response["dns_template_record"]))
46
- else
47
- raise RequestError.new("Error creating template record", response)
48
- end
49
- end
50
-
51
- def self.find(short_name, id, options={})
52
- template = Template.find(short_name)
53
- response = Client.get("/v1/templates/#{template.id}/template_records/#{id}", options)
54
-
55
- case response.code
56
- when 200
57
- new({:template => template}.merge(response["dns_template_record"]))
58
- when 404
59
- raise RecordNotFound, "Could not find template record #{id} for template #{template.id}"
60
- else
61
- raise RequestError.new("Error finding template record", response)
62
- end
63
- end
64
-
65
- # Get all of the template records for the template with the
66
- # given short name.
67
- def self.all(short_name, options={})
68
- template = Template.find(short_name)
69
- response = Client.get("/v1/templates/#{template.id}/template_records", options)
70
-
71
- case response.code
72
- when 200
73
- response.map { |r| new({:template => template}.merge(r["dns_template_record"])) }
74
- else
75
- raise RequestError.new("Error listing template records", response)
76
- end
77
- end
78
-
79
- end
80
- end
@@ -1,34 +0,0 @@
1
- module Dnsimple
2
-
3
- # Represents a transfer order.
4
- class TransferOrder < Base
5
-
6
- attr_accessor :id
7
-
8
- attr_accessor :status
9
-
10
- def self.create(name, authinfo='', registrant={}, extended_attributes={}, options={})
11
- body = {:domain => {:name => name}, :transfer_order => {:authinfo => authinfo}}
12
-
13
- if registrant[:id]
14
- body[:domain][:registrant_id] = registrant[:id]
15
- else
16
- body.merge!(:contact => Contact.resolve_attributes(registrant))
17
- end
18
-
19
- body.merge!(:extended_attribute => extended_attributes)
20
-
21
- options.merge!({:body => body})
22
-
23
- response = Client.post("/v1/domain_transfers", options)
24
-
25
- case response.code
26
- when 201
27
- new(response["transfer_order"])
28
- else
29
- raise RequestError.new("Error creating transfer order", response)
30
- end
31
- end
32
-
33
- end
34
- end
data/lib/dnsimple/user.rb DELETED
@@ -1,50 +0,0 @@
1
- module Dnsimple
2
- class User < Base
3
-
4
- attr_accessor :id
5
- attr_accessor :email
6
- attr_accessor :domain_count
7
- attr_accessor :domain_limit
8
- attr_accessor :login_count
9
- attr_accessor :failed_login_count
10
- attr_accessor :created_at
11
- attr_accessor :updated_at
12
-
13
-
14
- # Fetches the information about the authenticated user.
15
- #
16
- # @return [User] the authenticated user
17
- # @raise [RequestError] if the user doesn't exist
18
- def self.me
19
- response = Client.get("/v1/user")
20
-
21
- case response.code
22
- when 200
23
- new(response["user"])
24
- else
25
- raise RequestError.new("Error finding account", response)
26
- end
27
- end
28
-
29
- # Requests a new two-factor authentication exchange token.
30
- #
31
- # The exchange-token is required to validate API requests
32
- # using HTTP Basic Authentication when the account has two-factor authentication enabled.
33
- #
34
- # @see http://developer.dnsimple.com/authentication/#twofa
35
- #
36
- # @example Request an Exchange Token
37
- # Dnsimple::User.two_factor_exchange_token('0000000')
38
- # # => "cda038832591e34f5df642ce2b61dc78"
39
- #
40
- # @param [String] otp_token the two-factor one time (OTP) token
41
- #
42
- # @return [String] the two-factor API exchange token
43
- # @raise [AuthenticationFailed] if the provided OTP token is invalid
44
- def self.two_factor_exchange_token(otp_token)
45
- response = Client.get("/v1/user", :headers => { Client::HEADER_2FA_STRICT => "1", Client::HEADER_OTP_TOKEN => otp_token })
46
- response.headers[Client::HEADER_EXCHANGE_TOKEN]
47
- end
48
-
49
- end
50
- end
@@ -1,59 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Dnsimple::Certificate do
4
-
5
- let(:domain) { Dnsimple::Domain.new(:name => "example.com") }
6
-
7
-
8
- describe ".find" do
9
- before do
10
- stub_request(:get, %r[/v1/domains/example.com/certificates/2]).
11
- to_return(read_fixture("certificates/show/success.http"))
12
- end
13
-
14
- it "builds the correct request" do
15
- described_class.find(domain, "2")
16
-
17
- expect(WebMock).to have_requested(:get, "https://#{CONFIG['username']}:#{CONFIG['password']}@#{CONFIG['host']}/v1/domains/example.com/certificates/2").
18
- with(:headers => { 'Accept' => 'application/json' })
19
- end
20
-
21
- context "when the certificate exists" do
22
- it "returns the certificate" do
23
- result = described_class.find(domain, "2")
24
-
25
- expect(result.id).to eq(4576)
26
- expect(result.domain_id).to eq(79569)
27
- expect(result.contact_id).to eq(11549)
28
- expect(result.name).to eq("www")
29
- expect(result.state).to eq("cancelled")
30
- expect(result.csr).to eq("-----BEGIN NEW CERTIFICATE REQUEST-----\nRHr2akB4KMba6FMAsvlStnO/2ika16hNx+d3smPNsER+HA==\n-----END NEW CERTIFICATE REQUEST-----\n")
31
- expect(result.ssl_certificate).to eq("-----BEGIN CERTIFICATE-----\nXwTkw5UCPpaVyUYcwHlvaprOe9ZbwIyEHm2AT1rW+70=\n-----END CERTIFICATE-----\n")
32
- expect(result.private_key).to eq("-----BEGIN RSA PRIVATE KEY-----\nUeXbFi7o+nuPfRhpBFQEKwacKFc3Hnc1hH6UsnC0KY25cUif7yz38A==\n-----END RSA PRIVATE KEY-----\n")
33
- expect(result.approver_email).to eq("example@example.net")
34
- expect(result.created_at).to eq("2013-09-17T21:54:42Z")
35
- expect(result.updated_at).to eq("2013-09-17T22:25:36Z")
36
- expect(result.configured_at).to eq("2013-09-17T22:25:01Z")
37
- expect(result.expires_on).to eq("2014-09-17")
38
-
39
- expect(result.domain).to eq(domain)
40
- end
41
- end
42
- end
43
-
44
-
45
- describe "#fqdn" do
46
- it "joins the name and domain name" do
47
- certificate = described_class.new(:name => 'www')
48
- certificate.domain = domain
49
- expect(certificate.fqdn).to eq("www.#{domain.name}")
50
- end
51
-
52
- it "strips blank parts from name" do
53
- certificate = described_class.new(:name => '')
54
- certificate.domain = domain
55
- expect(certificate.fqdn).to eq(domain.name)
56
- end
57
- end
58
-
59
- end