dnsimple-ruby 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -1,6 +1,8 @@
1
+ require 'dnsimple/command'
2
+
1
3
  module DNSimple
2
4
  module Commands
3
- class CreateRecord
5
+ class CreateRecord < Command
4
6
  def execute(args, options={})
5
7
  name = args.shift
6
8
  record_name = args.shift
@@ -9,9 +11,9 @@ module DNSimple
9
11
  ttl = args.shift
10
12
 
11
13
  domain = Domain.find(name)
12
- record = Record.create(domain.name, record_name, record_type, content, :ttl => ttl, :prio => options[:prio])
14
+ record = Record.create(domain, record_name, record_type, content, :ttl => ttl, :prio => options[:prio])
13
15
 
14
- puts "Created #{record.record_type} record for #{domain.name} (id:#{record.id})"
16
+ say "Created #{record.record_type} record for #{domain.name} (id:#{record.id})"
15
17
  end
16
18
  end
17
19
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+ require 'dnsimple/domain'
3
+ require 'dnsimple/record'
4
+ require 'dnsimple/commands/create_record'
5
+
6
+ describe DNSimple::Commands::CreateRecord do
7
+ let(:out) { StringIO.new }
8
+ let(:domain_name) { 'example.com' }
9
+ let(:record_name) { 'www' }
10
+ let(:record_type) { 'CNAME' }
11
+ let(:ttl) { "3600" }
12
+ context "with one argument" do
13
+ it "purchases the certificate" do
14
+ domain_stub = stub("domain", :name => domain_name)
15
+ record_stub = stub("record", :id => 1, :record_type => record_type)
16
+ DNSimple::Domain.expects(:find).with(domain_name).returns(domain_stub)
17
+ DNSimple::Record.expects(:create).with(domain_stub, record_name, record_type, domain_name, :ttl => ttl, :prio => nil).returns(record_stub)
18
+
19
+ DNSimple::Commands::CreateRecord.new(out).execute([domain_name, record_name, record_type, domain_name, ttl])
20
+ end
21
+ end
22
+ end
23
+
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 1
10
- version: 1.2.1
9
+ - 2
10
+ version: 1.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anthony Eden
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-14 00:00:00 Z
18
+ date: 2011-11-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -304,6 +304,7 @@ files:
304
304
  - spec/certificate_spec.rb
305
305
  - spec/command_spec.rb
306
306
  - spec/commands/add_service_spec.rb
307
+ - spec/commands/create_record_spec.rb
307
308
  - spec/commands/purchase_certificate_spec.rb
308
309
  - spec/commands/submit_certificate_spec.rb
309
310
  - spec/contact_spec.rb
@@ -350,6 +351,7 @@ test_files:
350
351
  - spec/certificate_spec.rb
351
352
  - spec/command_spec.rb
352
353
  - spec/commands/add_service_spec.rb
354
+ - spec/commands/create_record_spec.rb
353
355
  - spec/commands/purchase_certificate_spec.rb
354
356
  - spec/commands/submit_certificate_spec.rb
355
357
  - spec/contact_spec.rb