Class: DNSimple::Commands::ContactCreate

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

Overview

Command to create a contact.

contact:create [ name:value name:value ... ]

Instance Method Summary collapse

Instance Method Details

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



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

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