dnsimple-ruby 0.9.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/.bundle/config +2 -2
  2. data/.rvmrc +1 -2
  3. data/LICENSE +1 -1
  4. data/VERSION +1 -1
  5. data/dnsimple-ruby.gemspec +1 -1
  6. data/fixtures/vcr_cassettes/DNSimple_Contact/a_new_contact.yml +1 -1
  7. data/fixtures/vcr_cassettes/DNSimple_Contact/an_existing_contact.yml +1 -1
  8. data/fixtures/vcr_cassettes/DNSimple_Domain/_all.yml +4 -4
  9. data/fixtures/vcr_cassettes/DNSimple_Domain/applying_templates.yml +7 -7
  10. data/fixtures/vcr_cassettes/DNSimple_Domain/creating_a_new_domain.yml +1 -1
  11. data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain.yml +1 -1
  12. data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_id.yml +1 -1
  13. data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_name.yml +1 -1
  14. data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_a_new_registrant_contact.yml +1 -1
  15. data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_an_existing_contact.yml +1 -1
  16. data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_ca.yml +1 -1
  17. data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_com.yml +1 -1
  18. data/fixtures/vcr_cassettes/DNSimple_Record/_all.yml +8 -8
  19. data/fixtures/vcr_cassettes/DNSimple_Record/creating_a_new_record.yml +2 -2
  20. data/fixtures/vcr_cassettes/DNSimple_Record/find_a_record.yml +2 -2
  21. data/fixtures/vcr_cassettes/DNSimple_Template/a_template.yml +1 -1
  22. data/fixtures/vcr_cassettes/DNSimple_User/_me.yml +1 -1
  23. data/lib/dnsimple.rb +4 -0
  24. data/lib/dnsimple/certificate.rb +1 -1
  25. data/lib/dnsimple/client.rb +12 -7
  26. data/lib/dnsimple/commands/describe_contact.rb +3 -3
  27. data/lib/dnsimple/record.rb +1 -1
  28. data/spec/certificate_spec.rb +18 -0
  29. data/spec/record_spec.rb +14 -0
  30. data/spec/spec_helper.rb +3 -0
  31. metadata +64 -64
@@ -1,2 +1,2 @@
1
- ---
2
- BUNDLE_DISABLE_SHARED_GEMS: "1"
1
+ --- {}
2
+
data/.rvmrc CHANGED
@@ -1,2 +1 @@
1
- rvm use ruby-1.8.7-p249
2
- rvm gemset use dnsimple-ruby
1
+ rvm use ruby-1.8.7@dnsimple-ruby --create
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2010 Aetrion LLC
3
+ Copyright (c) 2010-2011 Aetrion LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.9
1
+ 1.0.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dnsimple-ruby}
8
- s.version = "0.9.1"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Anthony Eden"]
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :post
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/contacts.json
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/contacts.json
6
6
  body: contact[first_name]=John&contact[country]=US&contact[last_name]=Doe&contact[email_address]=john.doe%40example.com&contact[address1]=1%20SW%201st%20Street&contact[phone]=305%20111%202222&contact[city]=Miami&contact[state_province]=FL&contact[postal_code]=33143
7
7
  headers:
8
8
  authorization:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/contacts/32.json
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/contacts/32.json
6
6
  body:
7
7
  headers:
8
8
  authorization:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :post
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains
6
6
  body: domain[name]=testdomain0.com
7
7
  headers:
8
8
  accept:
@@ -47,7 +47,7 @@
47
47
  - !ruby/struct:VCR::HTTPInteraction
48
48
  request: !ruby/struct:VCR::Request
49
49
  method: :post
50
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains
50
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains
51
51
  body: domain[name]=testdomain1.com
52
52
  headers:
53
53
  accept:
@@ -92,7 +92,7 @@
92
92
  - !ruby/struct:VCR::HTTPInteraction
93
93
  request: !ruby/struct:VCR::Request
94
94
  method: :post
95
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains
95
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains
96
96
  body: domain[name]=testdomain2.com
97
97
  headers:
98
98
  accept:
@@ -137,7 +137,7 @@
137
137
  - !ruby/struct:VCR::HTTPInteraction
138
138
  request: !ruby/struct:VCR::Request
139
139
  method: :get
140
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains
140
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains
141
141
  body:
142
142
  headers:
143
143
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
6
6
  body:
7
7
  headers:
8
8
  accept:
@@ -47,7 +47,7 @@
47
47
  - !ruby/struct:VCR::HTTPInteraction
48
48
  request: !ruby/struct:VCR::Request
49
49
  method: :get
50
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
50
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
51
51
  body:
52
52
  headers:
53
53
  accept:
@@ -92,7 +92,7 @@
92
92
  - !ruby/struct:VCR::HTTPInteraction
93
93
  request: !ruby/struct:VCR::Request
94
94
  method: :get
95
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141/records
95
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/141/records
96
96
  body:
97
97
  headers:
98
98
  accept:
@@ -137,7 +137,7 @@
137
137
  - !ruby/struct:VCR::HTTPInteraction
138
138
  request: !ruby/struct:VCR::Request
139
139
  method: :get
140
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/templates/googleapps
140
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/templates/googleapps
141
141
  body:
142
142
  headers:
143
143
  accept:
@@ -182,7 +182,7 @@
182
182
  - !ruby/struct:VCR::HTTPInteraction
183
183
  request: !ruby/struct:VCR::Request
184
184
  method: :post
185
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141/templates/3/apply
185
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/141/templates/3/apply
186
186
  body:
187
187
  headers:
188
188
  accept:
@@ -227,7 +227,7 @@
227
227
  - !ruby/struct:VCR::HTTPInteraction
228
228
  request: !ruby/struct:VCR::Request
229
229
  method: :get
230
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
230
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
231
231
  body:
232
232
  headers:
233
233
  accept:
@@ -272,7 +272,7 @@
272
272
  - !ruby/struct:VCR::HTTPInteraction
273
273
  request: !ruby/struct:VCR::Request
274
274
  method: :get
275
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141/records
275
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/141/records
276
276
  body:
277
277
  headers:
278
278
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :post
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains
6
6
  body: domain[name]=testdomain.com
7
7
  headers:
8
8
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/141
6
6
  body:
7
7
  headers:
8
8
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/141
6
6
  body:
7
7
  headers:
8
8
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
6
6
  body:
7
7
  headers:
8
8
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :post
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domain_registrations
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domain_registrations
6
6
  body: domain[name]=testdomain-1306090283.net&contact[phone]=321%20555%201212&contact[state_province]=FL&contact[address1]=123%20SW%201st%20Street&contact[city]=Miami&contact[country]=US&contact[first_name]=John&contact[postal_code]=33143&contact[last_name]=Smith
7
7
  headers:
8
8
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :post
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domain_registrations
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domain_registrations
6
6
  body: domain[registrant_id]=4&domain[name]=testdomain-1306090402.net
7
7
  headers:
8
8
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/extended_attributes/ca.json
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/extended_attributes/ca.json
6
6
  body:
7
7
  headers:
8
8
  authorization:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/extended_attributes/com.json
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/extended_attributes/com.json
6
6
  body:
7
7
  headers:
8
8
  authorization:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
6
6
  body:
7
7
  headers:
8
8
  accept:
@@ -47,7 +47,7 @@
47
47
  - !ruby/struct:VCR::HTTPInteraction
48
48
  request: !ruby/struct:VCR::Request
49
49
  method: :post
50
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/155/records?record[content]=4.5.6.7&record[ttl]=3600&record[prio]=&record[name]=&record[record_type]=A
50
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/155/records?record[content]=4.5.6.7&record[ttl]=3600&record[prio]=&record[name]=&record[record_type]=A
51
51
  body:
52
52
  headers:
53
53
  accept:
@@ -92,7 +92,7 @@
92
92
  - !ruby/struct:VCR::HTTPInteraction
93
93
  request: !ruby/struct:VCR::Request
94
94
  method: :get
95
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
95
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
96
96
  body:
97
97
  headers:
98
98
  accept:
@@ -137,7 +137,7 @@
137
137
  - !ruby/struct:VCR::HTTPInteraction
138
138
  request: !ruby/struct:VCR::Request
139
139
  method: :post
140
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/155/records?record[content]=testdomain.com&record[ttl]=3600&record[prio]=&record[name]=www&record[record_type]=CNAME
140
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/155/records?record[content]=testdomain.com&record[ttl]=3600&record[prio]=&record[name]=www&record[record_type]=CNAME
141
141
  body:
142
142
  headers:
143
143
  accept:
@@ -182,7 +182,7 @@
182
182
  - !ruby/struct:VCR::HTTPInteraction
183
183
  request: !ruby/struct:VCR::Request
184
184
  method: :get
185
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
185
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
186
186
  body:
187
187
  headers:
188
188
  accept:
@@ -227,7 +227,7 @@
227
227
  - !ruby/struct:VCR::HTTPInteraction
228
228
  request: !ruby/struct:VCR::Request
229
229
  method: :post
230
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/155/records?record[content]=mail.foo.com&record[ttl]=3600&record[prio]=10&record[name]=&record[record_type]=MX
230
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/155/records?record[content]=mail.foo.com&record[ttl]=3600&record[prio]=10&record[name]=&record[record_type]=MX
231
231
  body:
232
232
  headers:
233
233
  accept:
@@ -272,7 +272,7 @@
272
272
  - !ruby/struct:VCR::HTTPInteraction
273
273
  request: !ruby/struct:VCR::Request
274
274
  method: :get
275
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
275
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
276
276
  body:
277
277
  headers:
278
278
  accept:
@@ -317,7 +317,7 @@
317
317
  - !ruby/struct:VCR::HTTPInteraction
318
318
  request: !ruby/struct:VCR::Request
319
319
  method: :get
320
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/155/records
320
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/155/records
321
321
  body:
322
322
  headers:
323
323
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
6
6
  body:
7
7
  headers:
8
8
  accept:
@@ -47,7 +47,7 @@
47
47
  - !ruby/struct:VCR::HTTPInteraction
48
48
  request: !ruby/struct:VCR::Request
49
49
  method: :post
50
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141/records?record[content]=1.2.3.4&record[prio]=&record[ttl]=600&record[name]=&record[record_type]=A
50
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/141/records?record[content]=1.2.3.4&record[prio]=&record[ttl]=600&record[name]=&record[record_type]=A
51
51
  body:
52
52
  headers:
53
53
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/testdomain.com
6
6
  body:
7
7
  headers:
8
8
  accept:
@@ -47,7 +47,7 @@
47
47
  - !ruby/struct:VCR::HTTPInteraction
48
48
  request: !ruby/struct:VCR::Request
49
49
  method: :get
50
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141/records/193
50
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/domains/141/records/193
51
51
  body:
52
52
  headers:
53
53
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/templates/googleapps
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/templates/googleapps
6
6
  body:
7
7
  headers:
8
8
  accept:
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/users/me.json
5
+ uri: https://<USERNAME>:<PASSWORD>@test.dnsimple.com:443/users/me.json
6
6
  body:
7
7
  headers:
8
8
  authorization:
@@ -1,6 +1,10 @@
1
1
  require 'pp'
2
2
  require 'httparty'
3
3
 
4
+ module DNSimple
5
+ BLANK_REGEX = /\S+/
6
+ end
7
+
4
8
  require 'dnsimple/client'
5
9
  require 'dnsimple/error'
6
10
  require 'dnsimple/user'
@@ -26,7 +26,7 @@ module DNSimple #:nodoc:
26
26
  end
27
27
 
28
28
  def fqdn
29
- [name, domain.name].delete_if { |p| p !~ /\S+/ }.join(".")
29
+ [name, domain.name].delete_if { |p| p !~ DNSimple::BLANK_REGEX }.join(".")
30
30
  end
31
31
 
32
32
  def self.purchase(domain_name, name, options={})
@@ -46,16 +46,21 @@ module DNSimple
46
46
  end
47
47
 
48
48
  def self.load_credentials(path=config_path)
49
- credentials = YAML.load(File.new(File.expand_path(path)))
50
- self.username = credentials['username']
51
- self.password = credentials['password']
52
- self.base_uri = credentials['site']
53
- @@credentials_loaded = true
54
- "Credentials loaded from #{path}"
49
+ begin
50
+ credentials = YAML.load(File.new(File.expand_path(path)))
51
+ self.username = credentials['username']
52
+ self.password = credentials['password']
53
+ self.base_uri = credentials['site']
54
+ @@credentials_loaded = true
55
+ "Credentials loaded from #{path}"
56
+ rescue
57
+ puts "Error loading your credentials: #{$!.message}"
58
+ exit 1
59
+ end
55
60
  end
56
61
 
57
62
  def self.credentials_loaded?
58
- @@credentials_loaded ||= false
63
+ (@@credentials_loaded ||= false) or (defined?(@@username) and defined?(@@password))
59
64
  end
60
65
 
61
66
  def self.standard_options
@@ -8,8 +8,8 @@ module DNSimple
8
8
  puts "\tID: #{contact.id}"
9
9
  puts "\tFirst Name: #{contact.first_name}"
10
10
  puts "\tLast Name: #{contact.last_name}"
11
- puts "\tOrganization Name: #{contact.organization_name}" unless contact.organization_name.blank?
12
- puts "\tJob Title: #{contact.job_title}" unless contact.job_title.blank?
11
+ puts "\tOrganization Name: #{contact.organization_name}" if contact.organization_name
12
+ puts "\tJob Title: #{contact.job_title}" if contact.job_title
13
13
  puts "\tAddress 1: #{contact.address1}"
14
14
  puts "\tAddress 2: #{contact.address2}"
15
15
  puts "\tCity: #{contact.city}"
@@ -18,7 +18,7 @@ module DNSimple
18
18
  puts "\tCountry: #{contact.country}"
19
19
  puts "\tEmail: #{contact.email_address}"
20
20
  puts "\tPhone: #{contact.phone}"
21
- puts "\tPhone Ext: #{contact.phone_ext}" unless contact.phone_ext.blank?
21
+ puts "\tPhone Ext: #{contact.phone_ext}" if contact.phone_ext
22
22
  end
23
23
  end
24
24
  end
@@ -25,7 +25,7 @@ module DNSimple
25
25
  end
26
26
 
27
27
  def fqdn
28
- [name, domain.name].delete_if { |v| v.blank? }.join(".")
28
+ [name, domain.name].delete_if { |v| v !~ DNSimple::BLANK_REGEX }.join(".")
29
29
  end
30
30
 
31
31
  def save(options={})
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe DNSimple::Certificate do
4
+ let(:domain) { DNSimple::Domain.new(:name => 'example.com') }
5
+ describe "#fqdn" do
6
+ it "joins the name and domain name" do
7
+ certificate = DNSimple::Certificate.new(:name => 'www')
8
+ certificate.domain = domain
9
+ certificate.fqdn.should eq('www.example.com')
10
+ end
11
+ it "strips blank parts from name" do
12
+ certificate = DNSimple::Certificate.new(:name => '')
13
+ certificate.domain = domain
14
+ certificate.fqdn.should eq('example.com')
15
+ end
16
+ end
17
+
18
+ end
@@ -1,6 +1,20 @@
1
1
  require File.join(File.dirname(__FILE__), 'spec_helper')
2
2
 
3
3
  describe DNSimple::Record do
4
+
5
+ let(:domain) { DNSimple::Domain.new(:name => 'example.com') }
6
+
7
+ describe "#fqdn" do
8
+ it "joins the name and domain name" do
9
+ record = DNSimple::Record.new(:name => 'www', :domain => domain)
10
+ record.fqdn.should eq('www.example.com')
11
+ end
12
+ it "strips a blank name" do
13
+ record = DNSimple::Record.new(:name => '', :domain => domain)
14
+ record.fqdn.should eq('example.com')
15
+ end
16
+ end
17
+
4
18
  describe "creating a new record" do
5
19
  use_vcr_cassette
6
20
  it "has specific attributes" do
@@ -1,9 +1,12 @@
1
1
  require 'vcr'
2
+ require 'cgi'
2
3
  require 'lib/dnsimple'
3
4
 
4
5
  VCR.config do |c|
5
6
  c.cassette_library_dir = 'fixtures/vcr_cassettes'
6
7
  c.stub_with :fakeweb
8
+ c.filter_sensitive_data("<USERNAME>") { CGI::escape(DNSimple::Client.username) }
9
+ c.filter_sensitive_data("<PASSWORD>") { CGI::escape(DNSimple::Client.password) }
7
10
  end
8
11
 
9
12
  RSpec.configure do |c|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsimple-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
+ - 1
8
+ - 0
7
9
  - 0
8
- - 9
9
- - 9
10
- version: 0.9.9
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anthony Eden
@@ -15,14 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-22 00:00:00 -04:00
19
- default_executable: dnsimple
18
+ date: 2011-11-03 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- type: :runtime
23
- prerelease: false
24
- name: httparty
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ requirement: &id001 !ruby/object:Gem::Requirement
26
22
  none: false
27
23
  requirements:
28
24
  - - ">="
@@ -31,12 +27,12 @@ dependencies:
31
27
  segments:
32
28
  - 0
33
29
  version: "0"
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
36
- type: :development
30
+ version_requirements: *id001
31
+ name: httparty
37
32
  prerelease: false
38
- name: rake
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
33
+ type: :runtime
34
+ - !ruby/object:Gem::Dependency
35
+ requirement: &id002 !ruby/object:Gem::Requirement
40
36
  none: false
41
37
  requirements:
42
38
  - - ">="
@@ -45,12 +41,12 @@ dependencies:
45
41
  segments:
46
42
  - 0
47
43
  version: "0"
48
- requirement: *id002
49
- - !ruby/object:Gem::Dependency
50
- type: :development
44
+ version_requirements: *id002
45
+ name: rake
51
46
  prerelease: false
52
- name: jeweler
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
47
+ type: :development
48
+ - !ruby/object:Gem::Dependency
49
+ requirement: &id003 !ruby/object:Gem::Requirement
54
50
  none: false
55
51
  requirements:
56
52
  - - ">="
@@ -59,12 +55,12 @@ dependencies:
59
55
  segments:
60
56
  - 0
61
57
  version: "0"
62
- requirement: *id003
63
- - !ruby/object:Gem::Dependency
64
- type: :development
58
+ version_requirements: *id003
59
+ name: jeweler
65
60
  prerelease: false
66
- name: rspec
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ requirement: &id004 !ruby/object:Gem::Requirement
68
64
  none: false
69
65
  requirements:
70
66
  - - ">="
@@ -75,12 +71,12 @@ dependencies:
75
71
  - 0
76
72
  - 0
77
73
  version: 2.0.0
78
- requirement: *id004
79
- - !ruby/object:Gem::Dependency
80
- type: :development
74
+ version_requirements: *id004
75
+ name: rspec
81
76
  prerelease: false
82
- name: ruby-debug
83
- version_requirements: &id005 !ruby/object:Gem::Requirement
77
+ type: :development
78
+ - !ruby/object:Gem::Dependency
79
+ requirement: &id005 !ruby/object:Gem::Requirement
84
80
  none: false
85
81
  requirements:
86
82
  - - ">="
@@ -89,12 +85,12 @@ dependencies:
89
85
  segments:
90
86
  - 0
91
87
  version: "0"
92
- requirement: *id005
93
- - !ruby/object:Gem::Dependency
94
- type: :development
88
+ version_requirements: *id005
89
+ name: ruby-debug
95
90
  prerelease: false
96
- name: cucumber
97
- version_requirements: &id006 !ruby/object:Gem::Requirement
91
+ type: :development
92
+ - !ruby/object:Gem::Dependency
93
+ requirement: &id006 !ruby/object:Gem::Requirement
98
94
  none: false
99
95
  requirements:
100
96
  - - ">="
@@ -103,12 +99,12 @@ dependencies:
103
99
  segments:
104
100
  - 0
105
101
  version: "0"
106
- requirement: *id006
107
- - !ruby/object:Gem::Dependency
108
- type: :development
102
+ version_requirements: *id006
103
+ name: cucumber
109
104
  prerelease: false
110
- name: aruba
111
- version_requirements: &id007 !ruby/object:Gem::Requirement
105
+ type: :development
106
+ - !ruby/object:Gem::Dependency
107
+ requirement: &id007 !ruby/object:Gem::Requirement
112
108
  none: false
113
109
  requirements:
114
110
  - - ">="
@@ -117,12 +113,12 @@ dependencies:
117
113
  segments:
118
114
  - 0
119
115
  version: "0"
120
- requirement: *id007
121
- - !ruby/object:Gem::Dependency
122
- type: :development
116
+ version_requirements: *id007
117
+ name: aruba
123
118
  prerelease: false
124
- name: ruby-debug
125
- version_requirements: &id008 !ruby/object:Gem::Requirement
119
+ type: :development
120
+ - !ruby/object:Gem::Dependency
121
+ requirement: &id008 !ruby/object:Gem::Requirement
126
122
  none: false
127
123
  requirements:
128
124
  - - ">="
@@ -131,12 +127,12 @@ dependencies:
131
127
  segments:
132
128
  - 0
133
129
  version: "0"
134
- requirement: *id008
135
- - !ruby/object:Gem::Dependency
136
- type: :development
130
+ version_requirements: *id008
131
+ name: ruby-debug
137
132
  prerelease: false
138
- name: fakeweb
139
- version_requirements: &id009 !ruby/object:Gem::Requirement
133
+ type: :development
134
+ - !ruby/object:Gem::Dependency
135
+ requirement: &id009 !ruby/object:Gem::Requirement
140
136
  none: false
141
137
  requirements:
142
138
  - - ">="
@@ -145,12 +141,12 @@ dependencies:
145
141
  segments:
146
142
  - 0
147
143
  version: "0"
148
- requirement: *id009
149
- - !ruby/object:Gem::Dependency
150
- type: :development
144
+ version_requirements: *id009
145
+ name: fakeweb
151
146
  prerelease: false
152
- name: vcr
153
- version_requirements: &id010 !ruby/object:Gem::Requirement
147
+ type: :development
148
+ - !ruby/object:Gem::Dependency
149
+ requirement: &id010 !ruby/object:Gem::Requirement
154
150
  none: false
155
151
  requirements:
156
152
  - - ">="
@@ -159,12 +155,12 @@ dependencies:
159
155
  segments:
160
156
  - 0
161
157
  version: "0"
162
- requirement: *id010
163
- - !ruby/object:Gem::Dependency
164
- type: :runtime
158
+ version_requirements: *id010
159
+ name: vcr
165
160
  prerelease: false
166
- name: httparty
167
- version_requirements: &id011 !ruby/object:Gem::Requirement
161
+ type: :development
162
+ - !ruby/object:Gem::Dependency
163
+ requirement: &id011 !ruby/object:Gem::Requirement
168
164
  none: false
169
165
  requirements:
170
166
  - - ">="
@@ -173,7 +169,10 @@ dependencies:
173
169
  segments:
174
170
  - 0
175
171
  version: "0"
176
- requirement: *id011
172
+ version_requirements: *id011
173
+ name: httparty
174
+ prerelease: false
175
+ type: :runtime
177
176
  description: A ruby wrapper for the DNSimple API that also includes a command-line client.
178
177
  email: anthony.eden@dnsimple.com
179
178
  executables:
@@ -282,6 +281,7 @@ files:
282
281
  - lib/dnsimple/transfer_order.rb
283
282
  - lib/dnsimple/user.rb
284
283
  - spec/README
284
+ - spec/certificate_spec.rb
285
285
  - spec/contact_spec.rb
286
286
  - spec/domain_spec.rb
287
287
  - spec/extended_attributes_spec.rb
@@ -289,7 +289,6 @@ files:
289
289
  - spec/spec_helper.rb
290
290
  - spec/template_spec.rb
291
291
  - spec/user_spec.rb
292
- has_rdoc: true
293
292
  homepage: http://github.com/aetrion/dnsimple-ruby
294
293
  licenses: []
295
294
 
@@ -319,11 +318,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
318
  requirements: []
320
319
 
321
320
  rubyforge_project:
322
- rubygems_version: 1.3.7
321
+ rubygems_version: 1.8.10
323
322
  signing_key:
324
323
  specification_version: 3
325
324
  summary: A ruby wrapper for the DNSimple API
326
325
  test_files:
326
+ - spec/certificate_spec.rb
327
327
  - spec/contact_spec.rb
328
328
  - spec/domain_spec.rb
329
329
  - spec/extended_attributes_spec.rb