Class: DNSimple::Commands::CreateRecord

Inherits:
DNSimple::Command show all
Defined in:
lib/dnsimple/commands/create_record.rb

Instance Method Summary collapse

Methods inherited from DNSimple::Command

#initialize, #say

Constructor Details

This class inherits a constructor from DNSimple::Command

Instance Method Details

#execute(args, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dnsimple/commands/create_record.rb', line 6

def execute(args, options={})
  name = args.shift
  record_name = args.shift
  record_type = args.shift
  content = args.shift
  ttl = args.shift
  
  domain = Domain.find(name)
  record = Record.create(domain, record_name, record_type, content, :ttl => ttl, :prio => options[:prio])
  
  say "Created #{record.record_type} record for #{domain.name} (id:#{record.id})"
end