Class: DNSimple::Commands::UpdateContact
- Inherits:
-
Object
- Object
- DNSimple::Commands::UpdateContact
- Defined in:
- lib/dnsimple/commands/update_contact.rb
Instance Method Summary collapse
-
#execute(args, options = {}) ⇒ Object
Execute the contact:update command.
Instance Method Details
#execute(args, options = {}) ⇒ Object
Execute the contact:update command.
Args expected: id [name:value name:value …]
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dnsimple/commands/update_contact.rb', line 8 def execute(args, ={}) attributes = {} id = args.shift args.each do |arg| name, value = arg.split(":") attributes[Contact.resolve(name)] = value end contact = Contact.find(id) attributes.each do |name, value| contact.send("#{name}=", value) end contact.save puts "Updated contact #{contact.name} (id: #{contact.id})" end |