Class: DNSimple::Commands::CreateContact

Inherits:
Object
  • Object
show all
Defined in:
lib/dnsimple/commands/create_contact.rb

Instance Method Summary collapse

Instance Method Details

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

Execute the contact:create command.

Args expected to be:

name:value name:value …


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

def execute(args, options={})
  attributes = {}
  attributes['state_province_choice'] = 'S'
  args.each do |arg|
    name, value = arg.split(":")
    attributes[Contact.resolve(name)] = value
  end

  contact = Contact.create(attributes, options)
  puts "Created contact #{contact.name} (id: #{contact.id})"
end